Help to search for a string value and return the index in the arraylist

Hello,
I just start java programming for the last three weeks and I cannot find a solution for this problem. I have the following List with string and integer value as shown below:
List<Empl> list= new ArrayList<Empl>();
     list.add(new Empl(1,"Jim", "Balu",88);
     list.add(new Empl(3,"Bob", "Howards",2);
     list.add(new Empl(2,"Chris", "Hup",8);
I have no problem of sorting this arraylist either by firstname or lastname. However, I cannot think of a way to search for a firstname or lastname and returing the whole row. I do not want to use index since I am asking user to enter the name to search. Here is my code to search for an empl based on index.
System.out.print("Please enter index to search or (q)uit: ");
          String ans = sc.next();
          System.out.println();
          int ians = Integer(ans);
          if (ans.equalsIgnoreCase("q"))
                    choice = "n";
          else
          System.out.println("index " + list.get(ians)); //this will print out the whole row based on the index
Since the user will never seen the contents of the arraylist, is there a way that I can search by string last/first name and will get the index location in int if the result is met?
Please advice and thank you.
Bob.

user11191663 wrote:
Since the user will never seen the contents of the arraylist, is there a way that I can search by string last/first name and will get the index location in int if the result is met?Another possibility is to set up an ArrayList for each thing you want to search on and then every time you add an employee, add the piece of data you want as well, viz:
Empl e = new Empl(1,"Jim", "Balu",88);
list.add(e);
firstNames.add(e.firstName());As long as you always add them in the same order, the indexes will match, so you could do something like
ians = firstNames.indexOf(nameToFind);to return the index of the name, if it's there (if not, it will return -1).
I wouldn't recommend this as standard practise, but it should be OK for the level you're at.
NOTE: indexOf() returns the index of the FIRST matching item. You may want to think about what you want to do if there are more than 1.
Winston

Similar Messages

  • Help: How to Validate XML using SAXParser and return the entire error list

    Hi,
    I have a problem, I'm trying to validate a xml document against the DTD. Here Im using SAXParser and having the ErrorHandler object passed when setting the error Handler, like parser.setErrorHandler(errorHandlerObj).
    I need an output like where the entire XML document is read and all the errors have to be reported with the line number.
    like example:
    <b>Line 6: <promp>
    [Error]:Element type "promp" must be declared.
    Line 8: </prompt>
    [Fatal Error]:The end-tag for element type "promp" must end with a '>' delimiter.
    who can i achieve this.</b>
    what happens with the present code is that it throws the first error it encountered and comes out.
    how can i solve this problem

    You can try to set the following feature to 'true' for your SAXParser:
    http://apache.org/xml/features/continue-after-fatal-error
    At least Xerces supports this feature.

  • Customize Alert messages for checking duplicate value and Success alert

    Hi All,
    I want to show two alert against the same "Submit" button to--
    1. Alert messages for checking duplicate value and show the Duplicate value found alert and
    2. Success Alert if the form is success to commit and no duplicate value found.
    I did all thing but when alert-1 shows and i pressed the ok button of the alert then the second alert also shows which i don't want to show.
    Which i can do in this issue? Have there anyone to help me!
    Arif

    Hi Manu,
    I have placed the following code
    1. against the Submit button--
    if error_code=40508 then
         commit_form;
    elsif :USERDELETION.CANCELLATION_USERID is not null then
    do_key('COMMIT_FORM');
    else null;
    end if;
    2. Code against the key-commit trigger in the form level--
    commit_form;
    DECLARE
    vAlert NUMBER;
    BEGIN
    set_alert_property('ALERT_TO_VERIFY',ALERT_MESSAGE_TEXT, 'Your Form has successfully submitted and your Reference id is '||:USERDELETION.REF_NO);
    vAlert:=SHOW_ALERT('ALERT_TO_VERIFY');
    END;
    3. Code against the on-error trigger in the form level--
    DECLARE
    vAlert NUMBER;
    BEGIN
         if ERROR_CODE = 40508 then
    set_alert_property('ERROR_ALERT',ALERT_MESSAGE_TEXT, 'This user deletion request has already submitted of the user named '||'"'||:USERDELETION.FULLNAME||'"');
    vAlert:=SHOW_ALERT('ERROR_ALERT');
    elsif
              ERROR_CODE = 40202 then
    set_alert_property('ERROR_ALERT',ALERT_MESSAGE_TEXT, 'Existing userid must be filled-up !');
    vAlert:=SHOW_ALERT('ERROR_ALERT');
    else
                   message(error_type||to_char(error_text)||': '||error_text);
    end if;
    END;
    If there have any confusion, please ask me.
    Arif

  • Searching for a string in an excel file and return true if found.

    How can I search for a string in an excel file and return true if found, its location and also a value.

    The problem with searching an excel file is that it contains a header. It would be easiest if you just read the file into a LabVIEW array and search the array. This way you can also get the index and the value of the location.

  • HELP: Searching for a String in a BinaryTree in Java

    Well I got the toString() and inOrder() working, so I know my list is printing correctly. What was making sense in my head obviously wasnt the correct way, and I think Im in that same boat again...(special thanks to hunter9000 for all the help)
    In my find method, were supposed to search for a given string, and return the number of compares that it took to find it! For example, if my root was "Brett" and it has children "Bill" and "Tom", then it would take 2 compares to find Tom, three for the next level, etc. If it doesnt find it, then return -1. As for now Im just trying to get it to give my the correct number if it DOES find it!
    From looking at the book's find method, I constructed my own...
           public int find(String s)
             Node temp = root;
             int b = 0;
             numberOfCompare++;
             while (temp != null)
                int compare = temp.toString().compareTo(s);
                if (compare < 0)
                   temp = temp.getRight();
                else if (compare == 0)
                   b = numberOfCompare;
                else
                   temp = temp.getLeft();
             return b;
          }Am I doing this all wrong? Because my program gets stuck in an infinite loop I think...

           public int find(String s)
             Node temp = root;
             int b = 0;
             while (temp != null)
                int compare = temp.toString().compareTo(s);
                if (compare == 0)
                   b = numberOfCompare;
                else if (compare < 0)
                   temp = temp.getRight();
                   numberOfCompare++;
                else if (compare > 0)
                   temp = temp.getLeft();
            numberOfCompare++;
                else
                   b = -1;
             return b;
          }I would think this would work? But its still stuck in the loop!!

  • I have searched for solutions to the error 13019, but everyone with the problem doe'st manually manage their music like I do. I really don't want to have to sync and gothrough that mess. Help? solution for manually managing videos and music!!

    I have searched for solutions to the error 13019, but everyone with the problem doesn't manually manage their music like I do. I really don't want to have to sync and go through that mess. Please Help! solution for manually managing videos and music!!

    - Make an appointment at the Genius Bar of an Apple store and hear what they hae to say. It is free.
    Apple Retail Store - Genius Bar                          
    you can turn on Assistive Touch it adds the Power and other buttons to the iPods screen. Settings>General>Accessibility>Assistive Touch

  • How to search for particular string in array?

    I am struggling to figure out how to search array contents for a string and then delete the entry from the array if it is found.
    The code for a program that allows the user to enter up to 20 inventory items (tools) is posted below; I apologize in advance for it as I am also not having much success grasping the concept of OOP and I am certain it is does not conform although it all compiles.
    Anyway, if you can provide some assistance as to how to go about searching the array I would be most grateful. Many thanks in advance..
    // ==========================================================
    // Tool class
    // Reads user input from keyboard and writes to text file a list of entered
    // inventory items (tools)
    // ==========================================================
    import java.io.*;
    import java.text.DecimalFormat;
    public class Tool
    private String name;
    private double totalCost;
    int units;
      // int record;
       double price;
    // Constructor for Tool
    public Tool(String toolName, int unitQty, double costPrice)
          name  = toolName;
          units = unitQty;
          price = costPrice;
       public static void main( String args[] ) throws Exception
          String file = "test.txt";
          String input;
          String item;
          String addItem;
          int choice = 0;
          int recordNum = 1;
          int qty;
          double price;
          boolean valid;
          String toolName = "";
          String itemQty = "";
          String itemCost = "";
          DecimalFormat fmt = new DecimalFormat("##0.00");
          // Display menu options
          System.out.println();
          System.out.println(" 1. ENTER item(s) into inventory");
          System.out.println(" 2. DELETE item(s) from inventory");
          System.out.println(" 3. DISPLAY item(s) in inventory");
          System.out.println();
          System.out.println(" 9. QUIT program");
          System.out.println();
          System.out.println("==================================================");
          System.out.println();
          // Declare and initialize keyboard input stream
          BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
          do
             valid = false;
             try
                System.out.print(" Enter an option > ");
                input = stdin.readLine();
                choice = Integer.parseInt(input);
                System.out.println();
                valid = true;
             catch(NumberFormatException exception)
                System.out.println();
                System.out.println(" Only numbers accepted. Try again.");
          while (!valid);
          while (choice != 1 && choice != 2 && choice != 9)
                System.out.println(" Not a valid option. Try again.");
                System.out.print(" Enter an option > ");
                input = stdin.readLine();
                choice = Integer.parseInt(input);
                System.out.println();
          if (choice == 1)
             // Declare and initialize input file
             FileWriter fileName = new FileWriter(file);
             BufferedWriter bufferedWriter = new BufferedWriter(fileName);
             PrintWriter dataFile = new PrintWriter(bufferedWriter);
             do
                addItem="Y";
                   System.out.print(" Enter item #" + recordNum + " name > ");
                   toolName = stdin.readLine();
                   if (toolName.length() > 15)
                      toolName = toolName.substring(0,15); // Convert to uppercase
                   toolName = toolName.toUpperCase();
                   dataFile.print (toolName + "\t");
                   do
                      valid = false;
                      try
                         // Prompt for item quantity
                         System.out.print(" Enter item #" + recordNum + " quantity > ");
                         itemQty = stdin.readLine();
                         // Parse integer as string
                         qty = Integer.parseInt (itemQty);
                         // Write item quantity to data file
                         dataFile.print(itemQty + "\t");
                         valid=true;
                      catch(NumberFormatException exception)
                         // Throw error for all non-integer input
                         System.out.println();
                         System.out.println(" Only whole numbers please. Try again.");
                   while (!valid);
                   do
                      valid = false;
                      try
                         // Prompt for item cost
                         System.out.print(" Enter item #" + recordNum + " cost (A$) > ");
                         itemCost = stdin.readLine();
                         // Parse float as string
                         price = Double.parseDouble(itemCost);
                         // Write item cost to data file
                         dataFile.println(fmt.format(price));
                         valid = true;
                      catch(NumberFormatException exception)
                         // Throw error for all non-number input (integers
                      // allowed)
                         System.out.println();
                         System.out.println(" Only numbers please. Try again.");
                   while (!valid);
                   // Prompt to add another item
                   System.out.println();
                   System.out.print(" Add another item? Y/N > ");
                   addItem = stdin.readLine();
                   while ((!addItem.equalsIgnoreCase("Y")) && (!addItem.equalsIgnoreCase("N")))
                      // Prompt for valid input if not Y or N
                      System.out.println();
                      System.out.println(" Not a valid option. Try again.");
                      System.out.print(" Add another item? Y/N > ");
                      addItem = stdin.readLine();
                      System.out.println();
                   // Increment record number by 1
                   recordNum++;
                   if (addItem.equalsIgnoreCase("N"))
                      System.out.println();
                      System.out.println(" The output file \"" + file + "\" has been saved.");
                      System.out.println();
                      System.out.println(" Quitting program.");
            while (addItem.equalsIgnoreCase("Y"));
    // Close input file
    dataFile.close();
       if (choice == 2)
       try {
          Read user input (array search string)
          Search array
          If match found, remove entry from array
          Confirm "deletion" and display new array contents
       catch block {
    } // class
    // ==========================================================
    // ListToolDetails class
    // Reads a text file into an array and displays contents as an inventory list
    // ==========================================================
    import java.io.*;
    import java.util.StringTokenizer;
    import java.text.DecimalFormat;
    public class ListToolDetails {
       // Declare variable
       private Tool[] toolArray; // Reference to an array of objects of type Tool
       private int toolCount;
       public static void main(String args[]) throws Exception {
          String line, name, file = "test.txt";
          int units, count = 0, record = 1;
          double price, total = 0;
          DecimalFormat fmt = new DecimalFormat("##0.00");
          final int MAX = 20;
          Tool[] items = new Tool[MAX];
          System.out.println("Inventory List");
          System.out.println();
          System.out.println("REC.#" + "\t" + "ITEM" + "\t" + "QTY" + "\t"
                + "PRICE" + "\t" + "TOTAL");
          System.out.println("\t" + "\t" + "\t" + "\t" + "PRICE");
          System.out.println();
          try {
             // Read a tab-delimited text file of inventory items
             FileReader fr = new FileReader(file);
             BufferedReader inFile = new BufferedReader(fr);
             StringTokenizer tokenizer;
             while ((line = inFile.readLine()) != null) {
                tokenizer = new StringTokenizer(line, "\t");
                name = tokenizer.nextToken();
                try {
                   units = Integer.parseInt(tokenizer.nextToken());
                   price = Double.parseDouble(tokenizer.nextToken());
                   items[count++] = new Tool(name, units, price);
                   total = units * price;
                } catch (NumberFormatException exception) {
                   System.out.println("Error in input. Line ignored:");
                   System.out.println(line);
                System.out.print(" " + count + "\t");
                System.out.print(line + "\t");
                System.out.print(fmt.format(total));
                System.out.println();
             inFile.close();
          } catch (FileNotFoundException exception) {
             System.out.println("The file " + file + " was not found.");
          } catch (IOException exception) {
             System.out.println(exception);
          System.out.println();
       //  Unfinished functionality for displaying "error" message if user tries to
       //  add more than 20 tools to inventory
       public void addTool(Tool maxtools) {
          if (toolCount < toolArray.length) {
             toolArray[toolCount] = maxtools;
             toolCount += 1;
          } else {
             System.out.print("Inventory is full. Cannot add new tools.");
       // This should search inventory by string and remove/overwrite matching
       // entry with null
       public Tool getTool(int index) {
          if (index < toolCount) {
             return toolArray[index];
          } else {
             System.out
                   .println("That tool does not exist at this index location.");
             return null;
    }  // classData file contents:
    TOOL 1     1     1.21
    TOOL 2     8     3.85
    TOOL 3     35     6.92

    Ok, so you have an array of Strings. And if the string you are searching for is in the array, you need to remove it from the array.
    Is that right?
    Can you use an ArrayList<String> instead of a String[ ]?
    To find it, you would just do:
    for (String item : myArray){
       if (item.equals(searchString){
          // remove the element. Not trivial for arrays, very easy for ArrayList
    }Heck, with an arraylist you might be able to do the following:
    arrayList.remove(arrayList.indexOf(searchString));[edit]
    the above assumes you are using 1.5
    uses generics and for each loop
    [edit2]
    and kinda won't work it you have to use an array since you will need the array index to be able to remove it. See the previous post for that, then set the value in that array index to null.
    Message was edited by:
    BaltimoreJohn

  • How do i search for a string in a txt file using java??

    How do i search for a string in a txt file using java??
    could you please help thanks
    J

    Regular expressinos work just fine, especially when
    searching for patterns. But they seem to be impying
    it's a specific group of characters they're looking
    for, and indexOf() is much faster than a regex.If he's reading from a file, the I/O time will likely swamp any performance hit that regex introduces. I think contains() (or indexOf() if he's not on 5.0 yet) is preferable to regex just because it's simpler. (And in the case of contains(), the name makes for a very clear, direct mapping between your intent and the code that realizes it.)

  • Search for a String within a document (Word, txt, doc) using JSP, JAVA

    Hi
    I have created a little application that uses combination of JSP and HTML. Users of this application can upload documents which are then stored on the server. I need to develop functionality where I can allows users to search for a string within a document. More precisely, user would type in some string in a text box and application will search all uploaded documents for that string and return the downloadable links to those documents that contains that string. I have never done this before. I was wondering if someone could get me started on this or point me to some thread where this idea is already discussed. Any Jave code exists for searching through documents??
    Thanks for your help
    Riz

    http://www.ibm.com/developerworks/java/library/j-text-searching.html
    http://en.wikipedia.org/wiki/Full_text_search
    Type these parameter in yahoo:+efficient text search
    you will need something like openoffice library to read microsoft word document.

  • How can I search for a string like a partial IP address in the global search

    When searching for a string like "10.255." the global search finds messages containing "255" or "10" and both.
    This happens no matter whether quotation is used or not.
    When quotation is used it probably will match on the given order as well, but beeing in the timezone '+0100' the string "10" is always found first (in the email headers...).
    Is there a way to tell the global search not to use '.' or any other character as whitespace?

    When searching for a string like "10.255." the global search finds messages containing "255" or "10" and both.
    This happens no matter whether quotation is used or not.
    When quotation is used it probably will match on the given order as well, but beeing in the timezone '+0100' the string "10" is always found first (in the email headers...).
    Is there a way to tell the global search not to use '.' or any other character as whitespace?

  • Search for a String in a list of files

    Could anyone please send me a java sample code which searches for a string from a list of files and returns me the filename and the line in which the Search String was found ?
    Thanks in advance
    RR

    Simple solution would be -
    1. Traverse a directory for each file.
    2. Read each file using Buffered Reader.
    3. Use readLine() method to read a line.
    4. Use String.indexOf to see if the data which you are looking for is there in the line or not.
    5. If its there then store the line number and file name.
    6. When the loop will end you will have list of file name and line number where the data which you are looking for is present.

  • Execute BAPI for different input values and dispaly data in a table

    Hi all,
    I have a specific problem about executing BAPI multiple times for different input values and didplay result in a table.
    I am using the code similar to the following logic.
    Bapi_Mydata_Input in = new Bapi_Mydata_Input();
    wdContext.nodeBapi_Mydata_Input().bind(in);
    String in = wdContext.currentperdataElement.getnumber();
    in.setDestination_From(10)
    wdThis.wdGetMydataComponentController().executeBapi_Mydata_Input();
    in.setDestination_From(20)
    wdThis.wdGetMydataComponentController().executeBapi_Mydata_Input();
    in.setDestination_From(30)
    wdThis.wdGetMydataComponentController().executeBapi_Mydata_Input();
    And I want to display the data in a single table. I want the result in a table for Bapi execution based on input parameters passed 10,20 30.
    But I am getting the table data only for the input parameter 30.I mean its actually display the data in table only for the last input parameter.
    So May I ask you all if you know the solution for this problem.PLease advise me with some tips .or sample code is very much appreciated.I promise to award points to the right answer/nice advises.
    Regards
    Maruti
    Thank you in advance.

    Maruti,
    It seems that WDCopyService replaces content of node, rather then adds to content.
    Try this:
    Bapi_Persdata_Getdetailedlist_Input frelan_in = new Bapi_Persdata_Getdetailedlist_Input();
    wdContext.nodeBapi_Persdata_Getdetailedlist_Input().bind(frelan_in);
    final Collection personalData = new ArrayList();
    String fr1 = wdContext.currentE_Lfa1Element().getZzpernr1();
    frelan_in.setEmployeenumber(fr1);
    wdThis.wdGetFreLanReEngCompController().executeBapi_Persdata_Getdetailedlist_Input();
    WDCopyService.copyElements(wdContext.nodePersonaldata(), wdContext.nodeNewPersonaldata());
    for (int i = 0, c = wdContext.nodePersonaldata().size(); i < c; i++)
      personalData.add( wdContext.nodePersonaldata().getElementAt(i).model() );
    String fr2=wdContext.currentE_Lfa1Element().getZzpernr2();
    frelan_in.setEmployeenumber(fr2);
    wdThis.wdGetFreLanReEngCompController().executeBapi_Persdata_Getdetailedlist_Input();
    WDCopyService.copyElements(wdContext.nodePersonaldata(), wdContext.nodeNewPersonaldata());
    for (int i = 0, c = wdContext.nodePersonaldata().size(); i < c; i++)
      personalData.add( wdContext.nodePersonaldata().getElementAt(i).model() );
    wdContext.nodeNewPersonalData().bind( personalData );
    Valery Silaev
    EPAM Systems
    http://www.NetWeaverTeam.com

  • 'Help cannot search for that phrase'

    I am getting the message 'Help cannot search for that phrase' while searching for 'xml' in a chm (generated using RH9). The old CHM (generated using RH8) shows the results for the keyword xml. Is this a known issue? Any workaround to resolve this issue?

    I just tried in a Rh10 project and got the same result in a CHM but not in WebHelp, there the search worked so I suspect it is something in the Microsoft Help Compiler.
    There is a solution if you can upgrade to Rh10. That allows you to generate WebHelp and then convert it to a skinned CHM. I just tried that and there the search worked in the CHM.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • Preview glitch when searching for words on page and when using text tools to write comments/notes on .pdf slides, why?

    When using Preview to access my class notes as .pdf files, I have encountered extremely frustrating glitches when trying to search for specific words or phrases within the .pdf files and when trying to use 'text tools' to write notes on the .pdf slides.  Preview did not behave in this manor with Mountain Lion OS.  This seems to correlate with my recent upgrade to Mavericks OS.
    When using the search function you should be able to type in any number of letters or words and press enter to continually cycle through the highlighted findings that match what you have typed in.  Instead it now, typically, stops tracking what I type in after about 3-4 letters and the yellow highlight turns grey.  Once it does this if you try to press enter to cycle through what it has found it no longer cycles.  It never did this in Mountain Lion using the very same .pdf files I had previously used in the old OS, and it does this despite there being multiple matches for what I am searching.
    When clicking 'show edit tool bar' button and then 'text tools' button to be able to free text notes on the .pdf file I have to exit out of the 'text tools' mode to be able to advance to the next page.  This is extremely inconveneint and, again, Preview did not do this in Mountain Lion.
    These are my two major complaints about Preview that I have discovered so far in my short time using it with the new Mavericks OS.
    Any help would be very much appreciated.

    I have this issue too and was pleased to find this thread.  Did either of you find the source of the problem or how to fix it? 
    I've tried using Wondershare PDF Editor as well and wondered that had messed some settings up.  Have either of you used that? 
    If so, how would I revert to a clean version of Preview?
    Hope we can get this sorted. 

  • Hi, i am badly in need of help. i partitioned my mac hd yesterday and now the boot camp is nt working as i was using win 7 on it. i am using macbook pro 13'' 2011. plz help me. anxiously waiting for response... specially from "Christopher"

    hi, i am badly in need of help. i partitioned my mac hd yesterday and now the boot camp is nt working as i was using win 7 on it. i am using macbook pro 13'' 2011. plz help me. anxiously waiting for response... specially from "Christopher murphy"

    you can't add or mofidy partition numbers. especially not if and once you have windows installed.
    boot from Windows 7 DVD afterwards
    but first you have to tell us and Christopher what and how you partitioned your system.
    Successful setup of OS X Lion + Data Partition + Bootcamp Win7 Ult
    https://discussions.apple.com/thread/3293948
    So after many, many hours I think I've finally figured out how to successfully setup Mac OS X Lion on one partition, a seperate data partition, and Windows 7 Ultimate on a Bootcamp partition . Here is a screenshot of my setup on my 13" MacBook Pro
    Thread with suggestions on Windows backup methods:
    https://discussions.apple.com/thread/3798090
    Paragon CampTune
    Paragon CampTune is a commercial product that is designed expressly for this task. http://www.paragon-software.com/home/camptune/ It consists of a downloadable ISO that needs to be burned to a disc and booted from in order to resize the partitions costs US$19.95.
    Securing Dual-System Configuration
    Imaging is still the most affordable and robust way to secure computer data. Unfortunately Mac OS X backs up only HFS+ volumes, leaving Windows with dual-system configurations unsecured. You can permanently lose all of your data unless you have a Windows-compatible backup solution.
    Paragon’s CampTune and Paragon’s Drive Copy for Mac can secure the entire dual-system configuration. CampTune creates traditional images of volumes or entire hard disks, Drive Copy can copy them to other disks. In case of an emergency, you can restore the previously created image or copy all your data back to its original state.
    GParted Live
    GParted Live is similar to CampTune as it is also distributed as a bootable image that needs to be copied to a CD/DVD or USB flash drive. As free and open source software, distributed under the GPL, it will always be available free. Since it has more functions than CampTune, it may be harder for folks who are not as experienced with partitioning hard drives. http://gparted.sourceforge.net/
    iPartition
    Coriolis Systems' iPartition is a £29.95 ($44.95 US) utility that runs in Mac OS X and allows resizing of all of the relevant partition formats, including HFS+, FAT32, and NTFS. It provides a Mac-oriented user interface that may be easier to manage than some of the free utilities. As it is not capable of resizing the boot disk, it requires a bootable external disk or a boot DVD. (A tool to create a boot DVD is included.)
    Paragon Partition Manager
    From the makes of CampTune is a commercial tool that is similar in functionality to GParted Live, but has a more polished/friendly user interface than GParted Live. Previously only the US$79.95 Professional version supported all the features required for this, but as of version 11 the US$39.95 Personal version has also been reported to work. http://www.paragon-software.com/home/pm-personal/
    Winclone/Disk Utility
    Winclone is a free tool for creating and restoring backup images of your Windows partition. One of its key features is that it can restore to a larger partition than the one the image was created from.
    NOTE: Winclone has been discontinued, but for now remains available and capable of completing these tasks (including creating and restoring Windows 7 images).
    Winclone updated to support Lion Winclone updates and download
    Disk Utility can resize HFS+ (Mac OS) partitions, but is currently incapable of resizing NTFS partitions, so you could use it to reduce the size of the HFS+ partition and create a new larger placeholder MS-DOS (FAT) partition
    The full process would be:
    Backup Windows partition with Winclone.
    (if the new Windows partition is smaller than the old one make sure you set the preferences in Winclone to save the image as an uncompressed dmg)
    Delete old Windows partition
    Resize current Mac Partition
    Create new Windows partition as MS-DOS (FAT) in free space after Mac OS partition.
    (If the new Windows partition is smaller than the old one an additional step is required: shrink the filesystem on the image by selecting Tools->Shrink Windows (NTFS) Filesystem)
    Reboot your computer for the new Windows partition to mount properly (winclone may not restore if you don't reboot)
    Restore Winclone partition over new Windows partition
    An alternate Winclone based process is described in the External Guides section
    Native OS utilities
    MR user Kazyua reports that you can use the disk management utilities provided with the current operating systems if you want to do it manually. Windows 7 and OS X both have partition resizing functions built in. In OS X, open Disk Utility and manually shrink the mac HFS+ partition by dragging the lower right corner. Then in windows go to the start menu and type "disk management" into the search box then hit enter. You should get an overview of the drives you have and the individual partitions. Right-clicking on the partition gives an "Extend Volume" option. The Windows NTFS volume should then be extended into the free space you created with Disk Utility. This method has not worked for other users, so try at your own risk.
    Resizing under VMWare Fusion
    If you are looking to allocate more space to Windows under VMWare please refer to the following thread http://forums.macrumors.com/showthread.php?t=828182
    From http://guides.macrumors.com/Extend/Resize_Boot_Camp_Partition
    Thread with suggestions on Windows backup methods:
    https://discussions.apple.com/thread/3798090

Maybe you are looking for

  • Backgound color in IE 7

    The three links at the bottom of this page are not displaying a white backgorund color on hover . Test Page Here Is there something wrong with my style? .FooterHeadings a { font-size: 14px; font-weight: bold; width: 238px; border: solid #FF6600 1px;

  • Nokia N8:Could not personalize Nokia Tune ringtone

    It's been 2 months I'm using N8 & I like N8 very much. But I was surprised to check that you cannot assign Nokia Tone to contact if default tone in current profile is not Nokia Tone. Also in Power Save mode though I have not selected mute phone in 'T

  • Making the "!" Appear so I can make the Duplicate Items Disappear

    I just recently somewhat successfully relocated my itunes library to an external hard drive. I actually had been manually backing up music to that hard drive by dragging and dropping over the past year or so, and clearing out my itunes library on my

  • How to query the data using control item avoiding special characters

    I had a small doubt in d2k. i created a emp block in that we r providing a control item for empno i am using that control item for querying emp details based on that control item value. if i am giving single quote in that control field it is querying

  • Inserted transition "grayed out" on split clip

    Greetings, Pretty new user so excuse the question...if repeated, tried to search but found nothing. I am in advanced tools on my editor and split my video clip and inserted a transition. When I go into my precision editor, I see the transition insert