Anybody can help with this SQL?

The table is simple, only 2 columns:
create table personpay(
id integer primary key,
pay number(8,2) not null);
So the original talbe looks like this:
ID PAY
1 800
2 400
3 1200
4 500
5 600
6 1900
The requirement is to use one single query(no pl/sql) to show something lile the following, in other words, for each ID, the pay is the sum of all before itself and itself. So the query result looks like this:
ID PAY
1 800
2 1200
3 2400
4 2900
5 3500
6 5400
Again, just use one sql. No pl/sql. Anybody can help with this? I really appreciate that.
thanks,

Eh, people are so "analytically minded" that can't even notice a simple join?
Counting Ordered Rows
Let’s start with a basic counting problem. Suppose we are given a list of integers, for example:
x
2
3
4
6
9
and want to enumerate all of them sequentially like this:
x      #
2      1
3      2
4      3
6      4
9      5
Enumerating rows in the increasing order is the same as counting how many rows precede a given row.
SQL enjoys success unparalleled by any rival query language. Not the last reason for such popularity might be credited to its proximity to English . Let examine the informal idea
Enumerating rows in increasing order is counting how many rows precede a given row.
carefully. Perhaps the most important is that we referred to the rows in the source table twice: first, to a given row, second, to a preceding row. Therefore, we need to join our number list with itself (fig 1.1).
Cartesian Product
Surprisingly, not many basic SQL tutorials, which are so abundant on the web today, mention Cartesian product. Cartesian product is a join operator with no join condition
select A.*, B.* from A, B
Figure 1.1: Cartesian product of the set A = {2,3,4,6,9} by itself. Counting all the elements x that are no greater than y produces the sequence number of y in the set A.
Carrying over this idea into formal SQL query is straightforward. As it is our first query in this book, let’s do it step by step. The Cartesian product itself is
select t.x x, tt.x y
from T t, T tt
Next, the triangle area below the main diagonal is
select t.x x, tt.x y
from T t, T tt
where tt.x <= t.x
Finally, we need only one column – t.x – which we group the previous result by and count
select t.x, count(*) seqNum
from T t, T tt
where tt.x <= t.x
group by t.x
What if we modify the problem slightly and ask for a list of pairs where each number is coupled with its predecessor?
x      predecessor
2      
3      2
4      3
6      4
9      6
Let me provide a typical mathematician’s answer, first -- it is remarkable in a certain way. Given that we already know how to number list elements successively, it might be tempted to reduce the current problem to the previous one:
Enumerate all the numbers in the increasing order and match each sequence number seq# with predecessor seq#-1. Next!
This attitude is, undoubtedly, the most economical way of thinking, although not necessarily producing the most efficient SQL. Therefore, let’s revisit our original approach, as illustrated on fig 1.2.
Figure 1.2: Cartesian product of the set A = {2,3,4,6,9} by itself. The predecessor of y is the maximal number in a set of x that are less than y. There is no predecessor for y = 2.
This translates into the following SQL query
select t.x, max(tt.x) predecessor
from T t, T tt
where tt.x < t.x
group by t.x
Both solutions are expressed in standard SQL leveraging join and grouping with aggregation. Alternatively, instead of joining and grouping why don’t we calculate the count or max just in place as a correlated scalar subquery:
select t.x,
(select count(*) from T tt where tt.x <= t.x) seq#
from T t
group by t.x
The subquery always returns a single value; this is why it is called scalar. The tt.x <= t.x predicate connects it to the outer query; this is why it is called correlated. Arguably, leveraging correlated scalar subqueries is one the most intuitive techniques to write SQL queries.
How about counting rows that are not necessarily distinct? This is where our method breaks. It is challenging to distinguish duplicate rows by purely logical means, so that various less “pure” counting methods were devised. They all, however, require extending the SQL syntactically, which was the beginning of slipping along the ever increasing language complexity slope.
Here is how analytic SQL extension counts rows
select x, rank() over(order by x) seq# from T; -- first problem
select x, lag() over(order by x) seq# from T; -- second problem
Many people suggest that it’s not only more efficient, but more intuitive. The idea that “analytics rocks” can be challenged in many ways. The syntactic clarity has its cost: SQL programmer has to remember (or, at least, lookup) the list of analytic functions. The performance argument is not evident, since non-analytical queries are simpler construction from optimizer perspective. A shorter list of physical execution operators implies fewer query transformation rules, and less dramatic combinatorial explosion of the optimizer search space.
It might even be argued that the syntax could be better. The partition by and order by clauses have similar functionality to the group by and order by clauses in the main query block. Yet one name was reused, and the other had been chosen to have a new name. Unlike other scalar expressions, which can be placed anywhere in SQL query where scalar values are accepted, the analytics clause lives in the scope of the select clause only. I have never been able to suppress an impression that analytic extension could be designed in more natural way.

