Please Need Some Codes ?

Hello Im Beginner in Xcode
and i want from someone A code that make Playe A video File With Auto Replaying the video
i want to make a screen save App
Can you please Help Me
Thanks

Not when all you do is code-beg, no, sorry.
If that's all you're interested in, Google is your friend.
If you're a registered dev, see the samples in the center.

Similar Messages

  • Please help me... i need some code

    Hi, i am new to Java programming, but i have a dillema. I am trying to teach myself how to use Link Lists, and have been successful in the implementation, except for adding code to delete a node. If someone would please email me to help, i would really appreciate it. I will send my code i have so far, and i just need someone to write a delete method for me. Please help, i am so frustrated, i just want to see a working example. thanks. my email address is [email protected]
    Thanks in advance.

    Ok, good idea. I am writing a program that adds 7 CD objects to a LinkList, and then prints the list. Then it removes any two, and prints the list again. I have three classes though, so ill try to make it as readable as possible:
    Here is the class which sets up the Compact disc object:
    public class CompactDisc
    private String title
    // Sets up the new CompactDisc with its title.
    public CompactDisc (String newTitle)
    title = newTitle;
    // Returns this CD as a string.
    public String toString ()
    return title;
    Here is the class with the CD list:
    public class CDList
    private CDNode list;
    // Sets up an initially empty list of cds
    public CDList()
    list = null;
    // Creates a new CDNode object and adds it to the end of
    // the linked list.
    public void add (CompactDisc cd)
    CDNode node = new CDNode (cd);
    CDNode current;
    if (list == null)
    list = node;
    else
    current = list;
    while (current.next != null)
    current = current.next;
    current.next = node;
    public void delete(CompactDisc cd)
    // HERE IS WHERE I NEED THE CODE!!!!
    // Returns this list of CDs as a string.
    public String toString ()
    String result = "";
    CDNode current = list;
    while (current != null)
    result += current.compactdisc + "\n";
    current = current.next;
    return result;
    // An inner class that represents a node in the CD list.
    // The public variables are accessed by the CDList class.
    private class CDNode
    public CompactDisc compactdisc;
    public CDNode next;
    // Sets up the node
    public CDNode (CompactDisc CD)
    compactdisc = CD;
    next = null;
    And here is the Driver Class:
    public class CDRack
    // Creates a CDList object, adds several CDs to the
    // list, then prints it.
    public static void main (String[] args)
    CDList rack = new CDList();
    rack.add (new CompactDisc("The Four Seasons")); // Vivaldi
    rack.add (new CompactDisc("Caught Somewhere In Time")); // Iron Maiden
    rack.add (new CompactDisc("New York City Underground Mix")); // Louie Devito
    rack.add (new CompactDisc("Whoracle")); // In Flames
    rack.add (new CompactDisc("Straight Outa' Compton")); // NWA
    rack.add (new CompactDisc("Elegy")); // Amorphis
    rack.add (new CompactDisc("Butterfly")); // Mariah Carey
    System.out.println (rack); // initially print the entire list
    System.out.println ("Deleting a node from the list");
    // code goes here to delete a node (e.g.. rack.delete(somenode); )
    System.out.println(rack); print the list with two nodes deleted
    Please help me with this. I would prefer if someone could just add the method and corresponding call to make the program delete. Then i would observe the code, and hopefully learn something. thanks.

  • Laura, I need some code samples you mentioned...

    Laura,
    I posted a message a few days ago regarding calling Stored Procedures in my JDev 3.1 (JDK 1.2.2) BC4J application. I need to be able to call them two different ways. The first involves passing some parameters to the SP and recieving back the ResultSet. In the other instance I simply need to make a call to them to perform some tasks on the DB side. Nothing will be returned from these SP's. You discussed implementing the SQL as a VO and gave me some code showing me how I might do this. You also mentioned that it is possible to create a method on the AppMod and call this from the JSP client. I need to know which method should work best for me and to get the code samples for the second option.
    Thanks.
    Rob

    Hi,
    Here is the code I used for the custom method on my VO (same could be used from the app module rather than a specific VO). The stored procedure I am calling here performs some calculations and returns an integer value:
    public int getTotalHits(String mon, String year) {
    CallableStatement stmt = null;
    int total;
    String totalhits = "{? = call walkthru.total_hits(?,?)}";
    stmt = getDBTransaction().createCallableStatement(totalhits, 1);
    try
    // Bind the Statement Parameters and Execute this Statement
    stmt.registerOutParameter(1,Types.INTEGER);
    stmt.setString(2,mon);
    stmt.setString(3,year);
    stmt.execute();
    total = stmt.getInt(1);
    catch (Exception ex)
    throw new oracle.jbo.JboException(ex);
    finally
    try
    stmt.close();
    catch (Exception nex)
    return total;
    After adding the custom method to your appmoduleImpl.java file and rebuilt your BC4J project, do the following:
    1. Select the Application Module object and choose Edit from the context menu.
    2. Click on the Client Methods page. You should see the method you added in the Available list.
    3. Select the method and shuttle it to the Selected list.
    4. Click Finish. You should see a new file generated under the application module object node in the Navigator named appmodule.java that contains the client stubs for your method.
    5. Save and rebuild your BC4J project.
    I wrote a custom web bean to use from my JSP page to call the method on my VO:
    public class GetTotals extends oracle.jdeveloper.html.DataWebBeanImpl {
    public void render() {
    int totalhits;
    try
    Row[] rows;
    // Retrieve all records by default, the qView variable is defined in the base class
    qView.setRangeSize(-1);
    qView.first();
    rows = qView.getAllRowsInRange();
    // instantiate a view object for our exported method
    // and call the stored procedure to get the total
    ViewObject vo = qView.getViewObject();
    wtQueryView theView = (wtQueryView) vo;
    totalhits = theView.getTotalHits(session.getValue("m").toString(),session.getValue("y").toString());
    out.println(totalhits);
    } catch(Exception ex)
    throw new RuntimeException(ex.getMessage());
    I just call the render method on this custom web bean from the JSP. I am not passing parameters to the render method of the bean, but instead access the parameters I need from the session:
    session.getValue("m").toString()
    I set these session parameters from the JSP that is called when the user submits their query criteria form. For example:
    // get the view parameter from the form String month = request.getParameter("month");
    String year = request.getParameter("year");
    // store the information for reference later session.putValue("m", month); session.putValue("y", year);
    Hope this helps.

  • Need some code help please

    I am trying to make a sun and planet with the planet orbiting the sun. It is all working but the complier is having a problem with the instance variable _ball in the programs.  Can anyone help me fix this, I think I'm almost there.
    public class MovingBall extends javax.swing.JPanel
        int X0 = 100, Y0 = 100;
        double X2, Y2;
        double r = 10;
        double a = 0;
        double da = .04;
        double ecc = 1;
        double TWOPI = 2 * Math.PI;
        private javax.swing.JPanel _panel;
        public MovingBall (java.awt.Color aColor, javax.swing.JPanel aPanel)
         super();
         _panel = aPanel;
         X2 = X0 + r * Math.cos(a);
         Y2 = Y0 + r * Math.sin(a);
         //this.setLocation(X2, Y2);
        public void move()
         a = a + da;
         a = a % TWOPI;
         X2 = X0 + r * ecc * Math.sin(a);
         Y2 = Y0 + r * ecc * Math.sin(a);
         //this.setLocation (X2, Y2);
        public boolean inFront()
         return (a <= Math.PI);
        public void SetCircle(int x, int y)
         X0 = x;
         Y0 = y;
         //ecc = 1.0 - (double)pct/100;
    public class MovingBallPanel extends javax.swing.JPanel implements Mover, Controller
        private final int INIT_X = 250;
        private final int INIT_Y = 200;
        private SmartEllipse _sun;
        private Sky _sky;
        private final int SUN_DIAMETER = 60;
        //private MovingBall _ball;
        private final int PLANET_DIAMETER = 35;
        private final int ORBIT_DIAMETER = 185;
        int _da = 1;
        int _ecc = 1;
        private final int INTERVAL = 100;
        private MoveTimer _timer;
        public MovingBallPanel()
         super();
         this.setBackground(java.awt.Color.BLACK);
         _sun = new SmartEllipse(java.awt.Color.YELLOW);
         _sun.setSize(SUN_DIAMETER, SUN_DIAMETER);
         _sun.setLocation(INIT_X - SUN_DIAMETER/2, INIT_Y - SUN_DIAMETER/2);
         //_ball = new MovingBall();
         //_ball.setCenter((INIT_X - PLANET_DIAMETER)/2, (INIT_Y - PLANET_DIAMETER)/2);
         //_ball.setAngleIncrement(_da);
         _sky = new Sky();
         _timer = new MoveTimer(INTERVAL, this);
         _timer.start();
        public void move()
            //_ball.move();
            this.repaint();
        public void go (boolean g)
         //if (g) _ball.setAngleIncrement(_da);
            //else _ball.setAngleIncrement(0);
        public void setSpeed(int degrees)
         _da = 2 * degrees;
         //_ball.setAngleIncrement(_da);
        public void setEccentricity(int pct)
         _ecc = pct;
         //_ball.setEccentricity(_ecc);
        public void paintComponent(java.awt.Graphics aBrush)
         super.paintComponent (aBrush);
         java.awt.Graphics2D betterBrush = (java.awt.Graphics2D) aBrush;
         _sky.paintSky(betterBrush);
         _sun.draw(betterBrush);
         _sun.fill(betterBrush);
         //_ball.fill(betterBrush);
    }I think only those classes affect the problem. Thanks.

    They all complie separately, but when I complie PlanetApp which creates the frame it has the problem. It says it can't find the symbol for ball for all the methods that I call with it, such as ball.setEccentricity(...) or _ball.fill(...).  Here is the PlanetApp class.  Thanks.
    public class PlanetApp extends javax.swing.JFrame
        ControlPanel _controlPanel;
        MovingBallPanel _movingBallPanel;
        public PlanetApp (String title)
         super(title);
         this.setSize(600,500);
         this.setBackground(java.awt.Color.BLACK);
         this.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
         _movingBallPanel = new MovingBallPanel();
         _controlPanel = new ControlPanel(_movingBallPanel);
         this.add(_movingBallPanel, java.awt.BorderLayout.CENTER);
         this.add(_controlPanel, java.awt.BorderLayout.SOUTH);
         this.setVisible(true);
        public static void main (String [] args)
         PlanetApp app =  new PlanetApp("Lab 7");
    }

  • Please, need some help, K8n Neo2 plat. tried everything i knew how

    Ever since installing bios1.9 my computer takes forever to boot past the windows login screen. I wait like 10 minutes and then it works. Not only that, I am unable to get online. I read that I had to reflash my bios with the Nvidia mac address on the printer port and I have done so but I am still having the same problems.
    I did ipconfig/all and I have the CORRECT Nvidia mac as listed on the printer port sticker. I am at a loss. what could the problem be? It is really frustrating and I am furious at MIS for making a bios update so terrible that it would jack me up like this.
    please if anyone knows what I should do or has any suggestions, post them on here. I am clueless right now.

    Peter2x-
    You could try resetting the ACPI data - telling the BIOS you have a Plug 'n Play OS and that you want to reset the ACPI (or rescan the PnP settings).  Often these data are corrupted/reset on a BIOS flash.  There are some threads in the BIOS area regarding this, too.
    If that doesn't work, even though I hate to suggest this, you could try reinstalling Windows.  You can install to a different directory - like 'WindowsX' instead of writing over the existing install.  This will give you a choice of booting into the new install or staying with the old one (you should get a screen to choose which one when you boot after the install).
    Just speculating, the BIOS may have changed some of the settings that the Windows device drivers need and it spends a while resolving (or not resolving) these.  You could try starting up in some of the troubleshooting modes (hit F8 during early Windows boot) and look at the boot log - it might show some driver install problems.  Reading that log is a bit arcane and tedious, however.
    Another suggestion would be to go back to the previous BIOS, if you have a copy.
    If you go to the BIOS screen (DEL key on start up), do all your drives show up and are they of the correct size?  I can't guess why any should be missing but HDD problems can often result in very long boot times.  However, the wait is usually in the POST phase rather than Windows start-up.
    ss

  • Please need some assistance

    I have created a BAPI now i want to read the data from bapi..how can i do it..I have created bapi for flight data with predefined sflight db table..now i want to read the data from it pls throw some light how can i read the data in bapi..
    thanks and regards,
        omkar.
    Moderator message: please search for available information before asking, use meaningful subject lines when posting.
    locked by: Thomas Zloch on Sep 24, 2010 1:38 PM

    ya i wrote that..
    in function module i wrote SELECT statement from which it will select the defined fields but those fields doesnt have data in it now i want to put data in that field how to do that within the function module which i have created..i have created mandt,carrid,currency,seatsmax and seatocc..now without accessing sflight table i want to put data in those field...can u throw some light on it.

  • Please provide some code for my problem..Thanks

    Hi friends,
    How to pick words starting with some sort from a word document and write the data to a text file..for example
    we have many words in document starting with PGOT..
    Now i have to pickup words starting with PGOTXXXX and write to a text file..
    How to achieve this with pl/sql..
    pls provide sample code...
    Thanks in advance
    asp

    A small change in the code will work. It goes like this..
    CREATE OR REPLACE PROCEDURE rw_demo IS
    InFile utl_file.file_type;
    OutFile utl_file.file_type;
    vNewLine VARCHAR2(4000);
    StartPos number;
    EndPos number;
    searchword varchar2(100);
    BEGIN
    InFile := utl_file.fopen('CTEMP', 'in.txt','r');
    OutFile := utl_file.fopen('CTEMP', 'out.txt', 'w');
    IF utl_file.is_open(InFile) THEN
    LOOP
    BEGIN
    utl_file.get_line(InFile, vNewLine);
    StartPos := 1;
    loop
    StartPos := INSTR(vNewLine,'PGOT',StartPos);
    exit when StartPos = 0;
    EndPos := INSTR(vNewLine,' ',StartPos);
    If EndPos = 0 then
    SearchWord := substr(vNewLine,StartPos);
    ELSE
    SearchWord := substr(vNewLine,StartPos,EndPos-StartPos);
    END IF;
    end loop;
    utl_file.put_line(OutFile, searchword);
    utl_file.fflush(OutFile);
    END;
    END LOOP;
    COMMIT;
    END IF;
    utl_file.fclose(InFile);
    utl_file.fclose(OutFile);
    END rw_demo;
    If you see my solution, i have a variable EndPos will contain the position of ' ' (a space) starting from the position of the string 'PGOT'. E.g. the line is "PGOTRFG ABC". Now as per the procedure StartPos will be 1 and EndPos will be 8. So the substr() will fetch PGOTRFG. Incase if the line is "PGOTRFG" then StartPos will be 1 and EndPos will be 0 and so the substr (in if part) will fetch PGOTRFG. you got it?

  • PLEASE need some help with contacts syncing

    I am not very good at this stuff….I created a gmail account and changed the setting on my IPhone to sync with Google…i assumed that would corrcet a previous issue.
    After the sync I went into the gmail account and did not find my contacts…
    PLEASE HELP…

    Apple support could not give me that information after a very long phone conservation.
    Perhaps your enquiry was focused on a VPN issue when infact it was an FTP issue.
    Question is: Can I create a shortcut or alias on the desktop to have fast access to the root of NAS. I could only got one folder by folder as alias to the desktop, but not the NAS itself
    you can create a clickable link I use a safari to do this
    In the address bar of safari type
    smb://user:password@serveradress
    replace user:password with your actual username and pasword for that server and use the correct server address. dont press enter but click on the favicon(globe) to the left of the address and drag it to your desktop. This will make a clickable link on your desktop.

  • Please, need some help with VPN OS X 10.5.7

    Hi,
    I contacted all ready the Apple support, but they don't support VPN issues.
    So, maybe one of your can help me and point me in the right direction. At home I have an SBS Server 2003 and a NAS System. Within the local network I can access my NAS and my data on the SBS Server via the Finder without any problem. From outside via OSX VPN connection I can access all data with Filezilla, running under OSX. But with the own Apple OSX Server connection ftp:\\192.168.XXX.XXX I have only the rights to read. And only if I connected via VPN. With smb:\\192.168.XXX.XXX I can read and write via VPN connection, but it is much too so slow for useage.
    Is there any thing I can do to get it work, or does I have to use further Filezilla to get the job done.
    By the way, when I connect from Windows XP on parallels via VPN I can read and write fils thru the windows explorer. Only the Finder in OSX gives me this trouble.
    thx

    Apple support could not give me that information after a very long phone conservation.
    Perhaps your enquiry was focused on a VPN issue when infact it was an FTP issue.
    Question is: Can I create a shortcut or alias on the desktop to have fast access to the root of NAS. I could only got one folder by folder as alias to the desktop, but not the NAS itself
    you can create a clickable link I use a safari to do this
    In the address bar of safari type
    smb://user:password@serveradress
    replace user:password with your actual username and pasword for that server and use the correct server address. dont press enter but click on the favicon(globe) to the left of the address and drag it to your desktop. This will make a clickable link on your desktop.

  • Macrofor insert some codes

    hi,
    when i started to a new project i need some codes in
    occasionally. for
    example a key control codes or tween codes. how can i do this
    via
    macro/commands.
    for example ,
    when i decided to use tween, I have to enter help, find tween
    and copy them
    and then past it to project. instead of this, i want to use
    one click like
    "commands"
    import mx.transitions.Tween;
    var myTween:Tween = new Tween(img1_mc, "_x",
    mx.transitions.easing.None.easeNone,0, Stage.width, 4, true);
    myTween.onMotionFinished = function() {
    myTween.yoyo();
    how can i do this?regards.Burak

    You can create a black picture and insert it on the appropriate place on the timeline.
    Take a look here: http://helpx.adobe.com/premiere-pro/using/creating-special-clips-synthetics.html#create_bl ack_video
    Regards
    Axel

  • Functional Module:Need  some sample source code.

    Hi All,
    I have created  a customized table   u2018ZStock_Order_Dealeru2019 with the following fields:
    Stock_Order_Dealer
    Dealer Number
    S2D order Number     
    Line item Number     
    Material Number     
    Ordered Quantity     
    Batch Number     
    Received Quantity     
    S2D from D2G     
    Receiving Date
    I need to  create a remote enabled function module in CRM system to fetch the u2018Batch Numberu2019 and u2018Received Quantityu2019 fields when the Material Number is fed to it.Please note that the input and output should be tables.
    Could some one please give some sample source code for this.

    I used table types and select queries to resolve this problem.

  • Please I need some help with a table

    Hi All
    I need some help with a table.
    My table needs to hold prices that the user can update.
    Also has a total of the column.
    my question is if the user adds in a new price how can i pick up the value they have just entered and then add it to the total which will be the last row in the table?
    I have a loop that gets all the values of the column, so I can get the total but it is when the user adds in a new value that I need some help with.
    I have tried using but as I need to set the toal with something like total
        totalTable.setValueAt(total, totalTable.getRowCount()-1,1); I end up with an infinite loop.
    Can any one please advise on some way I can get this to work ?
    Thanks for reading
    Craig

    Hi there camickr
    thanks for the help the other day
    this is my full code....
    package printing;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.print.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.text.DecimalFormat;
    public class tablePanel
        extends JDialog  implements Printable {
      BorderLayout borderLayout1 = new BorderLayout();
      private boolean printing = false;
      private Dialog1 dialog;
      JPanel jPanel = new JPanel();
      JTable table;
      JScrollPane scrollPane1 = new JScrollPane();
      DefaultTableModel model;
      private String[] columnNames = {
      private Object[][] data;
      private String selectTotal;
      private double total;
      public tablePanel(Dialog1 dp) {
        dp = dialog;
        try {
          jbInit();
        catch (Exception exception) {
          exception.printStackTrace();
      public tablePanel() {
        try {
          jbInit();
        catch (Exception exception) {
          exception.printStackTrace();
      private void jbInit() throws Exception {
        jPanel.setLayout(borderLayout1);
        scrollPane1.setBounds(new Rectangle(260, 168, 0, 0));
        this.add(jPanel);
        jPanel.add(scrollPane1, java.awt.BorderLayout.CENTER);
        scrollPane1.getViewport().add(table);
        jPanel.setOpaque(true);
        newTable();
        addToModel();
        addRows();
        setTotal();
    public static void main(String[] args) {
      tablePanel tablePanel = new  tablePanel();
      tablePanel.pack();
      tablePanel.setVisible(true);
    public void setTotal() {
      total = 0;
      int i = table.getRowCount();
      for (i = 0; i < table.getRowCount(); i++) {
        String name = (String) table.getValueAt(i, 1);
        if (!"".equals(name)) {
          if (i != table.getRowCount() - 1) {
            double dt = Double.parseDouble(name);
            total = total + dt;
      String str = Double.toString(total);
      table.setValueAt(str, table.getRowCount() - 1, 1);
      super.repaint();
      public void newTable() {
        model = new DefaultTableModel(data, columnNames) {
        table = new JTable() {
          public Component prepareRenderer(TableCellRenderer renderer,
                                           int row, int col) {
            Component c = super.prepareRenderer(renderer, row, col);
            if (printing) {
              c.setBackground(getBackground());
            else {
              if (row % 2 == 1 && !isCellSelected(row, col)) {
                c.setBackground(getBackground());
              else {
                c.setBackground(new Color(227, 239, 250));
              if (isCellSelected(row, col)) {
                c.setBackground(new Color(190, 220, 250));
            return c;
        table.addMouseListener(new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
            if (e.getClickCount() == 1) {
              if (table.getSelectedColumn() == 1) {
       table.setTableHeader(null);
        table.setModel(model);
        scrollPane1.getViewport().add(table);
        table.getColumnModel().getColumn(1).setCellRenderer(new TableRenderDollar());
      public void addToModel() {
        Object[] data = {
            "Price", "5800"};
        model.addRow(data);
      public void addRows() {
        int rows = 20;
        for (int i = 0; i < rows; i++) {
          Object[] data = {
          model.addRow(data);
      public void printOut() {
        PrinterJob pj = PrinterJob.getPrinterJob();
        pj.setPrintable(tablePanel.this);
        pj.printDialog();
        try {
          pj.print();
        catch (Exception PrintException) {}
      public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException {
        Graphics2D g2 = (Graphics2D) g;
        g2.setColor(Color.black);
        int fontHeight = g2.getFontMetrics().getHeight();
        int fontDesent = g2.getFontMetrics().getDescent();
        //leave room for page number
        double pageHeight = pageFormat.getImageableHeight() - fontHeight;
        double pageWidth =  pageFormat.getImageableWidth();
        double tableWidth = (double) table.getColumnModel().getTotalColumnWidth();
        double scale = 1;
        if (tableWidth >= pageWidth) {
          scale = pageWidth / tableWidth;
        double headerHeightOnPage = 16.0;
        //double headerHeightOnPage = table.getTableHeader().getHeight() * scale;
        //System.out.println("this is the hedder heigth   " + headerHeightOnPage);
        double tableWidthOnPage = tableWidth * scale;
        double oneRowHeight = (table.getRowHeight() +  table.getRowMargin()) * scale;
        int numRowsOnAPage = (int) ( (pageHeight - headerHeightOnPage) / oneRowHeight);
        double pageHeightForTable = oneRowHeight *numRowsOnAPage;
        int totalNumPages = (int) Math.ceil( ( (double) table.getRowCount()) / numRowsOnAPage);
        if (pageIndex >= totalNumPages) {
          return NO_SUCH_PAGE;
        g2.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
    //bottom center
        g2.drawString("Page: " + (pageIndex + 1 + " of " + totalNumPages),  (int) pageWidth / 2 - 35, (int) (pageHeight + fontHeight - fontDesent));
        g2.translate(0f, headerHeightOnPage);
        g2.translate(0f, -pageIndex * pageHeightForTable);
        //If this piece of the table is smaller
        //than the size available,
        //clip to the appropriate bounds.
        if (pageIndex + 1 == totalNumPages) {
          int lastRowPrinted =
              numRowsOnAPage * pageIndex;
          int numRowsLeft =
              table.getRowCount()
              - lastRowPrinted;
          g2.setClip(0,
                     (int) (pageHeightForTable * pageIndex),
                     (int) Math.ceil(tableWidthOnPage),
                     (int) Math.ceil(oneRowHeight *
                                     numRowsLeft));
        //else clip to the entire area available.
        else {
          g2.setClip(0,
                     (int) (pageHeightForTable * pageIndex),
                     (int) Math.ceil(tableWidthOnPage),
                     (int) Math.ceil(pageHeightForTable));
        g2.scale(scale, scale);
        printing = true;
        try {
        table.paint(g2);
        finally {
          printing = false;
        //tableView.paint(g2);
        g2.scale(1 / scale, 1 / scale);
        g2.translate(0f, pageIndex * pageHeightForTable);
        g2.translate(0f, -headerHeightOnPage);
        g2.setClip(0, 0,
                   (int) Math.ceil(tableWidthOnPage),
                   (int) Math.ceil(headerHeightOnPage));
        g2.scale(scale, scale);
        //table.getTableHeader().paint(g2);
        //paint header at top
        return Printable.PAGE_EXISTS;
    class TableRenderDollar extends DefaultTableCellRenderer{
        public Component getTableCellRendererComponent(
          JTable table,
          Object value,
          boolean isSelected,
          boolean isFocused,
          int row, int column) {
            setHorizontalAlignment(SwingConstants.RIGHT);
          Component component = super.getTableCellRendererComponent(
            table,
            value,
            isSelected,
            isFocused,
            row,
            column);
            if( value == null || value .equals("")){
              ( (JLabel) component).setText("");
            }else{
              double number = 0.0;
              number = new Double(value.toString()).doubleValue();
              DecimalFormat df = new DecimalFormat(",##0.00");
              ( (JLabel) component).setText(df.format(number));
          return component;
    }

  • Please Need to Modify code. Help please.

    Ok you see this code here, it works perfectly for just 1 budgie class but I edited the budgie class and made it an array list with more than one budgie. How would I change the simulator code so it can support more than one budgie?
    import java.util.Random;
    public class Simulator
        // Instance variables
        private Cage cage;
        private int numberOfDays = 0;
        private Random r;
         // To die in 3 days, budgie must lose 50g body weight overall.
        public static final int DAILY_EXERCISE = 18; //PR
         * Constructor for objects of class Simulator
         * @param budgieCage, the cage on which to run the simulation.
        public Simulator(Cage budgieCage)
            cage = budgieCage;
            r = new Random();
        public void simulateDay(int amtFeed)
            //a new Day
            numberOfDays++;
            System.out.println("**************************");
            System.out.println ("Day : " + numberOfDays);
            if(!cage.isEmpty())
                    // Ask the cage to supply its budgie object
                    Budgie theBudgie = cage.getBudgie();
                    /* Check there really is a Bird in the cage. null means that there is no
                     * bird object assigned to the myBudgie variable in class cage.
                    if(theBudgie != null)
                       // Code moved from below.  PR
                       // Budgie gets older because a day has gone by.                     
                       theBudgie.incAge();
                       // Budgie exercises every day PR
                       theBudgie.exercise(DAILY_EXERCISE);
                        // Feed the budgie
                        // To avoid feeding nothing, check that food is given PR
                        // Also rejects negative feed!
                        if(amtFeed > 0)
                            theBudgie.eat(amtFeed);
                            System.out.println("Just been fed " + amtFeed + " grams of bird seed");
                        // Check if the budgie is still alive
                       if(theBudgie.isDead())
                            System.out.println(theBudgie.getName() + " just died...sob");
                            System.out.println("Here lies " + theBudgie.getName() + " this budgie was much loved by its " +
                                                   theBudgie.getNumEggsLaid() + " eggy ofspring");
                            cage.removeBudgie();
                        // If alive is it overweight?
                        else if(theBudgie.isObese())
                            System.out.println(theBudgie.getName() + " is obese it needs some exercise");
                            theBudgie.exercise(10);
                        else // Budgie is alive and not overweight
                            System.out.println(theBudgie.toString());
                           // The budgie gets a day older
                           // theBudgie.incAge(); // Moved to above PR
                            // The budgie may lay an egg                   
                            if(theBudgie.layEgg(r))
                                System.out.println(theBudgie.getName() + " has just laid an egg ");
                                System.out.println("The egg has been removed from the cage for artificial incubation \n"
                                                      + "and will be adopted out after hatching");
                else  // No budgie in the cage
                   System.out.println("The cage is empty");
         * Simulate several days without food.
         * @param numDays, the length of the simulation
        public void simulateDays(int numDays)
            for(int i = 0; i < numDays; i++)
                simulateDay(0); // PR
         * Simulate several days with food.
         * @param numDays, the length of the simulation
         * @param amtFeed, the amount of budgie food in grammes
        public void simulateDays(int numDays, int gmsSeed)
            for(int i = 0; i < numDays; i++)
                simulateDay(gmsSeed);
    Please your help would be greatly appreciated. If you need more infor just ask
    Message was edited by:
    gggman

    As the requirements of your application increase you will end up with an messy bit of code that no one including you can read. The long term solution to this is to redesign application cleanly using proper design patterns (Do a google search and read about theses).
    A quick solution would be, in keeping with the current trend in your design is to introduce another method that would take multiple simulation objects and iterate through theme. It would be better if you introduce a new class to do this. Here is an example.
    class MultiSimulator{
        Collection<Simulator> sims;
        MultiSimulator(){
            sims = new HashSet<Simulator>();
        MultiSimulator(Collection<Simulator> sims){
           this.sims = sims;
        //other constructors as you need theme
        boolean addSim(Simulator sim){
            return sims.add(sim);
        boolean addSim(Cage budgieCage){
            return sims.add(new Simulator(budgieCage));
        boolean removeSim(Simulator sim){
            return sims.remove(sim);
          *Simiulate only one day
        void simulateAll(){
        void simulateAll(int days){
            //use for loop and iterator
        void simulate(Simulator sim){
        void simulate(Simulator sim,int days){
        // and any other methods you can think of
    }

  • Need some help for this code.

    Hi Everyone,
    I've test codes for east region and west region.
    I've a requirement to replace the west test id with east test id.
    That mapping has been done by the onshore team, I've got the mapping doc.
    But updating these details is a tricky part. It's nothing like direct update and replace those test codes.
    As per the mapping if it's
    In case of one to one (East - West) mapping which going to affect only a single row, I’ll have to update there,directly.
    In case of one – many (East - West) mapping and which is going to affect multiple rows, I’ll have to update the latest one and rest will be deleted only in that group. To identify the latest we have to check the latest order detail for that test.
    Suppose I've a west code named W123 and it has to be replaced with E123, in this case direct update.
    But now I've a transaction table where a patient has ordered multiple tests, In this case suppose the
    patiend id is P123 and ordered tests are W123, W234, W345; I'll have to update W123 as E123 and rest
    should not be deleted.
    But if I'll get multiple west code mapped towards single east code, the latest record as per the order detail needs
    to be updated and rest needs to be deleted if mapped with multiple west test codes, for single record and group record as well. Some thing like this.
    E123 - W123, W234 so I'll have to find out the latest and update there accordingly for single record and now
    patient has orderd multiple tests and the group record is like P123(patient) -----has orederd for W123, W234, W345.
    Now only the lastest test code suppose W234 has to be replaced with E123 and W123 has be deleted and W345
    should be there with E123.
    Now please see the code.
    CREATE OR REPLACE
    PROCEDURE P_UPDATE_TEST_ID AS
    V_EAST_TEST_ID            TEST_CODE_CONVERSION.EAST_TEST_ID%TYPE;
    V_ARRAY                   VARCHAR2(4000);
    V_COUNT                   NUMBER := 0;
    BEGIN
      FOR I IN (SELECT EAST_TEST_ID
                      ,STRAGG(WEST_TEST_ID) AS V_STRING
                FROM TEST_CODE_CONVERSION
                GROUP BY EAST_TEST_ID)
      LOOP
        V_EAST_TEST_ID            := I.EAST_TEST_ID;
        V_ARRAY                   := I.V_STRING;
        V_COUNT                   := V_COUNT+1;
        DBMS_OUTPUT.PUT_LINE('EAST_TEST_ID = ' ||V_EAST_TEST_ID|| ' || '||
                             'WEST_TEST_ID = ' ||v_array);
        Now after this I need to segregate the string values and check individual record
        and group record as well, for update. Now If I'll add the regexp_substr, then how
        to map those extracted values for checking.
      END LOOP;
      DBMS_OUTPUT.PUT_LINE('v_count = ' ||V_COUNT);
    END P_UPDATE_TEST_ID;Please suggest something.
    Regards,
    BS2012.
    Edited by: BS2012 on May 23, 2013 4:40 PM

    Hi Bawer,
    Thanks for your interest, but I've done that yesterday.
    Bawer wrote:
    Sorry, but
    >
    Here I'll have to check which one is the latest and update that with relative east test id ...
    >how do you describe the *'latest'* and *'relative east'* ?We have one more template table where we'll have to take the max of template_test_id to figure out "which one is the latest?" To identify the relative east we have a parent table named "test" from there we can find the relative test ids by the column name called East_west_ind (indicator); as per the mapping.
    and depending to this,
    >
    ... rest one has to be deleted and other should be untouched.
    >which one is here, in your sample to be deleted and which should be untouched?
    (maybe a sample after-update output?)If you see the patient id 93, we have number of tests has been ordered. But 3257, 3515 test ids are same as per the mapping. So we need to check the max of template_test_id to figure out "which one is the latest?" as we have one entry in template table always for a new order. In terms of that I'll have to update 3257 as it's the latest entry and 3515 has to be deleted and rest of the test ids should be untouched. I did it yesterday, but i couldn't respond you. Thanks once again for your interest.

  • Hello please i need some information about the blackberr...

    hello please i need some information about the blackberry instant messenger is how does it work , i heard that i send messages for free from a blackberry to a blackberry is it true ? does it need internet ? and does it matter if the other phone is in another country'
    thank you alot

    Hello,
    Here is a page with much information about BBM:
    http://na.blackberry.com/eng/devices/features/im/blackberry_messenger.jsp
    Hope that helps! If not, Please come to:
    http://supportforums.blackberry.com/rim/
    and register an account. Then post to the applicable forum.
    Thanks!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

Maybe you are looking for

  • Mosaic problem with image after Yosemite

    I'm using CS6 (13.0.6) on my iMac and recently upgraded to Yosemite.  I'm now getting a problem where images will suddenly either go black or get a weird mosaic/jigsaw type of look.  In the example below, the "source" images used in the mosaic were f

  • Numbers 3.1 restricting the period for moving average trend lines

    Numbers 3.1 is restricting the period I can specify for a moving average trend line for a scatter plot series. The max is 6. This limitation was not present in the previous version of Numbers. Charts imported from the previous version retain larger p

  • Adobe Flash Player - Green Screen and Jumbled Audio Issue

    I currently have gotten my new PC and I watched to watch some videos online. Some sites like youtube I seem to have no issues, but with others. The video will work till random points and then suddenly it will start to go green screen. The audio will

  • Camera app locks up phone.  Any resolution for this issue?

    When start camera it locks up phone, can't shut if off or take pictures.  Have to remove battery in order to shut it down.  Any ideas how to resolve this issue?

  • Dbconsole has wrong listener listed

    We switched from a listener named LISTENER10G to LISTENER, but my dbconsole still reflects LISTENER10G which no longer exists. Can anyone help me correct this?