Carbon programming books? Should i bother?

Hi all.
Ive been developing in C++ for 3 years (non-mac platform) I have justed invested some cash into some Apple gear (for music and video production).
I wish to port over and create C++ based applications for the Mac. Now, I've had a look at Cocoa, bought a basic guide to the programming language and to be honest, the syntax is very foreign to C++ (please don't get me wrong, Cocoa has excellent librarys, structures and visual interface) but i feel that im learning a new complete language, in which i dont have much time.
Now, ive had a look at Carbon programming interface, i feel more at home using the Carbon syntax therefore have decieded to move to Carbon instead of Cocoa.
Ive done a few search's but to be honest i cant find basic reading material. So therefore can anyone advise me on books, tutorials (online)?
And one more thing, I keep my code up-to-date with the latest standards, meaning INTEL?
As a i have a PowerMac (IBM), will the code have to be re-written to the Intel platform?
Any advice would be great.
Thanks in advance.

Now, ive had a look at Carbon programming interface,
i feel more at home using the Carbon syntax therefore
have decieded to move to Carbon instead of Cocoa.
Ive done a few search's but to be honest i cant find
basic reading material. So therefore can anyone
advise me on books, tutorials (online)?
And one more thing, I keep my code up-to-date with
the latest standards, meaning INTEL?
As a i have a PowerMac (IBM), will the code have to
be re-written to the Intel platform?
Sadly, there have been no Carbon programming books published since 2002. Your best bet is to go to Mac Tech magazine's site (www.mactech.com). It has an electronic version of a Carbon programming book. The book is about 5 years old, and Carbon has undergone many changes since then, but there's not much else available.
I think you'd be better off going with Cocoa. You can write the user interface in Cocoa and the rest of your code in C++. Learning Objective C takes less time than learning Carbon by wading through Apple's documentation and reading the Carbon header files.
Carbon and Cocoa will run on both Intel and PowerPC Macs if you use Xcode 2.1 and above and build your program with the Universal SDK, which comes with the Xcode Tools. Reading data from files is the main area of your code you'll have to worry about due to the endian differences between Intel and PowerPC processors.
  Mac OS X (10.4)  

