Please help---merge function for two arrays.

I am trying to create a merge function that merges two sorted arrays into a third array. I know what I am supposed to do, at least in theory, but I have been completely unsuccessful with actually getting the code to work. Since it is private, you can't directly access the arrays, you have to just reference them. could someone please help me out.
import java.io.*;
class OrdArray
private long[] a;
private int nElms;
public OrdArray(int max)
a = new long[max];
nElms = 0;
public int size()
{ return nElms;}
public int find(long searchKey)
int lowerBound = 0;
int upperBound = nElms-1;
int curIn;
while(true)
curIn = (lowerBound + upperBound) / 2;
if(a[curIn]==searchKey)
return curIn;
else if (lowerBound > upperBound)
return nElms;
else
if(a[curIn] < searchKey)
lowerBound = curIn + 1;
else
upperBound = curIn - 1;
public void insert(long value)
int j;
for(j=0; j<nElms; j++)
if(a[j] > value)
break;
for(int k=nElms; k>j; k--)
a[k] = a[k-1];
a[j] = value;
nElms++;
public boolean delete(long value)
int j = find(value);
if(j==nElms)
return false;
else
for(int k=j; k<nElms; k++)
a[k] = a[k+1];
nElms--;
return true;
public void display()
for(int j=0; j<nElms; j++)
System.out.print(a[j] + " ");
System.out.println("");
public void merge(OrdArray array, OrdArray array1)
}//this is the start of the merge function. I am stuck and not real sure where to go from here.
public long getElm(int index)
return a[index];
}//end class OrdArray
class OrderedApp
public static void main(String[]args)
int maxSize = 100;
OrdArray arr, arr1, arr2;
arr = new OrdArray(maxSize);
arr1 = new OrdArray(maxSize);
arr2 = new OrdArray(maxSize);
arr.insert(77);
arr.insert(99);
arr.insert(44);
arr.insert(55);
arr.insert(22);
arr1.insert(88);
arr1.insert(11);
arr1.insert(00);
arr1.insert(66);
arr1.insert(33);
arr2.merge(arr, arr1);
arr.display();
System.out.println("--------------------");
arr1.display();
System.out.println("--------------------");
arr2.display();
}