Similar Messages

  • Let's see who can help with this applet

    Hello. I am new in Java and confused with this assignment.
    I have to write an applet for a store that sells 8 products
    whose retails prices are Product 1 - $2.98, Product 2 - $4.50, Product 3 - $9.98, Product 4 - $ 4.49, Product 5 - $ 6.87,
    Product 6 � $ 12.37, Product 7 - $ 14.30 and Product 8 - $ 11.40.
    The applet: 1) Has an intro message to a store named for you, where you describe what products they have, 2) Reads a series of pairs of numbers: Product Number and Quantity Number.
    Use a switch structure to determine the retail prices for each product. Use "TextField" to obtain the product number from the user. Use a �sentinel controlled� loop to determine when the program should stop looping to display the final result (I used number -1 as sentinel). Display the total value of all products sold.
    This is the program I wrote:
    //java core packages
    import java.awt.*;
    import java.awt.event.*;
    import java.text.NumberFormat;
    import java.util.Locale;
    // Java extension packages
    import javax.swing.*;
    public class MYSHOP extends JApplet implements ActionListener {
    // GUI componentes
    JLabel productNumLabel, quantityNumLabel;
    JTextField productNumField, quantityNumField;
    // variables
    double subtotal = 0;
    double total = 0;
    public void init()
    // display intro message
    JOptionPane.showMessageDialog( null, "Welcome toablabla.\nWe
    offer you blablabla\nClick OK to start shoping",
    "Company information", JOptionPane.PLAIN_MESSAGE );
    // obtain content pane and set its layout to FlowLayout
    Container container = getContentPane();
    container.setLayout( new FlowLayout() );
    // create productNumLabel, productNumField and attach them to
    // content pane
    productNumLabel = new JLabel( "Enter Product Number (-1 to
    quit):" );
    productNumField = new JTextField( 4 );
    productNumField.addActionListener( this );
    container.add( productNumLabel );
    container.add( productNumField );
    // create productNumLabel, productNumField and attach them to
    // content pane
    quantityNumLabel = new JLabel("Enter Quantity:");
    quantityNumField = new JTextField( 4 );
    quantityNumField.addActionListener( this );
    container.add( quantityNumLabel );
    container.add( quantityNumField );
    } // end method init
    public void actionPerformed( ActionEvent actionEvent )
    int index = Integer.parseInt( productNumField.getText() );
    int ammount = 0;
    while ( index != -1 )
    NumberFormat moneyFormat =
    NumberFormat.getCurrencyInstance( Locale.US );
    if( actionEvent == quantityNumField.getText() )
    ammount = Integer.parseInt( quantityNumField.getText() );
    switch (index)
    case 1:
    subtotal += ( 2.98 * ammount );
    break;
    case 2:
    subtotal += ( 4.5 * ammount );
    break;
    case 3:
    subtotal += ( 9.98 * ammount );
    break;
    case 4:
    subtotal += ( 4.49 * ammount );
    break;
    case 5:
    subtotal += ( 6.87 * ammount );
    break;
    case 6:
    subtotal += ( 12.37 * ammount );
    break;
    case 7:
    subtotal += ( 14.30 * ammount );
    break;
    case 8:
    subtotal += ( 11.40 * ammount );
    break;
    case -1:showStatus( "The Total is: " + subtotal );
    System.exit(0);
    break;
    default:
    JOptionPane.showMessageDialog( null,"There is no
    such product", "ERROR",
    JOptionPane.ERROR_MESSAGE);
    } // end switch structure
    } // end while structure
    productNumField.setText(""); // clear productNum field
    quantityNumField.setText(""); // clear quantityNum field
    } // end method actionPerformed
    } // end class MYSHOP
    When I try to compile it, the error I get is "incomparable types: java.awt.event.ActionEvent and java.lang.String", in the line:
    if( actionEvent == quantityNumField.getText() )
    The error pointer points to "==" in that line
    What should I write in that line instead?
    Also, if someone realizes that some part of the code is in the wrong place, please tell me.
    Thanks in advance.

    Instead of
    if( actionEvent == quantityNumField.getText() ) I think you want
    if( actionEvent.getSource() == quantityNumField )HTH,
    Radish21

  • Help with this sql. Select only employees from a distinct Org??

    Hi guys, simple query.
    create table balancetest(emp_id number, balance_id number, balance number, org number);
    insert into balancetest values (111, 1, 1, 0);
    insert into balancetest values (111, 1, 1, 0);
    insert into balancetest values (111, 2, 1, 1);
    insert into balancetest values (222, 1, 2, 1);
    insert into balancetest values (333, 3, 4, 3);
    insert into balancetest values (333, 3, 4, 2);
    commit;
    SQL> select * from balancetest;
        EMP_ID BALANCE_ID    BALANCE        ORG
           111          1          1          0
           111          1          1          0
           111          2          1          1
           222          1          2          1
           333          3          4          3
           333          3          4          2
    6 rows selected.As you can see, emp_id 111 appears on different Org (0 and 1). I need to calculate the balance but the requirement says that I need to retrieve employees appearing only in 1 org.. It won't matter which org is selected (the business rules ensure balance will be the same), as long as if an employee is in multiple org, this employee is selected only once for an org. So, my result will be something like:
        EMP_ID BALANCE_ID    BALANCE        ORG
           111          1          1          0
           111          1          1          0
           222          1          2          1
           333          3          4          3
           333          3          4          2or,
        EMP_ID BALANCE_ID    BALANCE        ORG
           111          2          1          1
           222          1          2          1
           333          3          4          3
           333          3          4          2In other words, an employee must appear only in 1 org in my result.
    any ideas? I tried:
    select * from balancetest bal1
    where not exists ( select bal2.emp_id from
                               balancetest bal2
                               where bal2.emp_id = bal1.emp_id
                               and bal2.org <> bal1.org
                               );But I guess it won't be that simple!!

    Hi,
    You can find the lowest-numbered org for each employee like this:
    SELECT    emp_id
    ,         MIN (org)  AS min_org
    FROM      balancetest
    GROUP BY  emp_id;You can get the results you want by selecting only rows from balancetest that match a row in this the result set above. There are many ways to do that, such as a join:
    WITH  g  AS
        SELECT    emp_id
        ,         MIN (org)  AS min_org
        FROM      balancetest
        GROUP BY  emp_id
    SELECT  b.*
    FROM    balancetest  b
    JOIN                 g  ON  b.emp_id = g.emp_id
                            AND b.org    = g.min_org;

  • Aprimo and InDesign integration... Curious if any 3rd party programs can help with this. Thanks!

    We were promised that Aprimo played nicely with Creative Suite, although now that we're getting our hands dirty, we're finding this is not the case, and our Aprimo contacts haven't been much help. Has anyone out there found a way to make this work? Thank you for any notes & recommendations!

    Aprimo’s Marketing Resource Management (MRM) solution has Brand Asset Management functionality.
    A full enterprise digital asset management solution like North Plains TeleScope can understand creative tool work flow, allowing users to work with complex, multi-asset documents such as InDesign without needing to manage each asset individually.
    A solution involving a strong Aprimo-TeleScope integration off ers companies the best of both worlds. It would impart great value to all who need Enterprise Digital Asset Management and also want to manage their campaigns and marketing processes more eff ectively.
    We at Capgemini have a Center of Excellence for Integrated Marketing Management where in we have expertise in building Aprimo's MRM as well as North Plains TeleScope solutions. We have been collaborating with Aprimo as well as North Plains for varions engagements to work as a Consultant / System Integrator for our customers across geographies - especially North America.
    We can provide the above mentioned solution if needed.

  • Help with this SQL Query please

    How many garments has each dressmaker constructed? You should give the number of garments and the name, house number and post code of each dressmaker.
    tables; dressmaker contains D_NO, D_NAME, D_HOUSE_NO, D_POST_CODE
    garment contains STYLE_NO, DESCRIPTION, LABOUR_COST, NOTIONS
    quantities contains STYLE_Q, SIZE_Q, QUANTITY
    The question title is multitableJOINS
    I believe i have to use (garment.style_no=quantities.style_q) if it will work, im new to oracle & SQL so all the help i get i am grateful for, thankyou.

    Not to be a jerk, but this forum is really not intended for homework. Show a little effort, and try it out. Post some results, and maybe someone will help you out. Getting others to do your homework will not help you when you get out of school.

  • Need Help with this SQL Report

    Declare @Total int
    Select
    @Total=count(*)
    From
    v_Add_Remove_Programs
    Where
    v_Add_Remove_Programs.DisplayName0 Like '@DisplayName'
    Select Distinct
    v_Add_Remove_Programs.DisplayName0 as [Software Product],
    Version0 as [Version],
    COUNT(v_GS_System.Name0) as [Count],
    Round(100.0*count(*)/@Total,1) as [Percentage]
    FROM
    v_Add_Remove_Programs
    Join
    v_GS_System ON v_Add_Remove_Programs.ResourceID = v_GS_System.ResourceID
    WHERE
    v_Add_Remove_Programs.DisplayName0 Like '@DisplayName'
    GROUP BY
    Version0,
    v_Add_Remove_Programs.DisplayName0
    ORDER BY
    [Percentage] DESC
    Select Distinct
    v_GS_SYSTEM.Name0 as [Computer Name],
    v_Add_Remove_Programs.DisplayName0 as [Software Product],
    Version0 as [Version]
    FROM
    v_Add_Remove_Programs
    Join
    v_GS_SYSTEM ON v_Add_Remove_Programs.ResourceID = v_GS_SYSTEM.ResourceID
    WHERE
    v_Add_Remove_Programs.DisplayName0 Like '@DisplayName'
    GROUP BY
    v_GS_SYSTEM.Name0,
    Version0,
    v_Add_Remove_Programs.DisplayName0
    ORDER BY
    [Version] DESC
    If I remove the @DisplyaName variables and type in a product name sucha as:
    = 'Microsoft Office Professional 2013" or something, it works fine. How can I get the @DisplayName variables to work for me?
    Thanks

    v_Add_Remove_Programs.DisplayName0 Like '%'+ @DisplayName+'%'

  • Need help with this sql query

    the following query returns me the correct no of rows:
    select col1 from tab1 where
    col1 like '%'||chr(32)||'%';
    but i need to use my query in the following form and it doesn't return any row:
    select col1 from tab1 where
    col1 IN ('%'||chr(32)||'%');
    what am I doing worng?
    thanks in advance.

    Or in 10g (just recycling another example):
    WITH t AS (SELECT 'OPTI1457' || CHR(32) col1
                 FROM dual
                UNION
               SELECT 'OPT123' || CHR(9)
                 FROM dual
                UNION
               SELECT 'OPTIM12345'
                 FROM dual
    SELECT t.*
      FROM t
    WHERE REGEXP_LIKE(t.col1, CHR(32) || '|' || CHR(9))
    ;       C.

  • Is there anybody can help in this exception

    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Exception in JSP: /jsp/register.jsp:19
    16:
    17: <jsp:setProperty name="reg" property="user1" />
    18:
    19: <jsp:setProperty name="reg" property="pass1"/>
    20:
    21: </body>
    22: </html>
    Stacktrace:
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    org.apache.jasper.JasperException
         org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRuntimeLibrary.java:359)
         org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:306)
         org.apache.jsp.jsp.register_jsp._jspService(register_jsp.java:72)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    java.lang.reflect.InvocationTargetException
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         java.lang.reflect.Method.invoke(Unknown Source)
         org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRuntimeLibrary.java:355)
         org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:306)
         org.apache.jsp.jsp.register_jsp._jspService(register_jsp.java:72)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.20 logs.
    Apache Tomcat/5.5.20

    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    root cause
    org.apache.jasper.JasperException
         org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRuntimeLibrary.java:359)
         org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:306)
         org.apache.jsp.jsp.register_jsp._jspService(register_jsp.java:72)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    root cause
    java.lang.reflect.InvocationTargetException
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:597)
         org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRuntimeLibrary.java:355)
         org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:306)
         org.apache.jsp.jsp.register_jsp._jspService(register_jsp.java:72)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
    Apache Tomcat/5.5.17

  • I need another person Who Can help with this iphone it will not restore on will not completely turn on

    i can't turn on the phone or even restore the phone completely it will not turn on at all !!

    iOS: How to backup - http://support.apple.com/kb/HT1766
    iOS: Unable to update or restore - http://support.apple.com/kb/HT1808

  • Does anybody know how to get help with this one?

    Hello there!  
    I wanted to get an advice on how to get in touch with the appropriate person at BT that could help with my situation.
    I have tried telephone help, complaints by email and unfortunately still waiting for somebody from the customer services to help me out.
    I have recently moved home.  I contacted BT on 26th June to organise the line transfer to the new address. The date was set for 18th July. I also ordered line rental saver and paid for it over the phone. All went smooth, telephone and broadband was working fine at the new place, but on the 23rd July I was sent an email that "BT is sorry that I am leaving". 
    I thought it was a mistake, but the lady in the on-line chat said somebody stopped my service. Later she rang and left a message saying that I must have requested to move to another provider. Did not manage to speak to her again, but phoned the help line this time.
    There a gentleman was trying to convince me that I called BT and cancelled my service on the 18th July and to him I was not a BT customer anymore. The truth is that I did not request to stop my service, anyway - why would I do that after paying for a year in advance. This has no logic, but because computer says so then he thinks I did it.
    He also added that my account is a 'mess'. He then promised that somebody would get in touch to sort it out as my line rental was gone and my phone and internet could go off any minute.
    I did not get any help. After that I wrote to them  3 email complaints to request assistance. They called and aknowledge they will help, but 3 weeks down the line nothing was done to explain the situation. Left the messages to the person from email complaints to ring me or email me -never happened.
    Last week I got 2 emails welcoming me to BT and outlining the call plans that were diferent from each other and the one I agreed to on the 25th June. When I called help line 2 days ago a lady confirmed on which one I am on, but could not sort out the most annoying thing - the 'final' bill. 
    I was sent a bill for over 200 pounds due to premature termination of phone and broadband service , which I never ordered. They already took the money this week. My line saver is gone as well. So I am 360 pounds short. I aslo have no access to myBT to monitor my phone activity or make orders.They also did not send any confrimation of the call plan I am currently on.
    It is a very annoying situation, because somebody at BT made an error and I am unable to get to anybody that could help. Everytime you call the help line you speak to somebody else and despite me thinking the email complaints would be the way forward they are not. Would appreciate some advice on how to tackle these issues: false accusations from them, inappropriate billing, problem with myBT.
    Thanks Lukasz

    Hi lbadek
    I can help with this please send us an email using the contact the mods link in my proifle and we will investigated from there.
    Thanks
    Stuart
    BTCare Community Mod
    If we have asked you to email us with your details, please make sure you are logged in to the forum, otherwise you will not be able to see our ‘Contact Us’ link within our profiles.
    We are sorry that we are unable to deal with service/account queries via the private message(PM) function so please don't PM your account info, we need to deal with this via our email account :-)

  • Anybody can help me? I'm trying to start my computer and it shows this question mark. Then i restart it holding the option key and it shows this padlock with a password field. What should password should i put?

    Anybody can help me? I'm trying to start my computer and it shows this question mark. Then i restart it holding the option key and it shows a padlock with a password field. What password should i put? I would appreciate any help

    Contact Apple, or if you bought the computer secondhand, the previous owner.
    (118258)

  • HT201066 I have problem with recently with playing DVDs on my iMac. the problem only with DVDs, please anybody can help me solve this problem?

    I have problem with recently with playing DVDs on my iMac. the problem only with DVDs, please anybody can help me solve this problem?

    Get a lens cleaner disc. One with brushes and try that. CDs and DVDs use different lenses, so since CDs load and play, I strongly suspect a dirty lens.

  • Can anybody help me to build an interface that can work with this code

    please help me to build an interface that can work with this code
    import java.util.Map;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.io.BufferedReader;
    import java.io.FileReader;
    public class Translate
    public static void main(String [] args) throws IOException
    if (args.length != 2)
    System.err.println("usage: Translate wordmapfile textfile");
    System.exit(1);
    try
    HashMap words = ReadHashMapFromFile(args[0]);
    System.out.println(ProcessFile(words, args[1]));
    catch (Exception e)
    e.printStackTrace();
    // static helper methods
    * Reads a file into a HashMap. The file should contain lines of the format
    * "key\tvalue\n"
    * @returns a hashmap of the given file
    @SuppressWarnings("unchecked")
    private static HashMap ReadHashMapFromFile(String filename) throws FileNotFoundException, IOException
    BufferedReader in = null;
    HashMap map = null;
    try
    in = new BufferedReader(new FileReader(filename));
    String line;
    map = new HashMap();
    while ((line = in.readLine()) != null)
    String[] fields = line.split("
    t", 2);
    if (fields.length != 2) continue; //just ignore "invalid" lines
    map.put(fields[0], fields[1]);
    finally
    if(in!=null) in.close(); //may throw IOException
    return(map); //returning a reference to local variable is safe in java (unlike C/C++)
    * Process the given file
    * @returns String contains the whole file.
    private static String ProcessFile(Map words, String filename) throws FileNotFoundException, IOException
    BufferedReader in = null;
    StringBuffer out = null;
    try
    in = new BufferedReader(new FileReader(filename));
    out = new StringBuffer();
    String line = null;
    while( (line=in.readLine()) != null )
    out.append(SearchAndReplaceWordsInText(words, line)+"\n");
    finally
    if(in!=null) in.close(); //may throw IOException
    return out.toString();
    * Replaces all occurrences in text of each key in words with it's value.
    * @returns String
    private static String SearchAndReplaceWordsInText(Map words, String text)
    Iterator it = words.keySet().iterator();
    while( it.hasNext() )
    String key = (String)it.next();
    text = text.replaceAll("\\b"key"
    b", (String)words.get(key));
    return text;
    * @returns: s with the first letter capitalized
    String capitalize(String s)
    return s.substring(0,0).toUpperCase() + s.substring(1);
    }... here's the head of my pirate_words_map.txt
    hello               ahoy
    hi                    yo-ho-ho
    pardon me       avast
    excuse me       arrr
    yes                 aye
    my                 me
    friend             me bucko
    sir                  matey
    madam           proud beauty
    miss comely    wench
    where             whar
    is                    be
    are                  be
    am                  be
    the                  th'
    you                 ye
    your                yer
    tell                be tellin'

    please help me i don t know how to go about this.my teacher ask me to build an interface that work with the code .
    Here is the interface i just build
    import java.util.Map;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.awt.*;
    import javax.swing.*;
    public class boy extends JFrame
    JTextArea englishtxt;
    JLabel head,privatetxtwords;
    JButton translateengtoprivatewords;
    Container c1;
    public boy()
            super("HAKIMADE");
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setBackground(Color.white);
            setLocationRelativeTo(null);
            c1 = getContentPane();
             head = new JLabel(" English to private talk Translator");
             englishtxt = new JTextArea("Type your text here", 10,50);
             translateengtoprivatewords = new JButton("Translate");
             privatetxtwords = new JLabel();
            JPanel headlabel = new JPanel();
            headlabel.setLayout(new FlowLayout(FlowLayout.CENTER));
            headlabel.add(head);
            JPanel englishtxtpanel = new JPanel();
            englishtxtpanel.setLayout(new FlowLayout(FlowLayout.CENTER,10,40));
            englishtxtpanel.add(englishtxt);
             JPanel panel1 = new JPanel();
             panel1.setLayout(new BorderLayout());
             panel1.add(headlabel,BorderLayout.NORTH);
             panel1.add(englishtxtpanel,BorderLayout.CENTER);
            JPanel translateengtoprivatewordspanel = new JPanel();
            translateengtoprivatewordspanel.setLayout(new FlowLayout(FlowLayout.CENTER,10,40));
            translateengtoprivatewordspanel.add(translateengtoprivatewords);
             JPanel panel2 = new JPanel();
             panel2.setLayout(new BorderLayout());
             panel2.add(translateengtoprivatewordspanel,BorderLayout.NORTH);
             panel2.add(privatetxtwords,BorderLayout.CENTER);
             JPanel mainpanel = new JPanel();
             mainpanel.setLayout(new BorderLayout());
             mainpanel.add(panel1,BorderLayout.NORTH);
             mainpanel.add(panel2,BorderLayout.CENTER);
             c1.add(panel1, BorderLayout.NORTH);
             c1.add(panel2);
    public static void main(final String args[])
            boy  mp = new boy();
             mp.setVisible(true);
    }..............here is the code,please make this interface work with the code
    public class Translate
    public static void main(String [] args) throws IOException
    if (args.length != 2)
    System.err.println("usage: Translate wordmapfile textfile");
    System.exit(1);
    try
    HashMap words = ReadHashMapFromFile(args[0]);
    System.out.println(ProcessFile(words, args[1]));
    catch (Exception e)
    e.printStackTrace();
    // static helper methods
    * Reads a file into a HashMap. The file should contain lines of the format
    * "key\tvalue\n"
    * @returns a hashmap of the given file
    @SuppressWarnings("unchecked")
    private static HashMap ReadHashMapFromFile(String filename) throws FileNotFoundException, IOException
    BufferedReader in = null;
    HashMap map = null;
    try
    in = new BufferedReader(new FileReader(filename));
    String line;
    map = new HashMap();
    while ((line = in.readLine()) != null)
    String[] fields = line.split("
    t", 2);
    if (fields.length != 2) continue; //just ignore "invalid" lines
    map.put(fields[0], fields[1]);
    finally
    if(in!=null) in.close(); //may throw IOException
    return(map); //returning a reference to local variable is safe in java (unlike C/C++)
    * Process the given file
    * @returns String contains the whole file.
    private static String ProcessFile(Map words, String filename) throws FileNotFoundException, IOException
    BufferedReader in = null;
    StringBuffer out = null;
    try
    in = new BufferedReader(new FileReader(filename));
    out = new StringBuffer();
    String line = null;
    while( (line=in.readLine()) != null )
    out.append(SearchAndReplaceWordsInText(words, line)+"\n");
    finally
    if(in!=null) in.close(); //may throw IOException
    return out.toString();
    * Replaces all occurrences in text of each key in words with it's value.
    * @returns String
    private static String SearchAndReplaceWordsInText(Map words, String text)
    Iterator it = words.keySet().iterator();
    while( it.hasNext() )
    String key = (String)it.next();
    text = text.replaceAll("\\b"key"
    b", (String)words.get(key));
    return text;
    * @returns: s with the first letter capitalized
    String capitalize(String s)
    return s.substring(0,0).toUpperCase() + s.substring(1);
    }... here's the head of my pirate_words_map.txt
    hello               ahoy
    hi                    yo-ho-ho
    pardon me       avast
    excuse me       arrr
    yes                 aye
    my                 me
    friend             me bucko
    sir                  matey
    madam           proud beauty
    miss comely    wench
    where             whar
    is                    be
    are                  be
    am                  be
    the                  th'
    you                 ye
    your                yer
    tell                be tellin'

  • My calendar will no longer let me add new event or delete them, it comes up with an error saying "cannot save event, no end date set" or "event does not belong to that event store". can anyone help with this?

    my calendar will no longer let me add new event or delete them, it comes up with an error saying "cannot save event, no end date set" or "event does not belong to that event store". can anyone help with this?

    Hi,
    To configure your ODBC DataSource, go to Control Panel ---> DataSources(ODBC) (If you are in a Windows environment).
    Select the tab System DSN. If you have not added your data source, then do so by clicking on the Add button. If you have added the datasource, click on the Configure button to configure it.
    Give the datasource name, then the database name.
    You have to give the hostname, service name and server name. I guess, in most cases, the datasource name and host name will be the same, service name and server name will be the same. If you are using TCP/IP, the protocol will be onsoctcp.
    There will be a file named Services under C:\WINNT\system32\drivers\etc where you have to give the port number for accessing this server.
    It will be like this <service name> <portnumber>/tcp
    Hope this helps...
    best wishes,
    Nish

  • My iPod touch was stolen and recovered.  I can use my Apple id for this site but the theif changed the Apple id needed to update apps etc and I do not know how to delete his acct. Any help with this will be greatly

    My iPod touch was stolen and recovered.  I can use my Apple id for this site but the theif changed the Apple id needed to update apps etc and I do not know how to delete his acct. Any help with this will be greatly appreciate

    If the thief enabled activation lock on the device, then there is nothing that can be done.  Only the password for the Apple ID that it is locked with can disable activation lock.

Maybe you are looking for

  • How to process multiple images and each image has multipl links dynamically

    I saw this web site http://escience.invitrogen.com/ipath/iPath.jsp?cn=united+states&mapid=479&highlightGene=ADAM10 when the small icons in the left map is clicked, the corresponding information of the icon display on the right. For one map, I know I

  • Black Screen? Windows Installation

         I have installed windows 7 32-bit on my computer about 4-5 times so i know how to do it. Now i am installing 64-bit Windows 7 onto my school computer for Broadcasting/Video production. The new Imac 2.7GHz I5, I use bootcamp assistant to partitio

  • Want to Ignore ALE acks in PI

    folks, ve done my research on SDN prior to posting ths Q..... Scenario: Idoc-> PI Q. I am trying to turn off ale audit (acks ) for IDOCs in PI. i Keep getting ths annoying warnings in my scenarios. What 've done so Far... In PI  in the table IDXNOALE

  • SMARTFORMS - Calling one second window

    Staff, somebody knows as I make to include one second page in smartform, this second page will have different information of the first one, is trying informs to move it of income, in the first page the data go and in the other page it leaves images t

  • [Solved] wlan0 and openntpd

    Hi, i recently switched to systemd as initprocess and have a little problem with my timezone, because openntpd is started before a wlan-connection is established. Is there a workaround for this? Before using systemd i had an entry in rc.local who sta