Similar Messages

  • I have made with iweb a website on my macbook, now i want to change it, through my imac, how can I get in the program , which is on the mac book. On both computer I have Lion

    i have made with iweb a website on my macbook, now i want to change it, through my imac, how can I get in the program , which is on the mac book. On both computer I have Lion

    You need to transfer your domain.sites file from your MacBook to your iMac.  This is the file where iWeb stores all info and can be found under User/Library/Application Support/iWeb/domain.sites.
    Transfer this file from your MacBook to the same place on your iMac and double click the domain.sites file and iWeb will open it on your iMac and you can update your site from there too.

  • Program should execute both for F8 and F9

    Hi All,
    I have a requirement that my program should execute both for F8 and F9.
    I have developed it as a report as the selection-screen contains 'Select-Options' and they want the Multiple Selection Button.
    I know that if I develop it as a Module pool, my problem is very easily solved.
    But since they want the Multiple-Selection button for Select-options which we cannot provide in a Module-Pool I am forced to develop a report.
    Please let me know if its possible to execute the program with both F8 and F9 function keys, while F8 can be the normal execute button, there is no need of any button for F9, that is a F9 key press is enough. The Report should execute if the user presses F8 or F9 key on the Key-board.
    Hope I am clear.
    Please help me with your suggestions.
    Thanks in Advance.
    Edited by: Dagny on Apr 1, 2009 6:57 AM

    Hi, Dangy
    I dont think you can do with f9 fkey,
    but you can do with ctrl+f9 , if ur client like this..
    this are some available FKeys.
    Freely assigned function keys
    F5
    F6
    F7
    F8                             ONLI       Execute
    Shift-F1                       DOCU       Program Documenta...
    Shift-F6                       SCRH       Selection Screen ...
    Shift-F7                       ALLS       All Selections
    Shift-F8                       FEWS       Chosen Selections
    Shift-F9
    Shift-Ctrl-0
    Shift-F11
    Shift-F12
    Ctrl-F1                        FC01       <SSCRFIELDS-FUNC...>
    Ctrl-F2                        FC02       <SSCRFIELDS-FUNC...>
    Ctrl-F3                        FC03       <SSCRFIELDS-FUNC...>
    Ctrl-F4                        FC04       <SSCRFIELDS-FUNC...>
    Ctrl-F5                        FC05       <SSCRFIELDS-FUNC...>
    Ctrl-F6                        LVUV       User Variables...
    Ctrl-F7
    Ctrl-F8
    Ctrl-F9
    Ctrl-F10
    Ctrl-F11
    Ctrl-F12
    Ctrl-Shift-F1
    Ctrl-Shift-F2
    Ctrl-Shift-F3
    Ctrl-Shift-F4
    Ctrl-Shift-F5
    Ctrl-Shift-F6
    Ctrl-Shift-F7
    Ctrl-Shift-F8
    Ctrl-Shift-F9
    Ctrl-Shift-F10
    Ctrl-Shift-F11
    Ctrl-Shift-F12
    Just execute ur program, and go to system>status->in SAP data , there is GUI status-> dbl clik in ur gui status and assign Fcode for ctrl+f9 and handle the same in user command.
    I hope it will solve ur problem.

  • I don't know anything about programming! What books should I read to start?

    I am a complete beginner in programming, but I really wanna code something. So I was thinking: What books should I read to start Cocoa-ing? I don't wish to just choose some book by random and take the risk that it might suck or be to old. All online courses I've found require some previous coding experience (except CocoaLab's one, but it seems to me that it doesn't cover the coding well enough).
    Should I read 'The C Programming Language, 2nd edition, by Brian Kernighan and Dennis Ritchie' (I've got an access to that book) and then some book that covers Objective C and then some book about Cocoa, or what? What about the 'Dummies' book, is it any good?
    Thank you!

    Two books are working well for me (I determined to learn Cocoa in March '08), *Programming in Objective-C* by Kochan (2nd Ed.), and *Cocoa Programming For Mac OS X* by Hillegass (3rd Ed.). Kochan's book is extremely good to learn about classes, objects, and general syntax, and assumes absolutely no programming background. There is nothing in there about XCode or Interface Builder. Hillegass' text is good, but really designed for those that have some programming experience and covers some introductory Interface Builder topics as well. It is labor-intensive, though, and to really get the most out of it, you need A LOT of time and a quiet place to work.
    I still refer to the CocoaLab document for some things, and there are a number of blogs on learning different aspects of Cocoa out there as well. They are not always easy to find; cocoa, xcode, and then specific NSxxxx class names are the terms that give the best Google results. I have seen rumors that Kochan's book will have a new edition later in the year to cover some of the Objective-C 2.0 topics.
    Good Luck,

  • HT204150 I have a Mac 10.5.8 op system.  My Contacts do not syn with I cloud.  Trying to get my address book complete on both systems and now I have lots of duplicates on I cloud adress book.  How do I efficiently merge the duplictes that are now on I clo

    I have a Mac 10.5.8 op system.  My Contacts do not syn with I cloud.  Trying to get my address book complete on both systems and now I have lots of duplicates on I cloud adress book.  How do I efficiently merge the duplictes that are now on I cloud?

    You cannot use iCloud with Leopard 10.5.8. The minimum requirement is Lion 10.7.2. If you have been syncing your contacts with iCloud you can only have been doing it by some sort of unsupported hack, and if it doesn't work it's unlikely to be possible to find an explanation. If you have been using other (compliant) devices by trying to sync using both iTunes and iCloud you are likely to get duplicates.
    A computer old enough running Leopard may well not be upgradeable to Lion or Mountain Lion, but if you can do so this is the only way you are going to be able to make proper use of iCloud.
    The requirements for Lion are:
    Mac computer with an Intel Core 2 Duo, Core i3, Core i5, Core i7, or Xeon processor
    2GB of memory
    OS X v10.6.6 or later (v10.6.8 recommended)
    7GB of available space
    To purchase it you will have to ring Apple at the number given at the bottom left of this page.
    The requirements for Mountain Lion are listed here:
    http://www.apple.com/osx/specs/
    It is available from the Mac App Store (in Applications). (If you are currently pre-Snow Leopard you will have to upgrade to that to access the Mac App Store: it's available in the online Apple Store.)
    You should be aware that PPC programs (such as AppleWorks) will not run on Lion or above; and some other applications may not be compatible - there is a useful compatibility checklist at http://roaringapps.com/apps:table

  • Help with a program book ad page

    Hello,
    I have finished creating an ad for a program book and I cannot get it to either print right or when I did get it to do right I now have a right margin going into the crease and I have my ad going over the 1/4 margins on the bottom.
    First I set up a 8.5 in by 5.5 in page size (size of program book) because I am only going to be using 1/2 of that page for my ad. I finished my design, then printed it out. My design came out landscape on the page, rather than upright portrait on the page. Obviously I think Im getting its because of the way it wants to print it.  There are not many choices given in the print options for telling it to print a certain way (at least I cant find it).
    Now, after messing with that a few times, I somehow finally got it to print at the top left of my paper (it actually doesnt matter if its at the top or bottom).  When I fold it to 8.5 in x 5.5 in and fold the book in half I can see its not set up correct.  I am not sure if its on my end or if its the printer again.  The right margin runs into the spine of my paper (or crease) and the bottom of my ad has run over the middle crease. My left margin is at least 1/2" away from the left edge of my paper. I need my ad to be 1/2 the page of a 8.5in x 5.5 in page. The ad's are sold as a full page or 1/2 page.
    My page set up is as a document.  Its set as Page Size: Letter - 1/2 (I did not set this?), width 5.5 in and height 8.5 in, orientation is Portrait. I do have a bleed, but I dont need it and ignore it.  Ive started my ad at the top Margin lines, but I made ad short of the right margin, so as to leave room near the inside crease where it would be stapled. I did not set up these margin lines and not sure how to change it. When I added my background artwork, I pulled it down till it turned PINK so that I would know where the middle of the page is. But my ad prints over this.
    I am needing this ad to be at least 1/2" away from the top, left and right margin of the page and pretty close to the 1/2 page mark, but not over.  Do i make sense?
    Now, just a little back ground. Ive designed program books in the past using Publisher.  I designed a whole program book, cover to cover and I had very little issues doing it.  Now I am using InDesign for the first time to do this and struggling a bit here.  The printing of stuff from ID is also driving me nuts. Im not liking the way ID prints and if I tell my Epson printer how to print, it doesnt work and continues to give me crappy outputs.
    Any help would be appreciated.  I need to turn this in tonight, but i cant turn in a camera ready printout if its not printing out correctly.
    Thank you,
    Tina

    NeverWasBefore wrote:
    So, whatever is the easiest way for her to get this ad, so that she doesnt somehow mess it up.
    You really can't control for that. If she doesn't know what she's doing, you could send her a technician with a brand new printer, and she could do it wrong. The best you can do is to communicate to her what you intend, and hope she can pull it off. I'd send a PDF set to the final size with the margins, and one without the margins. When she opens them, she will see something like this:
    This is a screenshot from Acrobat showing the white document size against the black background that represents what is outside of the document. You can see the amount of white space that surrounds the image area (the placeholder type), so you know how much border you intended.
    Now, your InDesign document is half-letter size (5.5x8.5). If you subtract the amount of margin you used (in my example, I used .5" on all sides), you have the size of the image area (my example has a 4.5x7.5 image area). You can make a new InDesign document the size of your image area (4.5x7.5) and place the PDF that has the margins (like in the screenshot above) onto the page and position it so that the image area lines up with the document page borders, as you can see in this screenshot:
    You can see the blue InDesign image frame with the handles, which is the size of the half-letter PDF, and the image area contained within the document border, which is the black stroke that you normally see in InDesign. Don't worry about the magenta inner margin—that could be set to anything, and isn't in play here. In order to position the placed PDF into the new 4.5x7.5 InDesign document, when you place the PDF, check the Show Import Options box in the Place window. that will bring up a new screen after you select which image you are placing and you hit the OK button. The screen looks like this:
    In the Options section, change the Crop to from Bounding Box (Visible Layers only) (which should be the default choice) to Art, and you will see the dotted line that represents the size of the image change to include the margins.
    Now, when you place the image, just set the position proxy (which looks like this: ) to the top left corner and in the X and Y fields, enter the negative of the amount of margin you have. Since I used .5" margins, I set X and Y to -.5" each, and that aligned the image area of the larger PDF to the document borders of the smaller InDesign document. You could just eyeball it in if you want, but this way you can be a little more sure you aren't cutting off a hair of some of your image area.
    If you export that document to PDF, it will look like this:
    …which the person who will be putting this together will probably use, since it will be easier to place into something like Publisher or Word because it is smaller than a half page (an image that is larger than the document will probably be reduced in size to fit automatically—something that Word does, and maybe Publisher does that too, but I don't use Publisher so I don't know). How She positions it within the page is up to her, and not something you can control unless you are in the room with her, so it's a crapshoot. She could also use the PDF with the margins if it works better for her, but all you can do is explain to her what you are sending and what you would like.

  • Text should appear  both in chinese and english language in smartform-Urgen

    Hi All,
    In my requirement in smart form, the standard text and values to be printed should appear both in english and chinese language.
    When my login language is EN(English), I cannot able to see the chinese text , but only the english text.
    If login in Chinese language, I can able to see the both the Chinese and English text in print preview, even then in printout the chinese text is missing.
    Please let me know what will be the problem.
    What printer i can use to get both chinese and english text.
    Thanks in advance
    Saravana

    Hi
    See the attached 2 OSS notes for your problem
    OSSNote:960341
    Symptom
    In some device types (e.g HPLJ4, HPLJ5) you experience non-uniform character spacing in the PDF document after the PDF conversion of SAPscript or Smart Forms documents, using HELVE or TIMES fonts. You want to know the reason.
    Other terms
    CONVERT_OTF, SAPscript, Smart Forms
    Reason and Prerequisites
    The problem is not due to an error in the PDF converter but due to the fact, that the printer font, underlying the device type (e.g. Univers or CG Times in PCL-5 device types), is not available for the PDF converter and is either not available in Adobe Reader. The PDF converter has to try to simulate the layout of the printer font by means of a font which is predefined in Adobe Reader. This is done by assigning the letter widths of the printer font to the font used in Adobe Reader.
    The PDF file contains a table with letter widths, used by Adobe Reader in the output of text, for each used printer font (except PostScript fonts).
    Example:
    %Charwidth values from HP4300 HELVE 060 normal
    /Widths
    [ 278 333 500 633 633 1000 758 333 333 333 633...
    Adobe reader converts this width table, by modifying the space between each character, so that the specified letter width (= space between the current and the next letter) is kept.
    This 'Simulation' of printer fonts results in the sometimes visible irregular spaces in PDF.
    The PDF converter always uses the Helvetica Adobe PostScript font for the display of HELVE and the Times Roman Adobe PostScript font for the display of TIMES. However, for these Adobe PostScript fonts, Adobe Reader often uses a Windows TrueType font, which differs slightly from the original PostScript font.
    Solution
    Workaround: Use the POST2 PostScript device type or the PDF1 PDF device type for the PDF conversion of documents in the Latin-1 character set. They both use the Adobe PostScript fonts Helvetica or Times Roman for the HELVE/TIMES printer fonts.
    Header Data
    Release Status: Released for Customer
    Released on: 30.06.2006  12:44:06
    Priority: Recommendations/additional info
    Category: Consulting
    Primary Component: BC-CCM-PRN Print and Output Management
    Secondary Components: BC-SRV-SCR SAPscript
    OSS Note: 776507
    Symptom
    Documents printed via SAPscript or SmartForms do not print with correct special characters, e.g. ### prints instead of Japanese or Russian characters. What to do?
    Other terms
    SAPscript, SmartForms, printing, device types, OTF
    Reason and Prerequisites
    Help required to choose proper fonts in a SAPscript or SmartForm
    Solution
    When using SAPscript or SmartForms to print (or email or fax) a form from a business application, many factors influence the outcome of the actual text within the form. All these factors must be checked in order to ensure a correct printout:
    1) The language version of the form used to produce the printout.
    Example: If you want to print a French invoice, you need to have a FR version of your SAPscript or SmartForms invoice form RVINVOICE01. And the application program must specify the corresponding language key (FR) when calling the SAPscript or SmartForms API.
    2) The font selections specified in the form (possibly also in a SAPscript style or SmartStyle used in a form).
    Example: In a SAPscript form or a SmartStyle you need to specify HELVE if you want to print German text in Helvetica (or similar) font. If you want to print Japanese text, HELVE is not a valid choice but you need to specify a Japanese font like JPMINCHO in your Japanese form.
    3) The output character set of the device type
    Every printer in transaction SPAD has a "device type" assigned. Device types used by the spooler for printing support only one single specific output character set. All text from the form has to be converted (using SAP's built-in character conversion mechanism) to this output character set.
    A character set can typically support either a single language (e.g. Shift-JIS which supports only Japanese) or a set of languages (e.g. ISO 8859-1, which supports Western-European languages). It is possible that a given language (such as German) can be supported by several output character sets, e.g. you may use either ISO 8895-1 (Latin-1) or ISO 8859-2 (Latin-2) to represent German text. This is so because both character sets contain the special characters used in German.
    Example: HPLJ4000 is a HP LaserJet device type supporting the ISO 8859-1 (Latin-1) character set. ISO 8859-1 can be used to represent e.g. Dutch, English, French, German, Spanish, Swedish but NOT Russian or Japanese.
    As a consequence, it is ok to use HPLJ4000 to print English, German French etc. but not for Japanese or Russian.
    4) The set of available printer fonts for a given device type
    When formatting a document, SAPscript and SmartForms perform an automatic mapping of the font definitions in the form (e.g. "HELVE 14 point bold") and the available printer fonts of the device type. A replacement printer font is chosen, should the specified font selection not be available in the device type. Now this replacement can be problematic if a language-specific font, such as Chinese CNSONG, is specified in a form and it gets replaced by a font which does not support this language, e.g. COURIER.
    To solve this problem, font families in SE73 have language attribute assigned, e.g. some fonts are characterized as being suitable only for certain languages. And when a replacement has to be chosen because the original font from the form is not available in the device type, a replacement font is chosen which has the same language attributes.
    If no fonts for the language in question exist in the device type, the resulting font will not be able to print the special characters and you will see "wrong" output characters in the printout.
    Note on SAPscript/SmartForms Print Preview:
    The OTF Print Preview available in Windows GUI (e.g. from transaction SP01) will sometimes not show the "wrong" characters which appear on the final printout. Here is the reason: since the Print Preview runs in Windows environment, it will use Windows fonts to represent the actual printer fonts. A Windows font typically has more available characters (i.e. covers more character sets) than are actually available in a printer's resident font.
    A typical example where the Print Preview will differ from the printout is here: if you have a Chinese PCL5 printer such as CNHPLJ4 and use the Western Latin font COURIER in your document, the print preview will show you Chinese characters if you (by accident) tried to format Chinese characters in COURIER font. This is because Windows will automatically choose a font that can output Chinese characters (which is actually not Courier). But when you print the job on an actual PCL5 printer with resident Western and Chinese fonts, the Courier font will not print any Chinese characters but Western special characters instead, because the printer's resident Courier font does not include Chinese characters.
    Rule of thumb: all Asian device types (e.g. CNHPLJ4, JPHPLJ4, JPPOST, KPHPLJ4) support not only Asian fonts but also COURIER, HELVE and TIMES fonts. But these Latin fonts can only be used to print English text, not Chinese/Japanese/Korean characters.
    Which fonts are suitable for a given language?
    Language(s):            Font family to use in a form:
    Latin-1 (Western Europe/Americas) *******
    DE,EN,FR,ES,NL,SV       COURIER, HELVE, TIMES
                            (LETGOTH, LNPRINT)
    Latin-2 (Central Europe) ****************
    PL, CZ                  COURIER, HELVE, TIMES
    ISO 8859-4 (Baltic) *********************
    ET, LT, LV              COURIER, HELVE, TIMES
    ISO 8859-5 (Cyrillic) *******************
    BG, RU, SR, UK          COURCYR, HELVCYR, TIMECYR
    ISO 8859-7 (Greek) **********************
    EL                      COUR_I7, HELV_I7, TIME_I7
    ISO 8859-8 (Hebrew) *********************
    HE                      COURIER, HELVE, TIMES
    ISO 8859-9 (Turkish) ********************
    TR                      COURIER, HELVE, TIMES
    Simplified Chinese **********************
    ZH                      CNHEI, CNKAI, CNSONG
    Japanese ********************************
    JA                      JPMINCHO, DBMINCHO, DBGOTHIC
    Korean **********************************
    KP                      KPBATANG, KPDODUM, KPGULIM
                            KPGUNGSE, KPSAMMUL
    Traditional Chinese *********************
    ZF                      TWDPHEI, TWMING, TWSONG
    Thai ************************************
    TH                      THANGSAN, THDRAFT, THVIJIT
    Arabic (Unicode systems only) ***********
    AR                      ANDALE_J
    Verify your output by examining the OTF data
    When analysing printing problems of this type, be sure to check the OTF data which gets produced by SAPscript or SmartForms. OTF or "Output Text Format" is the intermediate page-description format generated from SAPscript or SmartForms. OTF will contain the final printer font names and character set/language identifiers which help to solve the problem. OTF will even name the form and the language of the form used to create the output.
    The easiest way to do this is to create a spool request from your application, run transaction SP01, use menu
    Goto->Display Requests->Settings
    and choose
    Display Mode: Raw
    Now display your spool request. If this is a SAPscript or SmartForms spool request, you will see OTF data. Each line represents one OTF command, every command starts with a 2-character cmd identifier and possibly some cmd parameters follow.
    Here is an excerpt from a sample OTF file where we highlight the most interesting commands:
    //XHPLJ8000    0700 00000000001
    IN04EALEXTEST_ZEBRA
    IN05%PAGE1
    OPDINA4  P 144  240 1683811906000010000100001
    IN06%WINDOW2
    MT0024401289
    CP11000000E
    FCHELVE  120  00109XSF100SF101110000067E X
    UL +0000000000000
    SW00067
    CT00000000
    ST0453037Dieses SF hat Stil ALEXTEST_ZEBRA mit
    The 1st line with the // (Control) command reveals the device type usedto print: HPLJ8000
    //XHPLJ8000    0700 00000000001
    The 2nd line (IN = Info command) shows the name and (internal 1-char)language key of the form:
    IN04EALEXTEST_ZEBRA
    In this case it is the English (E = EN) SmartForm ALEXTEST_ZEBRA
    The OP-line (OP = Open Page) gives the page format used in the form, it is DINA4 Portrait orientation:
    OPDINA4  P 144  240 1683811906000010000100001
    The CP (CodePage) cmd shows the SAP system codepage used to code the text and the active language. In our case it is codepage 1100 and language E = EN = English.
    CP11000000E
    Finally, the FC-cmd (Font Call) lists a printer font selected within SmartForms. Please note that every SmartForm has a designated default SmartStyle under "Form Attributes->Output Options". In addition, every text node can have a SmartStyle attached (which will override the definitions from the default style for the text). In our case the resulting printer font that was selected is HELVE 12.0 pt bold-off, italic-off.
    FCHELVE   120  00109XSF100SF101110000067E X
    Header Data
    Release Status: Released for Customer
    Released on: 22.08.2005  09:57:20
    Priority: Recommendations/additional info
    Category: Customizing
    Primary Component: BC-CCM-PRN Print and Output Management
    Secondary Components: BC-SRV-SCR SAPscript
    BC-SRV-SSF Smart Forms
    reward if useful
    regards,
    ANJI

  • Subtle bug in Deitel & Deitel "Java How to Program" book

    Merry x mas and happy new year, guys.
    I have this applet (which is at the same time runnable and listener) its printed in Deitel & Deitel "Java How to Program" book 3rd ed.
    The program works but as you turn on and off the "suspend" checkboxes some of the threads are not notified, so they go to infinite wait state, deadlock. I couldn't figure out what is wrong or how to fix the problem.. please read the code below, or copy and paste this code to your eclipse, its just one file, then play with the check boxes, some of the threads don't wake up after wait... technically they don't shift from WAITING to TIMED_WAITING state.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    * @author
    // Fig. 15.7: RandomCharacters.java
    // Demonstrating the Runnableinterface
    public class RandomCharacters extends JApplet implements Runnable, ActionListener {
        private String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        private JLabel outputs[];
        private JCheckBox checkboxes[];
        private final static int SIZE = 3;
        private Thread threads[];
        private boolean suspended[];
        public void init() {
            outputs = new JLabel[SIZE];
            checkboxes = new JCheckBox[SIZE];
            threads = new Thread[SIZE];
            suspended = new boolean[SIZE];
            Container c = getContentPane();
            c.setLayout(new GridLayout(SIZE, 2, 5, 5));
            for (int i = 0; i < SIZE; i++) {
                outputs[i] = new JLabel();
                outputs.setBackground(Color.green);
    outputs[i].setOpaque(true);
    c.add(outputs[i]);
    checkboxes[i] = new JCheckBox("Suspended");
    checkboxes[i].addActionListener(this);
    c.add(checkboxes[i]);
    public void start() {
    // create threads and start every time start is called
    for (int i = 0; i < threads.length; i++) {
    threads[i] = new Thread(this, "Thread " + (i + 1));
    threads[i].start();
    public void run() {
    Thread currentThread = Thread.currentThread();
    int index = getIndex(currentThread);
    char displayChar;
    while (threads[index] == currentThread) {
    // sleep from 0 to 1 second
    try {
    Thread.sleep((int) (Math.random() * 1000));
    synchronized (this) {
    while (suspended[index]
    && threads[index] == currentThread) {
    wait();
    } catch (InterruptedException e) {
    System.err.println("sleep interrupted");
    displayChar = alphabet.charAt(
    (int) (Math.random() * 26));
    outputs[index].setText(currentThread.getName() + ": " + displayChar);
    System.err.println(currentThread.getName() + " terminating");
    private int getIndex(Thread current) {
    for (int i = 0; i < threads.length; i++) {
    if (current == threads[i]) {
    return i;
    return -1;
    public synchronized void stop() {
    // stop threads every time stop is called
    // as the user browses another Web page
    for (int i = 0; i < threads.length; i++) {
    threads[i] = null;
    notifyAll();
    public synchronized void actionPerformed(ActionEvent e) {
    for (int i = 0; i < checkboxes.length; i++) {
    if (e.getSource() == checkboxes[i]) {
    suspended[i] = !suspended[i];
    outputs[i].setBackground(
    !suspended[i] ? Color.green : Color.red);
    if (!suspended[i]) {
    notify();
    return;
    Thanks in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Abiel wrote:
    No, notifyAll() is used to tell the threads that we're stopping.... see that it's written in the stop() method of the applet. Eg if the user browses away from our applet we set the array of threads to null and notify them all. So notifyAll() makes sense.Yes, it does make sense there too (!!!!!!!).
    However, I gave it a try with what u suggested, and it didn't work (as expected) .... Apparently you did not really read my suggestion or my explanation. If you had, you'd have expected it to work and it would have worked.
    the problems still remains, some threads are getting in wait state even if their check box is not suspended.Maybe you should add the following code to understand the root cause and solution.
        System.out.println("Thread " + index + " will wait to be notified.");
        wait();
        System.out.println("Thread " + index + " was notified.");
    what could the problem be?Improper use of notify()
    With kind regards
    Ben

  • I have a mac book pro that both USB ports have stopped working one about a year ago and one recently. Is it possible to connect to another one of the other MBP's  ports with a cord that ends with a USB port?

    I have a mac book pro that both USB ports have stopped working one about a year ago and one recently. Is it possible to connect to another one of the other MBP's  ports with a cord that ends with a USB port?

    Thank you For your time and thoughts!
    I went by the Apple Store and they told me that there was a "Flat Rate" repair service for this particular part where they would replace the logic board along with the USB ports for $350. Seems like best avenue. All of this would have been moot but my wifi in the computer also doesn't work so I was using my phone as a hot spot and tethering it to the computer for Internet access when the last port quit. This left me with no internet and no printing capabilities on the computer I use for my business. Basically became a nice paperweight. lol
    They will ship it off Monday and I should have it back Thursday!
    Again, thank you!

  • HT201413 I am receiving a message saying the iPod "TRACER's iPod" can not be synched. The required file can not be found. I ran the iTunes program repair and restarted both the computer and the iPod. Any suggestions on what else to try?

    I am receiving a message saying the iPod "TRACER's iPod" can not be synched. The required file can not be found. I ran the iTunes program repair and restarted both the computer and the iPod. but still receive the same message. Any suggestions on what else to try?

    That can sometimes be caused by a damaged ipod photo cache.
    If you remove the current ipod photo cache, does that get you past the error?
    For instructions on where to find it, see the following document:
    iTunes: Understanding the iPod Photo Cache folder

  • Java Programming Book Recommendation

    I'm looking for a good java programming book that covers more than the basics. In my CS110 class we went through the book:
    Java Programming - From Problem Analysis to Programming Design
    by: D.S. Malik
    I'm looking to expand upon this and was hoping someone was able to point me in the right direction of reading material.
    Thanks!

    Sun's basic Java tutorial
    Sun's New To Java Center. Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    http://javaalmanac.com . A couple dozen code examples that supplement The Java Developers Almanac.
    jGuru. A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    Bruce Eckel's Thinking in Java (Available online.)
    Joshua Bloch's Effective Java
    Bert Bates and Kathy Sierra's Head First Java.
    James Gosling's The Java Programming Language. Gosling is
    the creator of Java. It doesn't get much more authoritative than this.

  • Selection screen program name should be grayed out.

    In the selection screen ,  i need the program name to be displayed
    like
    program  :  ZZ_PROGRAM
    number :    input box.
    calculation is got to be done based on the input number.
    Without using screen painter i have to create using
    the parameter or any other abap statements.
    The program name should be grayed out.
    name of the program should be in the box (as we do for parameters)
    Please suggest how to achieve this
    Thanks

    Hi,
    PARAMETERS : p_text(50) MODIF ID 'ABC',
                               p_number TYPE I.
    INITIALIZATION.
       p_TEXT = 'YOUR PROGRAM NAME'.
    AT SELECTION SCREEN OUTPUT.
    LOOP AT SCREEN.
      IF screen-NAME = 'P_TEXT'
         SCREEN-INPUT = 0.
          MODIFY SCREEN.
      ENDIF.
    ENDLOOP.

  • At every startup, Mac mini desktop freezes for 10 mins before I can start any program, what should I do?

    At every startup, Mac mini desktop freezes for 10 mins before I can start any program, what should I do? The mouse cursor can move around, but the icons are not responding at all. Can't click on anything during the "freezing" period, and this "freezing" happened with every startup. Waking up from sleep mode is OK. Also the systems crashed frequently with any flash-player required pages in web browser. What's wrong??

    Hey,
    Repair Disk permisions...
    Applications > Utilities > Disk utility > Select your Mac OS Hard Drive on the left > Click Repair Permissions.
    Jason

  • What book should I read to learn J2ee!!

    i find that j2ee turorial is a hell of mess!!there's not enough real sample code out there,definition is vague,is there any one who can tell me which book should i turn to or in what way should i familiarize myself with J2ee
    thanks!

    thanks,english is my second language,my native is
    chinese,so there may be errors!!No errors really. It's a little irritating to the eyes when there are no spaces after the comma or full stop. It's almost similar to writingasentencewithoutspacesinitthatmaynotbeintendedtoirritatesomeonebutitdoeseventually.
    is there any book which concentrate on real project?It depends on what your real project is going to use. You can start by looking at the introductory J2EE text and decide which part of J2EE you want to start with. Servlets and JSP are usually the easiest to start with.

  • What iOS Developer Program license should be used?

    What iOS Developer Program license should be used for the following scenario: our company wants to develop an app to be distributed among employees, our subsidiaries, our service/sales partners (distributors of our products) and finally end-users. The app is primarily aimed at end-user of our product.  We don't want to provide that app via the iTunes App store to general public , but rather only to users, that are well-known to our company or to our sales/service partners.  These users already have one of our products.
    Is such a scenario feasible at all? Comparing iOS Developer and iOS Developer Enterprise it looks like applications can be distributed either through the App Store or through enterprise deployment limited to a company's employees only. Please advise. Thanks!

    If you can reach these forums here, you can reach those links.
    Apps for employees...Enterprise Program.
    Everything else....Individual Program. See the App Store Review Guidelines for iOS Apps for restrictions and cases where apps may be rejected, otherwise.

Maybe you are looking for