If I use ArrayList<Long>, would I have to change private long[]a to ArrayList<long>, cause if so, I am not able to do that.
I am supposed to add a merge() method to megre the two source arrays into an ordered destination array.
public void merge(OrdArray array, OrdArray array1)
mergeSize = array.nElems + array1.nElems;
int i = 0;
int j = 0;
int k = 0;
while (i = 0; i < array.nElems; i++) {
          if {array.getElm(i) < array1.getElm(j)
                                                          //how do you move to the next set of values
                                                          //and to move which variables are incremented
                                                          //how do you test if the flush loop should be      called, hint if( == )
               while (j = mergeSize - array.nElems; j <= mergeSize; j++) { 
                               this.a[j] = array1.a;
//again how do you move to next value and placeholder
     //which indices are incremented
//copy/paste and change the variables for the other value being smaller
public long getElm(int index)
return a[index];
this is all I have started, but i don't really understand all the comments because I haven't used java in a long time. Like I said, I understand what needs to be done and what order to do it in, but getting the code down to do that is really rough

Similar Messages

  • I have been using GRAB to capture screen displays.  It has just stopped working since the last OSX Upgrade.  Can anyone, please help restore functionality?

    I have been using GRAB to capture screen displays.  It has just stopped working since the last OSX Upgrade.  Can anyone, please help restore functionality?

    Thanks for that.  I did as suggested but when I tried again, it still did not work.  Another  com.apple.Grab.plist appeared in the Library.
    I now have the following files in Library
    file://localhost/Users/peterpatel/Library/Preferences/com.apple.Grab.LSSharedFil eList.plist
    file://localhost/Users/peterpatel/Library/Preferences/com.apple.Grab.LSSharedFil eList.plist.lockfile
    file://localhost/Users/peterpatel/Library/Preferences/
    file://localhost/Users/peterpatel/Library/Preferences/com.apple.Grab.plist.lockf ile
    What do you suggest I do now?

  • Assigning search help (F4 functionality ) for recipient field in IW32

    Hi,
    my requirement is to assign search help (F4 functionality) for recipient field in components tab of IW32. anybody help me to assign search help for it. same way i need to assign that in MIGO, MB21, MB1A goods recipient field.

    hi,
    refer to the following link:
    http://www.saptechies.com/how-to-add-f4-help-to-a-field-on-screen-module-pool/
    i hope it helps
    regards

  • I made a card using the iPhoto and when I click to buy it, it says that I did not fill all the frames with pictures, even though I did and have checked multiple times. Please help, it's for Mother's Day.

    I made a card using the iPhoto and when I click to buy it, it says that I did not fill all the frames with pictures and that I need to in order to purchase it, even though I did and have checked multiple times. Please help, it's for Mother's Day.

    Before ordering your book preview it using this method - http://support.apple.com/kb/HT1040 - and save the resulting PDF for reference - the delivered book will match it.
    LN

  • Need help creating actionListener for an array of text fields

    I am working on a school project, so I am very new to Java. I have a program which is basically a unit converter. Each unit type has its own tab. I was able to dynamically create text fields in each tab and now I need to add actionListener to each of those text fields. Probelm is, the text fields are not really unique. I guess they're only unique within their tab. So now I am having difficulty referring to my text fields. If you look at my actionListener in the code below, I am trying to refer to it as unitTFs[0].getText() and that's not working. Please help. Thanks in advance.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class UnitConverter extends JPanel
    public UnitConverter()
    String[] lengthUnits = {"cm","m","inch","feet","yard","mile"};
    String[] areaUnits = {"m2","a","feet2","yd2","Acre","ha"};
    String[] massUnits = {"g","kg","ton","ounce","pound"};
    String[] volumeUnits = {"liter","m3","inch3","feet3","Gallon","Barrel"};
    String[] tempUnits = {"C","F"};
    ImageIcon lengthICN = new ImageIcon("java-swing-tutorial.JPG");
    ImageIcon areaICN = new ImageIcon("java-swing-tutorial.JPG");
    ImageIcon massICN = new ImageIcon("java-swing-tutorial.JPG");
    ImageIcon volumeICN = new ImageIcon("java-swing-tutorial.JPG");
    ImageIcon tempICN = new ImageIcon("java-swing-tutorial.JPG");
    JTabbedPane tabPaneJTP = new JTabbedPane();
    JPanel lengthPNL = tabContents(lengthUnits);
    tabPaneJTP.addTab("Length", lengthICN, lengthPNL);
    tabPaneJTP.setSelectedIndex(0);
    JPanel areaPNL = tabContents(areaUnits);
    tabPaneJTP.addTab("Area", areaICN, areaPNL);
    JPanel massPNL = tabContents(massUnits);
    tabPaneJTP.addTab("Mass", massICN, massPNL);
    JPanel volumePNL = tabContents(volumeUnits);
    tabPaneJTP.addTab("Volume", volumeICN, volumePNL);
    JPanel tempPNL = tabContents(tempUnits);
    tabPaneJTP.addTab("Temperature", tempICN, tempPNL);
    //Add the tabbed pane to this panel.
    setLayout(new GridLayout(1, 1));
    add(tabPaneJTP);
    protected JPanel tabContents(String[] units)
    JPanel tabPNL = new JPanel();
    JTextField[] unitTFs = new JTextField[units.length];
    JLabel[] unitLs = new JLabel[units.length];
    for (int i = 0; i < units.length; i++)
    unitTFs[i] = new JTextField("0");
    unitLs[i] = new JLabel(units);
    tabPNL.add(unitTFs[i]);
    tabPNL.add(unitLs[i]);
    tabPNL.setLayout(new GridLayout(units.length, 1));
    return tabPNL;
    private class CmHandler implements ActionListener
    public void actionPerformed(ActionEvent e)
    double cm, m;
    cm = Double.parseDouble(unitTFs[0].getText());
    public static void main(String[] args)
    JFrame frame = new JFrame("Unit Converter Demo");
    frame.getContentPane().add(new UnitConverter(), BorderLayout.CENTER);
    frame.setSize(500, 500);
    frame.setVisible(true);

    Variables only have scope in the method (or block) in which they are created. That means if you create a variable in one function, you can't use it in another.
    If you want to use a variable in two different functions, you have to make it a member variable.
    [Declaring Member Variables|http://java.sun.com/docs/books/tutorial/java/javaOO/variables.html]

  • Please help : Pipline function, error passing parameter

    Hello,
    Please help a DBA who's trying to make it with PL/SQL (on Oracle 10.2.0.4).
    I'm just building a script to find the space used by all the segments (lob, index, partitions) related to a table.
    Here is my problem, when I call a table function (DBMS_SPACE.OBJECT_DEPENDENT_SEGMENTS) from within a pipeline function i get an error,
    if I turn that function into procedure it is running fine, if I hard code parameters it works...
    When running as a function I get the error :
    SQL> Select * from table(yke_size_info('SAPRD', 'REPOSRC'));
    Select * from table(yke_size_info('SAPRD', 'REPOSRC'))
    *+
    ERROR at line 1:
    ORA-20000: Object does not exist
    ORA-06512: at "SYS.DBMS_SPACE", line 2673
    ORA-06512: at "SYS.YKE_SIZE_INFO", line 40
    => line 40 is the call to DBMS_SPACE.OBJECT_DEPENDENT_SEGMENTS
    Thank for your help, I'm getting crazy with this, I've been browsing Google & docs for hoors but no answer yet !
    create or replace type r_size_info as object (
    nb_par_tbl   number ,
    nb_idx       number ,
    nb_par_idx   number ,
    nb_lob       number ,
    used_par_tbl number ,
    used_idx     number ,
    used_par_idx number ,
    used_lob     number ,
    free_par_tbl number ,
    free_idx     number ,
    free_par_idx number ,
    free_lob     number
    +)+
    +/+
    create or replace type t_size_info as table of r_size_info;
    +/+
    CREATE OR REPLACE FUNCTION yke_size_info(o_wner varchar2, o_bject varchar2 ) RETURN t_size_info PIPELINED AS
    r_size r_size_info := r_size_info(0,0,0,0,0,0,0,0,0,0,0,0);
    obj_segment_owner   VARCHAR2(100);
    obj_segment_name    VARCHAR2(100);
    obj_segment_type    VARCHAR2(100);
    obj_tablespace_name VARCHAR2(100);
    BEGIN
    FOR obj IN (SELECT segment_owner, segment_name, segment_type, tablespace_name FROM TABLE(dbms_space.object_dependent_segments(o_wner, o_bject, NULL, 1)))*
    LOOP
    If I change that line to hard code the parameter It's working :
    FOR obj IN (SELECT segment_owner, segment_name, segment_type, tablespace_name FROM TABLE(dbms_space.object_dependent_segments('SAPSR3', 'REPOSRC', NULL, 1)))
    If I turn the function into a procedure it is working :
    CREATE OR REPLACE PROCEDURE yke_size_inf(o_wner varchar2, o_bject varchar2 ) AS
    obj_segment_owner   VARCHAR2(100);
    obj_segment_name    VARCHAR2(100);
    obj_segment_type    VARCHAR2(100);
    obj_tablespace_name VARCHAR2(100);
    BEGIN
    FOR obj IN (SELECT segment_owner, segment_name, segment_type, tablespace_name  FROM (TABLE(dbms_space.object_dependent_segments (o_wner, o_bject, NULL, 1))))*
    LOOP

    Not really sure what you are trying to achieve... and putting a pipeline function on top of another pipeline function seems unnecessary to me.
    But using the basic code you've shown, the following works fine:
    SQL> create or replace type TStrings is table of varchar2(4000);
      2  /
    Type created.
    SQL>
    SQL> create or replace function FooPipe( objectName varchar2 ) return TStrings pipelined is
      2  begin
      3          for r in (
      4                  select
      5                          segment_owner, segment_name, segment_type, tablespace_name
      6                  from    table( dbms_space.object_dependent_segments(USER, objectName , NULL, 1))
      7          )
      8          loop
      9                  pipe row( r.segment_name||' is object('||r.segment_type||') in space('||r.tablespace_name||')' );
    10          end loop;
    11
    12          return;
    13  end;
    14  /
    Function created.
    SQL>
    SQL> select * from TABLE(FooPipe('TESTTAB'));
    COLUMN_VALUE
    TESTTAB is object(TABLE) in space(USERS)
    SQL>

  • Please Help regard function that will return values of each JComboBox items

    I'd like to create a function that will return values of each item on the JComboBox at a time when
    I click on each item of a comboBox. I had this following codes, but didn't work.
    Please help me !!!Please correct it... thanks a million
    String wp;
    String text;
    String A[] = {"WARNIGNS","CAUTIONS","NOTES"};
    JComboBox ABC = new JComboBox();
    for (int i=0;i<A.length;i++) {
    ABC.addItem (A);
    text = Get_It(); //assigns each value of JComboBox's item to variable text when clicks at each item
    //of a comboBOx
    private String Get_It(){
    ABC.addActionListener(new ActionListener (){
    public void actionPerformed(ActionEvent e){
    wp = (String)CBweapon.getSelectedItem() ;
    return wp;

    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class AlertFrame extends JFrame {
    String s_alert[] ={"WARNIGNS","CAUTIONS","NOTES"};
    JComboBox CBweapon;
    String wpText;
    public AlertFrame() {
    super("Alerts");
    Container contentPane = getContentPane();
    contentPane.setLayout(null);
    setSize(600,600);
    CBweapon = new JComboBox();
    for (int i=0;i<s_weapon.length;i++) {
    CBweapon.addItem (s_weapon);
    contentPane.add(CBweapon);
    CBweapon.setActionCommand("");
    //set position for components
    CBweapon.setBounds(370 + insets.left,295+ insets.top, 150,30);
    System.out.println(getit()); //calling getit() function
    //this function will be return a String of JcomboBOx value if click on each item of combobox
    private String getit(){
    CBweapon.addActionListener( new ActionListener (){
    public void actionPerformed(ActionEvent e){
    wpText = (String)CBweapon.getSelectedItem() ;
    return wpText;
    public static void main(String args[]) {
    AlertFrame af = new AlertFrame();
    af.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    **I have no errors on compile or run, but it didn't return a string value to System.out.println(getit());
    It maybe because of the "void" of public void actionPerformed(ActionEvent e){
    wpText = (String)CBweapon.getSelectedItem() ;
    Please help me

  • Please Help - Same issue for years - Mail rule switches itself!

    This issue has plagued me with Apple Mail for years and I would like to finally resolve this to keep my sanity. Please help!
    We have used the MobileMe family account (5 pack) for awhile and both my wife and I have our own unique email address that is set and we also have one combined account that we use as well. I have some rules in place to help keep the mail organized. Often we will get 1 e-mail for both of us (i.e. a message about a group we are both in or a sports team for our children) - it is sent to our joint account and then the Mail rule will handle putting them in both our boxes.
    There is the one rule that keeps changing itself! It's maddening. Here is what I want to occur:
    1. I get an e-mail to our joint MobileMe account.
    2. The rule will move that specific message to my folder and then place a copy of that message in my wife's folder.
    That's it. That's all that I want it to do.
    Here is what I put in the mail rule description to make that happen:
    IF "any" conditions met:
    "Any recipient" is equal to "joint account e-mail address"
    Perform following actions:
    "Move message" to "my mailbox"
    "copy message" to "her mailbox"
    "Stop evaluating rules"
    That's it. Here is where the problem ensues. This rule will actually work correctly for 1 or 2 times. Then what happens is somehow this rule actually changes itself and when I open up the rule description it will actually show:
    "Move message" to "my mailbox"
    "Copy message" to "my mailbox"
    Ugh. So I end up getting two copies of the same thing and have to physically move it over. It seems so simple and I can't understand why it keeps switching itself.
    I've had the issue ever since we had our family account and back to the Tiger operating system. I would love to get this fixed for good!

    I may well have missed something, but it seems to me that the command to Copy to her mailbox should come before the command to Move to your mailbox. That way the source remains available until the final Move step. I cannot say why the Rule construction would change by itself, but I can see the possibility of confusion if the Move comes before the Copy.
    Ernie

  • Please help! Looking for script to insert current date on page.

    I currently use a Dreamweaver Extension that lets you insert
    current date and time on your web page.
    The problem is, I don't know Javascript and cannot edit the
    Javascript codes to "remove the time"
    I only need the current date that will change every day.
    Do you know where I can get this script, I goggled and got
    several but I'm looking for something authentic.
    Also is it possible to have your page validate when you use
    Javascript embedded in your HTML?
    Thanks everyone,
    Patrick

    quote:
    Originally posted by:
    Newsgroup User
    Webethics wrote:
    > The problem is, I don't know Javascript and cannot edit
    the Javascript codes
    > to "remove the time"
    > I only need the current date that will change every day.
    JavaScript generates the date by using the clock on the
    computer of each
    visitor to your site. If a visitor's clock has the wrong
    date, your site
    will also display the wrong date.
    > Do you know where I can get this script, I goggled and
    got several but I'm
    > looking for something authentic.
    I don't know what you mean by "authentic". Date generation in
    JavaScript
    is one of the most basic features of the language, so if it
    works, it's
    "authentic".
    > Also is it possible to have your page validate when you
    use Javascript
    > embedded in your HTML?
    Yes, but you shouldn't embed JavaScript in XHTML.
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/
    So mr. Powers are there people that use Javascript Date in
    their page?
    Would you recommend it?
    I could use PHP but I don't know PHP,
    How do I come up with the string in this format, say,
    Wednesday, October 29th, 2008 that will change to a new day
    according to the server time and date.
    Thanks so much for your help and I have two of your books! I
    will be taking PHP classes in December.
    Patrick

  • Itunes  please help with functions (possible or not???)

    Hello
    I´m sorry that my questions are a little long - but please please i´m new with IPod and ITunes - and well at the moment i feel like if i had known how unorganized ITunes is and that i can´t acces the data on my IPod directly i would perhaps not have bought the IPod at all... (but perhaps - i really really hope so - i just cant find out HOW to do all i want and it IS possible after all...) so please take the time and if you know the ansers tell me how to do that...
    Since yesterday i have an IPod classic but unfortunately my own computer has only Windows 2000 - so i have to sync/transfer the Data from my Mom´s PC and so i have to delete the data on her PC after i got them on the IPOD once (and the should stay there untill i´m ready to delete them...)
    1)
    a) what happens if i sync my ITunes/Ipod and i allready deletet most of the music on my moms PC - will the music on the IPod be deleted too? - If yes can i prevent that? (how?)
    b) can i manually choose which titles i want to add/remove to/from my Ipod? i can´t see any way at the moment !!!
    I can see a kind of inventory list of my IPod but i can´t find out how to move Data on/in the folders of the IPod - only by synchronisation - now i know i HAVE allready Data on the IPod but every folder in Itunes of my Ipod is Empty... so how can i acces these data please???
    2)
    My second Problem ist that i can´t find out how to "sort" my chaotic 10.0000 (ok ok not so many right now but getting there some time) different Music-Data into different folders - ok i could add them to diffrent playlists - but one of the main Problems is the fact that many of my data are not properly classified so i need to organize the music so that i "see" only the Music from one particulary folder of my harddisk (then uppdate those information like adding all data from that Folder to a personal "album" or similar...) and every time i add a folder to the mediathek all the songs (different artist, different albums, different everything or missing information) are then spread out all through the music folder and i have to manually search for every single on and then manually add it to a playlist which is more timeconsuming than it is worth it...
    So please help me - HOW DO i make new Folders (NOT PLAYLISTS!!!) in which to sort the music??? so i do not have only ONE Music-Folder but perhaps 2, oder 3 or later more subfolders under the music-Folder?
    If that is really not possible - can i then at least sort my music after path-name (haven´t found out how to do that either yet...)
    3) I have a folder audibooks (which is really really great since i´m an audible customer and have moren then 40 audiobooks allready...) and my audible audiobooks are all added to that folder...
    But i have a few Other Audiobooks in MP3-Format (from MP3 DVD/ and a few CD´s formated as MP3) and even after i uppdated the information so it say´s now audibook in Type - i just can´t find out how to transfer those audibooks to the audiobooks folder (they stay in music-folder and are not found by Ipod as audibooks - only accessible under music with type audibooks which really ***** because that is unnecessary complicated... )
    so how do i get thos books in the audiobooks folder please?
    I hope anyone can help me...
    best regards
    Skarinija
    Message was edited by: Skarinija

    Thanks very much that takes care o my Question 1:
    It really is a great relief so now i know can sync the IPod manually - basically i tried the right things but in the wrong order - lol so i accidently deletet everthing on the IPod again and then i was staring on the blank inventory of my Ipod and wondering why i could not access the music that should be there...
    Still anyone knows an answer to question 2 and 3
    2) is it possible to "sort" Itunes in subfolders - so i can acces only one folder at a time
    3) Is ist possible to somehow classify any type of MP3/similar Data as "audibook" so that Data will show up as audibook on the Ipod? (not as music with type audiobook)
    mfg
    Skarinija

  • Please help with update for ios 8.1.3

    Some one PLEASE HELP ME!!!  I just updated my I phone 4s to ios 8.1.3 it was taking a long time then they finally updated and had the Hello screen after that I saw my photos then they would just delete it right in front of me I also lost some of my contacts but my notes still here can someone please help me find my photos are very important to me they have pictures of my relatives who passed away please help!!!

    After 4+ months of dealing with this data usage and battery drain problem that included 3 data captures of my wife's iMac, the trigger for us regarding the problems syncing with iCloud, and 5 hours of logs off my iPhone 6 to be analyzed by Apple engineers that included times my wife's computer was both on and off to demonstrate the difference in data usage and battery drain under those conditions, I can say with very reasonable certainty that the iOS 8.3 and corresponding Mac OS 10.10.3 update has solved the problem. 
    We have now been running for about 2 weeks and data usage with the iCloud Servers attempting to sync has dropped from a rate of 31 GBs to under 15 MBs per month.  Yes, you read it right.  We were burning 2000 times as much data doing absolutely nothing important on both of our phones, a 5s and a 6.  Just imagine what that does to battery life!  The 5s would last about 5 hours and the 6 was dead in less than 14.
    The distasteful aspect of this process was how the engineers were quietly fixing the problem at the same time sending messages to my contact person within Apple that were dismissive in nature in the face of indisputable unreasonable results. I must say, this experience with the multiple times the engineers' responses were inappropriate put a little tarnish on the old Apple shine of the ‘It just works’ mantra. This was my first experience in 34 years that caused me to stop recommending Apple products without reservations and with a disclaimer.
    Since the update solved the problem, then I can only conclude that there was a logic bug regarding the reaction within the process to the incoming data that was corrected.  There was noting short of logging out of iCloud that circumvented the problem for us, Gator5000e and probably many others noted on other threads.  I am not trying to imply that this is the cause of everyones battery use problem, but it is reasonable that it was a cause for many.

  • Please help, slide show for a funeral in jepoardy

    I seem to be having trouble inporting scanned pictures from iphoto into imovie 08. This is my process.
    1. Scan the photos.
    2. Save as JPEG image into the pictures folder (Not the iphoto file, but pictures -My save as choices do not include iphoto).
    3. Do a drag and drop of picture from picture folder into opened iphoto program. I can now see them in iphoto and have placed them in a seperate iphoto album.
    4. When I choose pictures (right hand side button that looks like a camera) it shows me all my pictures EXCEPT any scanned ones. I have 6000 pictures in iphoto, but imovie only sees 4000 (2000 are scanned).
    5. When I try to do a drag and drop from iphoto directly into imovie, imovie tells me the pictures are not compatable.
    What am I doing wrong? My guess is something from the scanning aspect. Please help, the family just dropped the pictures off last night and the funeral is tomorrow.

    4. When I choose pictures (right hand side button that looks like a camera) it shows me all my pictures EXCEPT any scanned ones. I have 6000 pictures in iphoto, but imovie only sees 4000 (2000 are scanned).
    Sounds like the iPhoto album contents are not being thumbnailed. Try bypassing the thumbnails by dragging a photo file from either the "Picture" folder or the open iPhoto album and dropping it directly to your Project window. If this works then you know the problem is in the thumbnailing.
    If this works and you are in such a hurry, I would suggest you simply set your iMovie '08 Project Properties for the default photo/transition mode you want and then drag and drop all photos directly to the iMovie '08 project window and then rearrange/change them as needed.Thus you can get to work on your funeral slideshow immediately and put off trying to fix the thumbnail problem until you have the time to concentrate on it exclusively. (I.e., deal with one problem at a time.)

  • Help: Clear Function for JSF

    Hi Experts,
    I have a page with several jsf textfields in which the first half is being populated by my first bean and the other is being populated by my second bean. I would like to know on how anyone of you would go about clearing all the textfields if you have two beans populating them?
    What I tried doing is calling my second bean's reset() method as the second bean is the one saving all the information to the database. After which I tried calling the instance of my first bean to clear the rest of the fields, below is my code.
    <!--JSF Page-->
    <h:commandButton value="Clear" action="#{secondBean.reset}" />
    // Bean Class
    public class SecondBean {
        private String field1 = null;
        private String field2 = null;
        public void doSomeProcessing() {
        // Populate Fields Here
        public void reset() {
            // Clear Here
            field1 = "";
            field2 = "";
            // Call First Bean
         FacesContext context = FacesContext.getCurrentInstance(); 
         FirstBean proBean = (MyBean) context.getELContext().getELResolver().getValue(
                   context.getELContext(), null, "FirstBean");
         proBean.reset();
    }The problem with the above approach is that it doesn't clear all fields in one click, you need to click it the second time to clear everything. If you have any other solution please help.
    Thank you.

    The_Developer wrote:
    Hi Raymond,
    What wrong with getting the context? and can I ask why do I need to inject it in as a managed property?You do not need to, it is more of a style and good practice thing. E.g. doing so makes writing unit tests on your beans much easier.
    Also if I set the immediate=true then my button will not be able to go to the manage bean phase which is not what I want as I am clearing the records in the bean itself.I do not know what phase you are referring to. The JSF phases are Restore View, Apply Request Values, Process Validations, Update Model Values, Invoke Application and Render Response. Using the immediate attribute on a command component will cause the Process Validations and Update Model Values phases to be skipped.

  • PLEASE HELP with Audio for YouTube!

    Hi,
    I KNOW YouTube is not the best for quality, but I absolutely HAVE TO post a couple of videos there!
    So.... having used Standard footage & the regular preset for DV-shot footage, does anyone KNOW which Encoding conversion to use (and I assume bitrate selection as well) that will allow me to post them on YouTube and actually hear something which even resembles the professionally Mastered recordings I am using.  So far I have tried WMV, h264 & a few others with various bitrates and most all of them sound horrible once YT converts them.  I was fine with the WMV video but the audio is way to disgusting to even listen to (especially compared to what the audio actually really is).  I have read some posts here suggesting FLV, WMV, etc, & I am truly at a loss and in major need of help here.  I have read Eddie's article link, & still the audio once YT does "it's thing" is ridiculous!
    The audio sounds great (good enough) on my computer after Encoder does its thing, but if anyone has encountered this and has the answer....PLEASE - what conversion & WHAT BITRATE should I use to make YT NOT ruin my recordings (and sound good on there)?!?!
    I even considered importing an already converted AAC or mp3 audio file into Pro, & then exporting it via Media Encoder but don't even think that's possible (or necessary).
    Please help as I HAVE to post it on YT yesterday already!
    As always, thank you for you help!!

    I never really had problems with sound quality on youtube...but I just use stereo pcm/wav mostly in editor. I think you should post what your using in your project and what you are exporting it as...cause its too vague to really give much specific advice re: helping you. also, say whether you have any sound codec packs or anything loaded...anything other than the original program codecs...and say what version of the product you are using...premiere pro what ??

  • Please Help, Flash Player for Mac

    I am running Mac OS X 10.7.5.  Last night Facebook told me I MUST update to the newest version of Flash Player in order to upload multiple pics.  I kept getting plug-in failure messages and then the message saying I need to update my version of Flash.
    Problem is I have updated my version of Flash and the plug in still doesn't work.  Please help, my business relies on my being able to upload multiple photos daily to social media.  What is going on?  I have read the forums, the work arounds posted on 4/16.  Uninstalled, re-installed, etc.  I am still getting flash plug in failures even on Adobe's site.  What do I do?

    No.
    I am in the same boat. I cannot watch flash videos on the BBC website or on BBC iPlayer, although all other flash videos (YouTube for example) are fine.
    For reasons that passeth all understanding, they work with the PPC version of Firefox, called TenFourFoxG5.app, once you have anabled plug-ins, as it does not natively support Flash.
    You can download TenFourFoxG5 from here:
    http://www.floodgap.com/software/tenfourfox/
    Now for the intersting bit: TenFourFox, like Firefox, does not support most plug-ins. Unless you are prone to headaches (in which case don't) you can read about that here:
    http://code.google.com/p/tenfourfox/wiki/PluginsNoLongerSupported
    But there is a workaround!
    Open TenFourFox and type in the address bar: about:config (no spaces) and click return. This gives you a warning that it might harm the application. Ignore that and click on 'I'll be careful, I promise' and you get the config file that you can edit - with great care.
    Look/search (scroll down) for: tenfourfox.plugins.enabled
    Set it to true. (Double click it to toggle it)
    Now close TenFourFox, open it again, and Flash will now work, as it now uses the plug-ins that Safari has stored.
    I am using Flash 10.1.102.64 in TenFourFox and it works just fine.

Maybe you are looking for