How is the Method Parameter Identified in this Code Snippet ?

package methods;
public class Me10 {
     public static void main(String[] args) {
          short y=6;
          long z=7;
          go(y);
          go(z);
     public static void go(Short s)
          System.out.println("SHORT");
     public static void go(Long l)
          System.out.println("LONG");
     public static void go(int i)
          System.out.println("INT");
O/P :
INT
LONGEven when y is declared as short why does the INT method get called ?
What can we do so that when i pass y , short method will be called ?
Thabks in Advance.

as far as I understand, method parameters are identified per JLS section 15.12.2 'Determine Method Signature':
"...This step uses the name of the method and the types of the argument expressions to locate methods that are both _accessible_ and applicable, that is, declarations that can be correctly invoked on the given arguments. There may be more than one such method, in which case the _most specific_ one is chosen. The descriptor (signature plus return type) of the most specific method is one used at run time to perform the method dispatch...
...The informal intuition is that one method is more specific than another if any invocation handled by the first method could be passed on to the other one without a compile-time type error..." [...click here to continue reading if you're interested|http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.12.2|JLS 15.12.2 'Determine Method Signature']
As for calling 'Short' method for 'y' value, I'd probably use something like go(new Short(y))

Similar Messages

  • How does the Object Reference change in this code ?

    Hi Folks,
    This is my code :
    package assignments;
    class Value
         public int i = 15;
    } //Value
    public class Assignment15
         public static void main(String argv[])
              Assignment15 t = new Assignment15();
              t.first();
         public void first()
              int i = 5;
              Value v = new Value();
              v.i = 25;
              second(v, i);
              System.out.println(v.i);
         public void second(Value v, int i)
              i = 0;
              v.i = 20;
              Value val = new Value();
              v = val;
              System.out.println(v.i + " " + i);
    } // Test
    O/P :
    15 0
    20The output I expected was 15 0 15.
    If the value object created in the second() assigns the value 15 to variable v,why does v.i in the last sysout print 20 ?
    Thank you for your consideration.

         public void second(Value v, int i)
              i = 0;
              v.i = 20;
              Value val = new Value();
              v = val;
              System.out.println(v.i + " " + i);
         }There are two sources of confusion in this code:
    1) for clarity, you shouldn't name second()'s argument "v"; as pbrockway points out, this variable v is a completely different variable from first()'s "v" variable, it just happens to contain a reference to the same object as first()'s "v". Rename the argument to "v2" and it should clarify things (note: this is not a general recommendation, this naming is perfectly valid and makes sense, just not to you yet).
    2) You are assigning a new value (the reference denoted by "val") to the argument variable v. That is bad practice (even for seasoned Java developers).Although the Java compiler accepts it gladly, it brings confusion: it does change the value of the "local variable" v2, but doesn't change the value of the variable "v" in method first(), from which v2 was copied when invoking second().
    Indeed I've seen coding conventions that recommend to add a "final" specifier in front of method arguments, this way:
           public void second(final Value v, int i)
              i = 0;
              v.i = 20;
              Value val = new Value();
              v = val; // does not compile
              System.out.println(v.i + " " + i);
         }This way the compiler rejects the v=val assignment: if you want to do something similar to your previouscode, you have to introduce a new local variable, that is, local to second()'s body, and clearly unknown to first().
    Consider the new code after implementing my suggestions: does it clear the doubts?
    package assignments;
    class Value
         public int i = 15;
    } //Value
    public class Assignment15
         public static void main(String argv[])
              Assignment15 t = new Assignment15();
              t.first();
         public void first()
              int i = 5;
              Value v = new Value();
              v.i = 25;
              second(v, i);
              System.out.println(v.i);
         public void second(final Value v2, int i)
              i = 0;
              v2.i = 20;
              Value val = new Value();
              Value anotherValueVariableWhichDoesNotEscapeThisMethod = val;
              System.out.println(v2.i + " " + i);
              System.out.println(anotherValueVariableWhichDoesNotEscapeThisMethod.i + " " + i);
    } // Test

  • How is the -gm parameter effecting query runtime in detail?

    During test I found out, that the parameter -gm seems to have some dramatic impact onto runtime of queries. In Detail I found a something like factor 0.5 to 0.6 inside my tests for a smaller system:
    -iqtc 12000
    -iqmc 12000
    -iqlm 1000
    -gm 100
    -m
    -iqrlvmem 6000
    When setting -gm 1001, runtimes for a single query goes up from about 10 to about 40s.
    So how is the -gm parameter effecting IQ in detail?

    When IQ starts it allocates threads based on the -iqmt parameter.  If you don't set it, then it is computed as something like:
         -- 60 threads for each core up to 4
         -- 50 threads for each core after 4
         -- number of connections (-gm option)
         -- add 6 more just for good measure
    Let's assume that your IQ instance has 16 cores and you have -gm set to 100 .  IQ would allocate 946 threads (60*4+50*12+100+6).  We have to add 1 more thread to this, too.  Before we can allocate threads, we have 1 thread that is running to start the server.
    On my 16 core system, here are the threads allocated at startup for various values of -gm:
         -gn 10: 857 threads
         -gn 100: 947 threads (notice the +1 from the above algorithm?)
         -gn 1000: 1847 total threads
    There are two major deductions from the thread total: IO threads and SA/user threads.
    Of the threads, 40% are supposed to be held in reserve to handle IO tasks (sweeper and prefetch threads are set to 10% each and apply to main and temp cache) via the Prefetch_Threads_Percent and Sweeper_Threads_Percent options.  I am double checking this area just to make sure.  There was some work done on this in the v16 timeline.
    For user threads, I don't see you having set -gn.  Assuming that -gn is not set, then IQ will reserve 5 + -gm threads (105).  Not a problem.  IQ will grab 5 more threads than are allocated via the above algorithm, but that's OK.
    Things go a bit wrong on you when your -gn is set to the recommended value of 1.5 * -gm.  What happens is that we are computing the number of threads needed based on -gm (100 or 1000).  However, we are actually allocating threads based on -gm (105, 1005, 150, or 1500 depending on the default or best practices used).
    Imagine that -gn is set to 1.5x -gm.  Of the 1847 threads allocated, 1500 are held in reserve for user connections.  Read that as threads for the catalog only.  There would be just 347 threads left over.  But don't forget the IO threads either.  Now all of a sudden there are no threads left for any work in IQ.  We are thread starved.  When IQ gets into a thread starvation mode, we have little or no threads left over to do work in IQ.  At that time, we use the one guaranteed thread that each user connection has to do all work.  This holds true for worker thread starvation as well as IO thread starvation.
    One of two things is happening in your case.  You are either thread starved and forced to run everything single threaded or your system has so many threads that it must spend too much time maintaining threads that are not being used.
    If you can run sp_iqsysmon in '-debug' mode you can look at the "Thread Manager" section to check out the thread usage and allocations.
    Mark

  • My Macbook pro was stolen 09/12, the police just returned it to me. I want to remove all the data and start over. Format the drive's etc. I have windows 7 on 1 partion and mountain lion OSX on the apple partition. How is the best way to do this?

    My Macbook pro was stolen 09/12, the police just returned it to me. I want to remove all the data and start over. Format the drive's etc. I have windows 7 on 1 partion and mountain lion OSX on the apple partition. How is the best way to do this?

    Have a look here...
    what-to-do-when-your-hard-drive-is-full.html

  • I am running osx version 10.6.8 with safari 5.0.5.  recently i ran one of those recommended upgrades and now Safari continually quits citing .WinASOEasyTweakVKey.Gen.tmp plug-in.  how in the world do i combat this issue?  thank you!

    I am running OS X, version 10.6.8 with safari 5.0.5.  recently i ran one of those recommended upgrades and now Safari continually quits citing .WinASOEasyTweakVKey.Gen.tmp plug-in.  how in the world do i combat this issue?  thank you!  I have reset Safari several times.
    Another new problem is Firefox telling me, when the e-mail window is open, that the window must run in 32 bit.  The window is then disabled and then i have to restart Firefox.
    Thank You for any help/hope you can give me with these issues.  deborah

    You’ve been infected with the “Flashback” malware. See this Apple support document:
    About Flashback malware
    Back up all data, if you haven't already done so.
    From the menu bar, select
     ▹ Software Update
    to install the latest Java update, as well as any other available updates. That should clear the infection in most cases. You must update to the latest version of OS X 10.6 or 10.7 before you can install the Java update.
    The removal tool runs automatically in the background and is then deleted. Don’t look for something to click. If the malware is removed, you’ll be notified.
    After you’ve secured your system — not before — change every Internet password you have, starting with banking passwords, and check all financial accounts for unauthorized transactions.

  • How and the hell do you cancel this crap? have been trying for half a hour and this keeps running in cicrles. Will never use this again.

    how and the hell do you cancel this crap?

    Moving this discussion to the Adobe Creative Cloud forum.
    Davidb65209611 the e-mail address/Adobe ID you used to post to this forum does not have an active membership associated with it to cancel.  Please make sure to log into http://www.adobe.com/ with the Adobe ID/e-mail address associated with the active membership prior to following the process referenced by Ned.

  • Serial port control -- what's this code snippet?

    Hi, all.
    I've just become active working with LabView, version 6.0i. And this because of a program which "suddenly" stopped working, with no changes made by anyone that I can see (yeah, likely story, right?).
    In short, the screenshot which I'll include with this post is of one tiny code snippet buried deeply in the .vi which runs an X-Z positioning system. I'd like to know what people thing this code snippet does. I have my suspicions, but I can't believe that whoever wrote this code actually used it for this purpose!
    The X- and Z-positioners which I'm using are controlled by separate power sources, and separate ports on the computer. The X-positioner is ultra-fine-resolution, and has an optical encoder. It's controlled by the RS-232 port on the computer, and it's meant to be moved only a little at a time. The Z-positioner is a bit more coarse, and usually moves quite a bit at a time. It's serial-port controlled.
    The screenshot is of the portion of the code called "XMove" -- that portion of the code which controls the x-positioning stepper motor. Often, the Z-positioner is still running during this part of the code (the "ZMove" subroutine is called before the "XMove"), and then, after both parts of the positioner have stopped, the code should shut down the power to them, and update the position of the translation stage.
    However, once the code gets to this portion (screenshot), that while loop just keeps running.
    Here's what I think is happening (please correct me if I'm wrong!): The Z-positioner is run by the serial port, which, as far as I know, can be controlled by only one device at a time. Thus, this While loop does the following:
    1) attempts to write the characters "1R" followed by a linefeed to port 0 (the applicable serial port on this computer);
    2) reads how many characters are stored in the serial buffer;
    3) reads all the characters in the serial buffer;
    4) takes the first two characters from the string read;
    5) compares these two characters to *R;
    6) if the two characters are R, then the loop terminates and the code finishes.
    As far as I can tell (I've probed many parts of this structure), the code fails when the "N" portion passes the number of characters in the serial buffer to the "R" portion -- it's always zero. It appears to me that the "W" portion writes to the buffer AFTER the number of characters is read (I wouldn't have suspected this unless I'd run it many times and monitored which steps were done in which order). This ain't right!
    I found a similar question answered in the KnowledgeBase forum, but the answer to that one was that the serial port may have an "echo" mode. That doesn't change the fact that data is being from to the port before it's written, does it?
    Is there a way to make sure that the "read" statement happens AFTER the "write" statement? Am I way off base with what this code snippet should do? And, most importantly, *** is this a good way to tell if the Z-positioner is done with its job? ***. Is this a standard trick to tell if a program is done with the serial port?
    Thanks, all. I know the quandary of trying to debug with so few details, and not having the program in front of you. Any help is appreciated!
    Sincerely,
    Curtis Osterhoudt
    Attachments:
    VI_diagram.jpg ‏17 KB

    I suspect someone did change it, but they just don't realize they did.
    THe code snippet is an example of some very bad LV code! What you suspect is happeneing is indeed true. LV uses a data dependacy paradigm that says code execution order is dependent on data availablility. Data availability is determined by ythe rule that the output of a node or sub-VI is not available until the object completes.
    In you snipet, the only node that has to complete before the read bytes at port and the write to port VI is the the constant port number constant. That means that LV can execute either the write or the check bytes at port VI's first. This is determined at LV compile time. If for some reason LV decideds to compile in the write before the check bytes at port, the
    n the I/O may work as intended, BUT NOT POROGRAMMED!
    For a quick fix, put the contant port number and the write VI in a single frame sequence structure. This way the read from the constant and wire operation must comlplete before the seq completes, therby forcing the read stuff to wait.
    I hope this help,
    Ben
    Ben Rayner
    Certified LabVIEW Developer
    www.DSAutomation.com
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Need Help-How Store the input parameter through java bean

    Hello Sir,
    I have a simple Issue but It is not resolve by me i.e input parameter
    are not store in Ms-Access.
    I store the input parameter through Standard Action <jsp:useBean>.
    jsp:useBean call a property IssueData. this property exist in
    SimpleBean which create a connection from DB and insert the data.
    At run time servlet and server also show that loggging are saved in DB.
    But when I open the table in Access. Its empty.
    Ms-Access have two fields- User, Password both are text type.
    Please review these code:
    login.html:
    <html>
    <head>
    <title>A simple JSP application</title>
    <head>
    <body>
    <form method="get" action="tmp" >
    Name: <input type="text" name="user">
    Password: <input type="password" name="pass">
    <input type="Submit" value="Submit">
    </form>
    </body>
    </html>LoginServlet.java:
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class LoginServlet extends HttpServlet{
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException{
    try
    String user=request.getParameter("user");
    String pass=request.getParameter("pass");
    co.SimpleBean st = new co.SimpleBean();
    st.setUserName(user);
    st.setPassword(pass);
    request.setAttribute("user",st);
    request.setAttribute("pass",st);
    RequestDispatcher dispatcher1 =request.getRequestDispatcher("submit.jsp");
    dispatcher1.forward(request,response);
    catch(Exception e)
    e.printStackTrace();
    }SimpleBean.java:
    package co;
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.util.*;
    public class SimpleBean {
    private String user="";
    private String pass="";
    private String s="";
    public String getUserName() {
    return user;
    public void setUserName(String user) {
    this.user = user;
    public String getPassword() {
    return pass;
    public void setPassword(String pass) {
    this.pass = pass;
    public String getIssueData() //method that create connection with database
    try
    System.out.println("Printed*************************************************************");
    getUserName();
    getPassword();
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    System.out.println("Loading....");
    Connection con=DriverManager.getConnection("jdbc:odbc:simple");
    System.out.println("Connected....");
    PreparedStatement st=con.prepareStatement("insert into Table1 values(?,?)");
    System.out.println("~~~~~~~~~~~~~~~~~~~~");
    String User=getUserName();
    st.setString(1,User);
    String Password=getPassword();
    st.setString(2,Password);
    st.executeUpdate();
    System.out.println("Query Executed");
    con.close();
    s=  "Your logging is saved in DB ";
    System.out.println("Your logging is saved in DB *****************");
    return(s);
    catch(Exception e)
    e.printStackTrace();
    return "failed";
    }submit.jsp:
    This is Submit page
    <html><body>
    Hello
    Student Name: <%= ((co.SimpleBean)request.getAttribute("user")).getUserName() %>
    <br>
    Password: <%= ((co.SimpleBean)request.getAttribute("pass")).getPassword() %>
    <br>
    <jsp:useBean id="st" class="co.SimpleBean" scope="request" />
    <jsp:getProperty name="st" property="IssueData" />
    </body></html>web.xml:<web-app>
    <servlet>
    <servlet-name>one</servlet-name>
    <servlet-class>LoginServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>one</servlet-name>
    <url-pattern>/tmp</url-pattern>
    </servlet-mapping>
    <jsp-file>issue.jsp</jsp-file>
    <jsp-file>submit.jsp</jsp-file>
    <url-pattern>*.do</url-pattern>
    <welcome-file-list>
    <welcome-file>Login.html</welcome-file>
    </welcome-file-list>
    </web-app>Please Help me..Thanks.!!!
    --

    Dear Sir,
    Same issue is still persist. Input parameter are not store in database.
    After follow your suggestion when I run this program browser show that:i.e
    This is Submit page Hello Student Name: vijay
    Password: kumar
    <jsp:setProperty name="st" property="userName" value="userValue/> Your logging is saved in DB
    Please review my code.
    login.html:
    {code}<html>
    <head>
    <title>A simple JSP application</title>
    <head>
    <body>
    <form method="get" action="tmp" >
    Name: <input type="text" name="user">
    Password: <input type="password" name="pass">
    <input type="Submit" value="Submit">
    </form>
    </body>
    </html>{code}
    LoginServlet.java:
    {code}import javax.servlet.*;
    import javax.servlet.http.*;
    public class LoginServlet extends HttpServlet{
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException{
    try
    String userValue=request.getParameter("user");
    String passValue=request.getParameter("pass");
    co.SimpleBean st = new co.SimpleBean();
    st.setuserName(userValue);
    st.setpassword(passValue);
    request.setAttribute("userValue",st);
    request.setAttribute("passValue",st);
    RequestDispatcher dispatcher1 =request.getRequestDispatcher("submit.jsp");
    dispatcher1.forward(request,response);
    catch(Exception e)
    e.printStackTrace();
    }{code}
    SimpleBean.java:
    {code}package co;
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.util.*;
    public class SimpleBean {
    private String userValue="";
    private String passValue="";
    private String s="";
    public String getuserName() {
    return userValue;
    public void setuserName(String userValue) {
    this.userValue = userValue;
    public String getpassword() {
    return passValue;
    public void setpassword(String passValue) {
    this.passValue= passValue ;
    public String getissueData() //method that create connection with database
    try
    System.out.println("Printed*************************************************************");
    getuserName();
    getpassword();
    Class.forName("oracle.jdbc.driver.OracleDriver");
    System.out.println("Connection loaded");
    Connection con=DriverManager.getConnection("jdbc:oracle:thin:@VijayKumar-PC:1521:XE","SYSTEM","SYSTEM");
    System.out.println("Connection created");
    PreparedStatement st=con.prepareStatement("insert into vij values(?,?)");
    System.out.println("~~~~~~~~~~~~~~~~~~~~");
    String userName=getuserName();
    st.setString(1,userName);
    String password=getpassword();
    st.setString(2,password);
    st.executeUpdate();
    System.out.println("Query Executed");
    con.close();
    s= "Your logging is saved in DB ";
    System.out.println("Your logging is saved in DB *****************");
    return(s);
    catch(Exception e)
    e.printStackTrace();
    return "failed";
    }{code}
    submit.jsp:
    {code}This is Submit page
    <html><body>
    Hello
    Student Name: <%= ((co.SimpleBean)request.getAttribute("userValue")).getuserName() %>
    <br>
    Password: <%= ((co.SimpleBean)request.getAttribute("passValue")).getpassword() %>
    <br>
    <jsp:useBean id="st" class="co.SimpleBean" scope="request" />
    <jsp:setProperty name="st" property="userName" value="userValue/>
    <jsp:setProperty name="st" property="password" value="passValue"/>
    <jsp:getProperty name="st" property="issueData" />
    </body></html>web.xml:<web-app>
    <servlet>
    <servlet-name>one</servlet-name>
    <servlet-class>LoginServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>one</servlet-name>
    <url-pattern>/tmp</url-pattern>
    </servlet-mapping>
    <jsp-file>submit.jsp</jsp-file>
    <url-pattern>*.do</url-pattern>
    <welcome-file-list>
    <welcome-file>Login.html</welcome-file>
    </welcome-file-list>
    </web-app>Sir I can't use EL code in jsp because I use weblogic 8.1 Application Server.This version are not supported to EL.
    Please help me...How store th input parameter in Database through Java Bean                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How use the method hasPermission in weblogic server 6.1

    Hello everybody !
    In my application web ,i restrict access to some ressources (some jsp)
    to some specified groups .
    So,i create permissions in the file web.xml , as indicated in the doc
    6.0 .
    For example only the user : system can access to all the jsp , and the
    others users no .
    Now ,in my code ,I would like to use the method hasPermission in order
    to modify my application according to the differents groups of users .
    But my problem is that i don't know the parameter aclName !
    For the parameter permission I use the syntax "new
    weblogic.security.acl.PermissionImpl(".../x.jsp") .
    For the parameter sep (char),i use : '.' .
    But i don't find the parameter aclName .
    When i was in weblogic 5.1 ,i created permission in the file
    weblogicURL.policy with the syntax : " Permission
    weblogic.security.acl.URLAcl "weblogic.url",".../x.jsp" " and after
    i gave "weblogic.url" as parameter for aclName .
    But in version 6.0, I try web.xml, web ? but nothing is good .
    Is there any person which have an idea or the solution ?
    All the sugestions are welcome !
    Thanks by advance !
    Good bye .

    hi,
    maybe a better approach could be to use roles instead of permissons.
    Your menu.jsp could look like this:
    <%
    if(request.isUserInRole("super-user"))
    %>
    ... code HTML where the button "Creation" is created
    <%
    %>
    You can map the role 'super-user' to an individual principal or a
    user group in weblogic.xml. In that case only users that are in
    the mapped group/principal will see the 'creation' link. So simply
    add user 'system' to a group 'super-user'.
    regards,
    przemek
    Marc Alfonsi schrieb:
    Hi Kirann and everybody!
    Thanks for your message .
    I'm going to explain better than the first time .
    I set up security-constraints in my web.xml .
    For example only "system" can access to the directory Creation and
    all its .jsp , and the others users no .
    Now ,in my code , there is a jsp : menu.jsp which displays some
    possibilities : creation of an employee , visualisation ...with HTML
    code : button "Creation" which call a .jsp of the directory Creation .
    Actually , if a user different of "system" try to click on the button
    "Creation" there is a dialog box of login . The user writes its loggin
    but the access is prohibited ( because security-constraint in web.xml
    ).It's normal but not very well .I would like that a user who don't
    have access to the functionality "Creation" don't see the button
    "Creation" !
    So in menu.jsp , i would like to use the method hasPermission at the
    location of the button "Creation" is created with HTML code :
    <%
    if weblogic.security.acl.Security.hasPermission(.....,new
    weblogic.security.acl.PermissionImpl("/Creation/x.jsp"),'.')
    %>
    code HTML where the button "Creation" is created
    <%
    %>
    But my problem is that i don't know the first parameter which
    correspond
    to aclName .
    Any suggestions are welcome .
    Thanks for help .

  • TS1314 I have lots of organized photos on my PC and I want to keep them organized to sync to ipad.... how is the best way to do this?

    I have spent a lot of time saving, organizing and arranging photos (for the last 7 years) on my PC, and would like to know the best way to transfer these, AND MAINTAIN THE ORGANIZATION OF THE FOLDERS, to my new ipad (and later, my iphone). I have a really good system, and I do not want to have to do it all over again, on the ipad. I DO NOT want to subscribe to another monthly service fee (i.e. the iCloud) but DO have iTunes on my PC.
    What is the simplest method to do this ?  I have tried synching, but, each time have lost photos (on my ipad) OR have had NO ORGANIZATION AT ALL to the photos once synced.  I have all these photos (5.6gb) in the My Pictures folder, then subdivided into years, then subdivided into events and months within the years.  So, my transfer of the My Picures folder, completely transfers all of them, but with NO further organization.  Again, I have spent years doing this, and don't want to have to re-invent the wheel. 
    Can someone advise (or even better, lead me to a youtube video) that accurately shows the best way to do this ?
    Thank you, in advance, for your help.
    p.s.  I particularly enjoy Dan Nations very informative articles on how to get the best from my products.  And, wish Apple would explain "how it works" regarding the syncing methods on the Operating System.  It is the only thing I "don't get" about using my iPad..... meanwhile I LOVE my new mini ! ! ! ! ! ! ! thanks Apple, for keeping things simple.... Please don't change that !

    Correct, it will only be one-level, the Photos app doesn't support sub-albums - the sub-folders photos will be included in the parent's album.
    If you select My Pictures at the top of the Photos tab when syncing, then you should get an album for each folder that is directly under it - so if I understand correctly what you described then that would mean an album for 2013, one for 2012 etc. And each of those should include all the photos in the subfolders under it - so 2013 would include the photos from the events and months subfolders under it.
    You can't sync them separately, only the contents of the last sync remains on the iPad, by not including a folder in the next photo sync you are effectively telling iTunes that you no longer want that folder/album on the iPad so it will be removed and be replaced by the contents of the new sync (you can't delete synced photos directly on the iPad, instead they are deleted by not including them in the next sync).
    The app that I use, Photo Manager Pro, allows you to select and copy a folder (via FTP), but you would need to select each subfolder individually, which if you have a lot would be time-consuming (I think that if you select '2013' it would ignore the folders beneath it).

  • How Do I Cotrol the Flow of Execution of this Code ?

    HI,
    I am trying to write a code that can take all the user information at the command prompt and displays the same entered information. My code works well upto taking theh data and displaying..
    But, now i want to put some restrictions like entering valid acceptable data for ex.: for gender only male or female and not anything else.
    So I implemented this using the string comparison ignoring the cases just for the gender, using the "==" operator and the if statement.
    Now my desire was to check the input data at gender and see if it valid like male/female or not irrespective of cases, and then asking the user to renter that right value for gender. and should not proceed until entered properly. But my code checks it and skips to the next data to be fed !
    How do I control that flow of my code ie., it should not go ahead after checking the validity of data entered until the right data is fed ??
    MY CODE IS:
    import java.io.*;
    import java.lang.*;
    class Profilev1{
    public static void main(String args[]) throws IOException{
    String gend=null;
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Please enter your name:\r");
    String name=br.readLine();
    b1:{System.out.println("Please enter your gender Male/Female :\r");
    gend=br.readLine();
    if(gend!="male" && gend!="female")
         {     System.out.println("Please enter either Male or Female\n");
    break b1;
    System.out.println("Please enter your age:\r");
    int age= Integer.parseInt(br.readLine());
    System.out.println("Please enter your salary $Dollars.cents:\r");
    float sal=Float.parseFloat(br.readLine());
    System.out.println("\n\nThank You "+name+".\n\n\nHere's your profile with us on file :\r");
    System.out.println("Name:\t"+name+"\nGender:\t"+gend+"\nAge:\t"+age+"\nSalary:\t"+sal+"\r");
    OUTPUT IS:
    C:\Program Files\Java\jdk1.6.0_02\bin>javac Profilev1.java
    C:\Program Files\Java\jdk1.6.0_02\bin>java Profilev1
    Please enter your name:
    Aron Philip
    Please enter your gender Male/Female :
    male
    Please enter either Male or Female
    Please enter your age:
    100
    Please enter your salary $Dollars.cents:
    75600.23
    Thank You Aron Philip.
    Here's your profile with us on file :
    Name: Aron Philip
    Gender: male
    Age: 100
    Salary: 75600.23
    C:\Program Files\Java\jdk1.6.0_02\bin>
    Message was edited by:
    aron_phil

    Actually, I often use the equalsIgnoreCase instead of teh equals method, but you use them the same way.
    Here are two examples:
    import java.util.Scanner;
    class Fubar 
        private Scanner sc = new Scanner(System.in);
        private void testKeepGoing()
            boolean keepGoing = true;
            while (keepGoing)
                System.out.print("Enter \"goodbye\" to quit: ");
                String goodbyeString = sc.nextLine();
                if (goodbyeString.equalsIgnoreCase("goodbye"))
                    keepGoing = false;
        private void testTypeQuit()
            Scanner sc = new Scanner(System.in);
            String quitString = "";
            while (!quitString.equalsIgnoreCase("quit"))
                System.out.print("Type \"quit\" to exit: ");
                quitString = sc.nextLine();
            sc.close();
        public static void main(String[] args)
            Fubar foo = new Fubar();
            foo.testKeepGoing();
            foo.testTypeQuit();
    }

  • How Insert the input parameter to database through Java Bean

    Hello To All..
    I want to store the input parameter through Standard Action <jsp:useBean>.
    jsp:useBean call a property IssueData. this property exist in
    SimpleBean which create a connection from DB and insert the data.
    At run time when I click on submit button servlet and server also show that loggging are saved in DB.
    But when I open the table in Access. Its empty.
    Ms-Access have two fields- User, Pass both are text type.
    Please review these code:
    login.html:
    <html>
    <head>
    <title>A simple JSP application</title>
    <script language=javascript>
    function f(k)
    document.forms['frm'].mykey.value=k;
    document.forms['frm'].submit();
    </script>
    <head>
    <body>
    <form method="get" action="tmp" name="frm">
    Name: <input type="text" name="User">
    Password: <input type="password" name="Pass">
    <input type=hidden name="mykey" value="">
    <input type="button" value="Submit" onclick="f('submit.jsp')">
    <input type="button" value="Issue" onclick="f('issue.jsp')">
    </form>
    </body>
    </html>LoginServlet.java:import javax.servlet.*;
    import javax.servlet.http.*;
    public class LoginServlet extends HttpServlet{
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException{
    try
    String User=request.getParameter("User");
    String Pass=request.getParameter("Pass");
    co.SimpleBean st = new co.SimpleBean();
    st.setUser(User);
    st.setPass(Pass);
    request.setAttribute("User",st);
    request.setAttribute("Pass",st);
    RequestDispatcher dispatcher1 =request.getRequestDispatcher("/"+request.getParameter("mykey"));
    dispatcher1.forward(request,response);
    catch(Exception e)
    e.printStackTrace();
    }SimpleBean.java:package co;
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.util.*;
    public class SimpleBean
    private String User="";
    private String Pass="";
    private String s="";
    public SimpleBean(){}
    public String getUser() {
    return User;
    public void setUser(String User) {
    this.User = User;
    public String getPass() {
    return Pass;
    public void setPass(String Pass) {
    this.Pass = Pass;
    public String getissueData() //method that create connection with database
    try
    System.out.println("Printed*************************************************************");
    getUser();
    getPass();
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    System.out.println("Loading....");
    Connection con=DriverManager.getConnection("jdbc:odbc:simple");
    System.out.println("Connected....");
    PreparedStatement st=con.prepareStatement("insert into Table1 values(?,?)");
    System.out.println("~~~~~~~~~~~~~~~~~~~~");
    String User=getUser();
    st.setString(1,User);
    String Pass=getPass();
    st.setString(2,Pass);
    int y= st.executeUpdate();
    System.out.println(y);
    System.out.println("Query Executed");
    con.commit();
    con.close();
    s=  "Your logging is saved in DB ";
    System.out.println("Your logging is saved in DB *****************");
    return this.s;
    catch(Exception e)
    e.printStackTrace();
    return "failed";
    }submit.jsp:
    This is Submit page
    <html><body>
    Hello
    Student Name: <%= ((co.SimpleBean)request.getAttribute("User")).getUser() %>
    <br>
    Password: <%= ((co.SimpleBean)request.getAttribute("Pass")).getPass() %>
    <br>
    <jsp:useBean id="st" class="co.SimpleBean" scope="request"/>
    <jsp:setProperty name="st" property="User" value="request.getParamaeter("Pass")"/>
            <jsp:setProperty name="st" property="Pass" value="request.getParamaeter("Pass")"/>
       <jsp:getProperty name="st" property="issueData"/>
    <% st.getissueData(); %>
    </body></html>web.xml:<web-app>
    <servlet>
    <servlet-name>one</servlet-name>
    <servlet-class>LoginServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>one</servlet-name>
    <url-pattern>/tmp</url-pattern>
    </servlet-mapping>
    <jsp-file>issue.jsp</jsp-file>
    <jsp-file>submit.jsp</jsp-file>
    <url-pattern>*.do</url-pattern>
    <welcome-file-list>
    <welcome-file>Login.html</welcome-file>
    </welcome-file-list>
    </web-app>Please Help me..

    Dear Sir,
    Accordingly your suggestion I check the SimpleBean class putting the constant values in this bean class.That is Sucessfully Inserted constant values in database.
    Like for example..
    myfirstjavabean.java:
    package myfirstjava;
    import java.io.*;
    import java.sql.*;
    public class myfirstjavabean
    private String firstMsg="Hello world";
    private String s="";
    public myfirstjavabean()
    public String getfirstMsg()
    return firstMsg;
    public void setfirstMsg(String firstMsg)
    this.firstMsg=firstMsg;
    public String getissueData() //method that create connection with database
    try
    System.out.println("Printed*************************************************************");
    getfirstMsg();
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    System.out.println("Loading....");
    Connection con=DriverManager.getConnection("jdbc:odbc:sampleMsg");
    System.out.println("Connected....");
    PreparedStatement st=con.prepareStatement("insert into Table1 values(?)");
    System.out.println("~~~~~~~~~~~~~~~~~~~~");
    String Msg=getfirstMsg();
    st.setString(1,Msg);
    int y= st.executeUpdate();
    System.out.println(y);
    System.out.println("Query Executed");
    con.commit();
    con.close();
    s=  "Your logging is saved in DB ";
    System.out.println("Your logging is saved in DB *****************");
    return this.s;
    catch(Exception e)
    e.printStackTrace();
    return "failed";
    }Vij.jsp:
    <html>
    <body>
    <jsp:useBean id="st" class="myfirstjava.myfirstjavabean" scope="request" />
    <jsp:getProperty name="st" property="firstMsg" />
    <jsp:getProperty name="st" property="issueData" />
    </body>
    </html>These above example sucessfully inserted the Hello World message in database.
    But which value I put user input at run time Its not inserted in database.
    Which is my previous problem that is persist.
    Please Help..

  • How does the width parameter in the peak detector work?

    I would like to know how the window slides. For example if i take a width of 3. My first window is from 1 to 3. My next window will slide from 4 to 6 or from 2 to 4.
    Thank you.

    Madhuri,
    Please Refer to NI Article at http://zone.ni.com/devzone/conceptd.nsf/webmain/55181A206A523FD186256ABE00626EA9?opendocument
    I have Used Peak Detetor in the past. One thing is the width function works on sets of Points.
    It Performs a Least Squares Fit based on points you provide then extracts the quadratic Polynomial then checks this polynomial for Peaks using Parabolic Concavity.
    I can be at best vague on how it does this. But my experience shows that you have to play with the width no to kind of optimize the peak detection for your dataset
    If you can find additional information please post it here for others..
    Good Luck
    Mache
    Good Luck!
    Mache

  • R&R - how is the system partition identified?

    When trying a full restore of the system partition only (from a backup stored on a network share, selecting "recreate full system" and threafter checking "system drive only"), I get a (German) error message, saying something like
    "... the system partition does not exist or could not be found".
    Since my R&R backups were created when my notebook was configured with many partitions (linux and windows), the partition scheme in the master boot sector was different. Now I would like to restore the system partition into the C: drive (partition "Windows7_OS")  but this partition is not found by R&R. Does anone know how R&R looks for the system partition? If I would know what attributes such a partition needs to have, I could probably "fake" such a partition and R&R would restore my files...

    I've read your posts.  R&R has a limitation that the partition structure of the disk cannot change after you start taking backups.  I think at this point, your only hope of recovering your backups is to start with a completely blank HDD (no partitions) that is as big or bigger than your original HDD.  This will put R&R into a different mode called "bare-metal" where the partition structure, in addition to the contents, are restored.  The way you are doing it now, R&R is trying to restore the contents only, but since the partition structure has changed, this is apparently failing.
    Anyway, try using a completely blank HDD and restoring your backup that way.  I think it's probably your only hope.

  • What the he** is wrong with this code?

    Hi,
    I have 2 tables. Primary table "resease" and secondary table (containing the foreign key) "kunden".
    Selecting a release (dropdownlist), will show you the corresponding entry of kunden (datatable).
    I added buttons to the datatable for deleting certain rows. This all works fine so far.
    But as you are going to delte the last entry of table kunden, I want to delte the corresponding entry of the table release as well. And by trying to do so, I get an exception telling in line "dataTable1Model.commit();"
    "java.sql.SQLException: Lock time out; try later."
    The exception disappears by deleting the inner try-catch block.
    So what is wrong with this code?
    Thank,
    Mark.
    PS: If you need the database-schema or anything else, let me know....
    public String delete_action() {
            try {
             //returns -1, so I can't use it     
                int rowCount = dataTable1Model.getRowCount();          
             //get affected row     
                com.sun.jsfcl.data.DataCache.Row row =
                dataTable1Model.getDataCache().get(dataTable1Model.getRowIndex());
                row.setDeleted(true);
                try {
                    //New RowSet for getting FK of affected line
                    JdbcRowSetXImpl pkRowSet = new JdbcRowSetXImpl();
                    pkRowSet.setDataSourceName("java:comp/env/jdbc/AVT");
                    pkRowSet.setCommand("SELECT fk_idrelease FROM kunden " +
                    "where fk_idrelease = ?");
                    //Convert Row into string
                    String myRow = row.toString();
                    //Getting the index of the first "=" (it's before the FK)
                    int index = myRow.indexOf("=")+1;
                    //Getting the number (FK) out of the string an casting it to int
                    int fk = Integer.parseInt(myRow.substring(index,(index+1)));
                    //Saving the FK in SessionBean1, so I can use it a parameter of
              //the setObject(int, Object)-method
                    getSessionBean1().setFk(fk);
                    //this will give me a RowSet of all lines containing the FK of
              //the affected row
              pkRowSet.setObject(1, getSessionBean1().getFk());
                    pkRowSet.execute();
                    pkRowSet.last();
                    int numRow = pkRowSet.getRow();
              //If the numRow (numbers of rows) is 1, go to cascade_delte
              //and delte the entry with primary key as well
                    if (numRow == 1) {
                        cascade_delete(); //not implemented yet
                }catch (Exception ex) {
                    error("Error counting affected rows: " + ex);
                dataTable1Model.commit();
                dataTable1Model.execute();
                info("Deleting row OK!");
            }catch (Exception e) {
                log("Page 1: Row delete exception: ", e);
                error("Error during deleting: " + e);
            } // end try catch
          return null;
        }

    just a guess - perhaps call pkRowSet.close() at the end of your try/catch?
    v

Maybe you are looking for