Question about Validation Timing in SAXParser.

Hi,
I'm using the SAXParser (9.0.4) in validating mode against a DTD. When I tried to catch validation errors
using the ErrorHandler interface, I saw the ErrorHandler methods are called back at the end of the parse process (after the enddocument event).
Is there anyway to change this behaviour. I need to know the erronious cases during the parse not once it is finished.
When I plugged Xerces in place of Oracle's parser it behaved as expected.
Thanks in advance
Emre

Hi Deepak,
Here is the case I have written using your sample.
As you will see from the output, the error callback
is not called in sync with the error position.
Other parsers I have tried report the expected
output. Is there a mistake I have done?
Thanks for your efforts.
Regards.
Emre
-- test.xml -------------------------------------
<!DOCTYPE test SYSTEM "test.dtd">
<test>
<elm/>
<elm num="1">
<name>element 1</name>
</elm>
<elm num="2">
<name>element 2</name>
</elm>
</test>
-- test.dtd -------------------------------------
<!ELEMENT test (elm+)>
<!ELEMENT elm (name)>
<!ATTLIST elm num CDATA #REQUIRED>
<!ELEMENT name (#PCDATA)>
-- test.java ------------------------------------
import oracle.xml.parser.v2.*;
import org.xml.sax.*;
import java.io.*;
import java.net.*;
public class test
class Validator extends HandlerBase
private String startElement = null;
private Exception exception = null;
public void startElement(String element,
AttributeList attributes)
startElement = element;
System.out.println("START : " + element);
public void error(SAXParseException e)
exception = e;
System.out.println("ERROR : " + e.getMessage());
public void run() throws Exception
SAXParser parser = new SAXParser();
Validator handler = new Validator();
parser.setErrorHandler(handler);
parser.setDocumentHandler(handler);
parser.setValidationMode(true);
parser.parse("file:/c:/test.xml");
public static void main(String[] args)
throws Exception
test t = new test();
t.run();
-- output ---------------------------------------
START : test
START : elm
START : elm
START : name
START : elm
START : name
ERROR : file:/c:/test.xml<Line 3, Column 8>: XML-0138: (Error) REQUIRED attribute 'num' is not specified.
ERROR : file:/c:/test.xml<Line 3, Column 8>: XML-0150: (Error) Element elm not complete, expected elements '[name]'.
-- expected output ------------------------------
START : test
ERROR : file:/c:/test.xml<Line 3, Column 8>: XML-0138: (Error) REQUIRED attribute 'num' is not specified.
START : elm
ERROR : file:/c:/test.xml<Line 3, Column 8>: XML-0150: (Error) Element elm not complete, expected elements '[name]'.
START : elm
START : name
START : elm
START : name

Similar Messages

  • Question about validating xml against schema

    Hi,
    I am new to JAXP. I try to validating a xml against a schema. I wrote following code:
    SAXParserFactory spf = SAXParserFactory.newInstance();
    spf.setNamespace(true);
    spf.setValidating(true);
    SAXParser sp = spf.newSAXParser();
    sp.setProperty("http://java.sun.com/xml/properties/jaxp/schemaLanguage",
    "http://www.w3.org/2001/XMLSchema");
    sp.setProperty("http://java.sun.com/xml/properties/jaxp/schemaSource",
    "mySchema.xsd") ;
    sp.parse(<XML Document>, <ContentHandler);
    but when compile, it has error: can't resolve ""http://java.sun.com/xml/properties/jaxp/schemaLanguage", and
    "http://java.sun.com/xml/properties/jaxp/schemaSource".
    It seems it didn't support above two property.
    I saw some code in forum is:
    fact.setFeature("http://xml.org/sax/features/validation", true);
    fact.setFeature("http://apache.org/xml/features/validation/schema",true);
    fact.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);
    SAXParser sp = fact.newSAXParser();
    sp.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",schemas);
    Why sun tutorial use property:http://java.sun.com/xml/properties/jaxp/schemaLanguage
    and someone use:http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation
    where to get information about setting properties for SAXParserFactory?
    Thanks

    In the past, ColdFusion's XML validation mechanism seems to have had issues with schemas that contain imports, e.g., http://forums.adobe.com/message/155906. Have these issues still not been resolved?
    Do you not think that perhaps you're answering your own question here?
    I don't see an issue about this on the bug tracker.  It might be an idea if you can get a simple, stand-alone repro case together and raise an issue (and post the reference back here and against that other thread so people know to vote for it).  If you post the repro case here too, it would be helpful.
    Adam

  • New to the product - question about validating multiple fields as a group

    I have a static form that I'm building from a word document.  Part of that form requires a person to fill any 3 out 5 text fields.
    Since it looks like scripts are applied on a field by field basis, is it possible to have a script that encompasses multiple fields? 
    Would any script need to be applied to each field in turn?
    Assuming the answer to question 1 is a yes, how would you script it to require x number of fields out of a total of y to have some sort of content in order to validate?
    I'm pretty familiar with JavaScript and am looking at the Scripting reference guides but was hoping for a helping hand to get me there quicker as I'm in a bit of a time crunch - doing 18 forms with validation and database connectivity by January 15 certainly qualifies in my book.
    I would assume you'd do something like this but am unsure of the syntax...
    Get values of each field
    Set a valid counter variable for the number of fields with content
    If field 1 is not empty, increment the valid counter
    (rinse and repeat)
    if the valid counter is less than 3 throw an error message
    Many thanks in advance for any help offiered

    1). Yes, scripting within Livecycle can be for a single field or even static text, images and other artifacts within the PDF. Really anything, within Adobe's reason, when it comes to scripting.
    2). It depends on what you want to do. Things like field validations, calculations and other instances where fields are tied togther really dictate how the script runs.
    3). Fields that have calculations or validations with them work in the same, I believe. So for example I have a PDF that I made that is an Excel-type sheet that contains a few hundred cells and every single one has some type of validation or calculation associated with it. I generally run the calculations/validations from the user inputting the data and then after that the script runs, but again, it really dpeneds on what you are doing and with what, so answering some of your questions are a bit difficult.
    Javascrip/Formcalc are wonderful tools within PDF, but don't forget the Action Builder (Tools -Action Builder). It is a set of preloaded actions that are turn-key. Just select the cells that will have the action and select the result you want from the preloaded list of actions, using those actions can get you very far, and most of all; they are quick to implement without researching code. So for example, you could use the Action Builder to create an action that checks certain fields and if they are null to return a 1 value to a specific numericField (these could be hidden). Then have a "total" numericField (this would be your counter) that adds all of those fields with the 1 in it. Then create another Action Builder for that "total" numericField and if it is less than 3, display a message box that is a warning.

  • I have questions about audio timing and volume levels

    I have a question regarding editing the audio timing. There are a few section in my clip that the rythym is a split second off. What technique can I use to sync up the time by just a fraction of a second?
    so far I've tried use the re-time editor which I thought was gonna work but after I re-timed the section, I couldn't drop it back into place without having the lower clip change and make things more confusing, but I had a feeling I was doing thing right for a second. Was I on the right track or is there another way of doing this?
    on another note...
    I have some sections in my clip that are peaking in the red, but sound fine on my computer even at full volume. I hear no distortion at all. Does this pose as a problem, and should I re-adjust?
    how to connect cuts in final cut pro 

    This is actually a somewhat complicated subject. There are actually several different kinds of sync issues. Two major "classes": 1) some audio seems to speed up or slow down over time compared to other audio, and 2) audio that just needs to be aligned in time.
    One of the biggest culprits for sync issues is mixed bitrates. A typical FCPX project should default to an audio bitrate of 48kHz.  If you have 44.1kHz (or other bitrate) clips, mixed in, the first thing you should do is make sure all your audio clips are conformed to your project.
    Select your clips and then select:
    [Note: when retiming clips, even if only slightly, make sure Preserve Pitch is selected.]
    If that doesn't work, or your audio is "live" recordings and you'd like to tighten up performers timing a little, you can manually sync audio tracks to each other. (You should have at least one audio "track" with the best timing to be your "beat track".)
    The idea is to find the events you need sync'd in the audio waveforms; which means listening and seeing the pattern in the waveforms (turning on "scrubbing" helps); and you should find these indicators as close to the end of the clip as possible (you will need to zoom into the clips to see them clearly enough and you will need room to access the retiming slider on one of the clips... so... near the end is best.)
    Zoom into the audio clip on the storyline so you can see the waveform clearly, but not so far as to lose detail in the "subsample" range -- to start (it's very difficult to distinguish specific peaks if you zoom in too far.)
    With the audio clip selected and the playhead placed on the start of the "event" (bass beat, tom/snare hit, cymbal, etc.) type the M key to set a marker (markers on audio clips can be set on subsamples, so it will be "inside" a single video frame range.)
    On corresponing clips that you want to sync with the "master" clip, do the same thing: select the clip, find the corresponding "event" start for that clip, move the playhead to the beginning of the event (you might have to zoom in [command- +] on the storyline one or two times more to improve the resolution), type M to set a marker.
    You now have two markers you can align by retiming one (or more) of the clps to match the "master". Use the playhead and have it 'snap' to the master's marker.  When you retime the others, visually align their markers to the master's by using the playhead as a visual indicator for alignment.
    This technique can be used with video and audio that has gone out of sync, by finding the visual indicators of a specific sound in the video, setting a marker to mark the start of that event, then finding the audio event and setting a marker. You will need to detach the audio from the video first if you're going to work on it in this way.
    It's even easier to sync audio if there are no retiming issues (that is, you just need to align clips, not retime them.) Find the position markers as in the description above (anywhere in a clip since retiming is not necessary), turn on snapping, drag one of the clips until the markers snap... and you're done. You don't even need to use the playhead to have the markers snap to alignment with each other. Very convenient for adding foley/sound effects to video.
    HTH

  • Question about RAM timing etc. on MSI P965 Platinum ? 4th question

    Hi.
    Just board new Cellshock mem. Now i want to chance the default DRAM voltage on the board from 1.90v to the
    spcific ram (mem) setting. They are 4-4-4-12 2.1 to 2.2v
    But the voltage settings is grayed out. How to chance it to 2.2v
    thx

    Quote from: MuggeGHQ on 03-March-07, 07:00:13
    Found out now. Thx buddy
    But maybe you can help me out with another thing 
    My new ram is Cellshock  DDR2 800 2GB kit standard for the ram is 4-4-4-12 2.1 - 2.2v
    What i did in the bios for now was.
    Disable the thing you just said (cant remember what you called it) and set it manualy to 4-4-4-12
    Then back to cell menu and set the FSB to standard 266 first. And the ram to 800 and 2.0v
    Now in the CPU-Z it shows 400Mhz /  2:3  /  3-4-4-12  /  2T
    Is that a good setting or ? i tought it would say 4-4-4-12 when i adjusted it to it manually.
    I heard these ram could go op to around 1200Mhz ..  Damn. its true.
    So could you point me in the right direction.
    thx man
    There is a flaw in the BIOS that when you manually set the latencies in the BIOS it does not set properly. You can change the DRAM Voltage (Vdimm) with it set to SPD by using page up / down on that field. I think DDR2 800 will show up as 400 mhz in CPU-Z. I will check later.

  • Had to change my Apple ID because the original email address is no longer valid.  How do I change the iCloud user name on iMac?  I found instructions about signing out of iCloud and signing back end.  It asks questions about contact, etc.

    Had to change Apple ID due to email address no longer valid.  Trying to change id for icloud...saw direction online about signing out of icloud and signing back in...when it ask questions about contacts, photos, etc. being deleted how do I answer those?  That just sort of freaks me out.

    For the ones that give you an option, select the option you want (keep on the Mac or Delete). For the ones that are simply warning you, click on Delete from Mac.
    They will all come back when you sign back on, since all you did was change your existing Apple ID to a new email address. It's the same iCloud account, just with a different name.
    It's the only way to get your updated ID signed onto iCloud.
    Cheers,
    GB

  • Questions about 3702i and WSM (WSSI)

    I have several questions about the 3702i AP and the WSM that do not seem to be answered in the data sheets/documentation.
    Any insight would be appreciated.
    1. Is the WSM officially supported on the 3702 AP? The documentation seems to conflict on this.
    For example, at the top of the WSM data sheet: "Flexible add-on third radio module for the Cisco Aironet 3600i or Cisco Aironet 3600e Series Access Points". Then later on in the page graphic shows the 3700 series radios too. I have found multiple pages that have similar conflicting information.
    2. Can the WSM be used WITHOUT MSE and Cisco Prime? If so, are there any limitations?
    3. How does the licensing work? Where is the license installed -- WLC, MSE, Prime? Do ANY of the features work without the license?
    3a. How do you order the license? The SKU listed on the data sheet (L-WIPS-MM-1AP) is not a valid part number in CCW.
    4. Is it possible to do sniffing with a WSM? (the idea being not having to dedicate an AP to sniffing, or taking down a client-serving AP to sniff)
    Thank you.

    Ok, so you are talking about off-channel scanning, which is actually a very short duration 50ms, that the AP is actually off-channel to scan.
    http://mrncciew.com/2013/03/16/configuring-rrm/
    Are you thinking of this bullet point?
     Access points with wireless security module: The Cisco Aironet® Access Point Module for Wireless Security aggressively scans all channels without affecting the data-serving radios in the 2.4- and 5-GHz bands.
    To me, that's just saying that the WSM is scanning and not interferring with the AP's normal radios.
    HTH,
    Steve

  • Legality questions about Home Sharing

    I have some legality questions about Apple's Home Sharing technology.
    As I understand it, you can share (that is, copy it from one computer to another) your music, movies, applications and other iTunes-managed files amongst five computers. The only 'trick' is that each computer must have an iTunes Store account and must be logged in in order for it to work.
    My question concerns the copying aspect and the legality of it. For content that was purchased through the iTunes Store I can see how Home Sharing can provide a limitation on content sharing, since all of the machines would need to be connected to Apple's servers in order for the validation process to happen. But what about content that was added to iTunes through other means, e.g., ripping my own CDs or converting my DVDs? These items can still be copied via Home Sharing and as there's no DRM on them there's no way they can be protected against "illegal" or "unauthorized" use.
    It was my understanding that if I gave a copy of a song to someone else, that's illegal. Apple's Home Sharing technology seems to facilitate this action. If I rip a CD or DVD into iTunes and someone copies it out, isn't that making an illegal copy? Can I be held liable for distribution of content?
    And how far does this extend? If I live in a house with four unrelated people, are they legally (?) allowed to copy music and media amongst each another? Is there a perceived or actual difference between using Home Sharing to copy a movie versus, say, using a USB flash drive? And what if one of them moves out? Am I legally obligated to go through that person's hard drive and remove content that they copied from me before they leave the building?
    Does Home Sharing somehow retroactively change the copyright application on a given CD or DVD? Most of my CDs and DVDs contain notices and warnings against distributing copies. Can these warnings now be ignored, or at least amended with "...unless you're using iTunes Home Sharing" at the ends of them?
    I am not trying to stir up a hornet's nest here. I'm only trying to better understand the legal issues surrounding Home Sharing and particularly how they relate to unprotected content. It seems very contradictory that the RIAA and MPAA would be fighting so hard against peer-to-peer services like BitTorrent and Gnutella while apparently allowing peer-to-peer services through iTunes Home Sharing.
    Furthermore, I also understand that the intention of this system was to allow families who are living together to have common access to all of the "household" music, but my issues aren't about this. I envision, for example, a college dorm building where there's several hundred people living together on the same network subnet, and all of them have Home Sharing enabled and everyone is copying thousands and thousands of songs to/from one another. Is this now legal?
    Any insights would be appreciated. Thanks.

    If I rip a CD or DVD into iTunes and someone copies it out, isn't that making an illegal copy?
    RIPping of commercial, encrypted DVDs (most of them) is illegal to begin with. Or rather, breaking the encryption on a DVD is illegal and in order to RIP the DVD, you must break the encryption. SO you have already "broken the law" by having a copy on your computer.
    Most of my CDs and DVDs contain notices and warnings against distributing copies.
    Most of your DVDs have a notice about even simply making a copy, not only distributing copies.
    Much of your post has been cussed and discussed by many, many people (lawyers, corporations, organizations, individuals, etc.) and no one has come (or likely ever will come) to a complete agreement.
    Generally, "sharing" in the same house hold amongst family members seems to be okay. Outside the same household/family is almost always not okay.
    I envision, for example, a college dorm building where there's several hundred people living together on the same network subnet, and all of them have Home Sharing enabled and everyone is copying thousands and thousands of songs to/from one another. Is this now legal?
    No.
    This is exactly what Napster was and why they were sued & shut down.
    I imagine Apple lawyers have done their homework as well as consulted with the labels to discuss these exact issues.
    And it's called "Home Sharing" to indicate that it is not "Dorm Sharing" or "Workplace Sharing", or even simply "Library Sharing"etc. even though it may be possible to use it in other places than the Home.
    Users on other computers need to know your iTunes ID and password to enable it Home Sharing. Likely this is how Apple got the lables to be okay with it.
    Are you gonna give (and get) dozens/hundreds/thousands/any other users your iTunesID & password?
    You can contact Apple Legal here -> http://www.apple.com/legal

  • Question about Kurts comments discussing the seperation of AIA & CDP - Test Lab Guide: Deploying an AD CS Two-Tier PKI Hierarchy - Kurt L Hudson MSFT

    Question about the sentence in bold. What is the meaning behind this comment?
    How would you separate the role of the AIA and CDP from a CA subordinate server? I can see where I add a CES and CEP server which has those as well, but I don't completely understand his comment. Because in this second step, (http://technet.microsoft.com/en-us/library/tlg-key-based-renewal.aspx)
    he shows how to implement CES and CEP.
    This is from the guide located at: http://technet.microsoft.com/library/hh831348.aspx
    Step 3: Configure APP1 to distribute certificates and CRLs
    In the extensions of the root CA, it was stated that the CRL from the root CA would be available via http://www.contoso.com/pki. Currently, there is not a PKI virtual directory on APP1, so one must be created.
    In a production environment, you would typically separate the issuing CA role from the role of hosting the AIA and CDP.
    However, this lab combines both in order to reduce the number of resources needed to complete the lab.
    Thanks,
    James

    My concern is, they have a 2-3k base of xp systems, over this year they are migrating them to Windows 7. During this time they will also be upgrading hardware for the existing windows 7 machines. The turnover of certificates are going to be high, which
    from what I've read here, it worries me.
    http://blogs.technet.com/b/askds/archive/2009/06/24/implementing-an-ocsp-responder-part-i-introducing-ocsp.aspx
    The application then can go to those locations to download the CRL. There are, however, some potential issues with this scenario. CRLs over time can get rather large
    depending on the number of certificates issued and revoked. If CRLs grow to a large size, and many clients have to download CRLs, this can have a negative impact on network performance. More importantly, by
    default Windows clients will timeout after 15 seconds while trying to download a CRL. Additionally,
    CRLs have information about every currently valid certificate that has been revoked, which is an excessive amount of data given the fact that an application may only need the revocation status for a few certificates. So,
    aside from downloading the CRL, the application or the OS has to parse the CRL and find a match for the serial number of the certificate that has been revoked.
    With the above limitations, which mostly revolve around scalability, it is clear that there are some drawbacks to using CRLs. Hence, the introduction of Online Certificate
    Status Protocol (OCSP). OCSP reduces the overhead associated with CRLs. There are server/client components to OCSP: The OCSP responder, which is the server component, and the OCSP Client. The OCSP Responder accepts status
    requests from OCSP Clients. When the OCSP Responder receives the request from the client it then needs to determine the status of the certificate using the serial number presented by the client. First the OCSP Responder determines if it has any cached responses
    for the same request. If it does, it can then send that response to the client. If there is no cached response, the OCSP Responder then checks to see if it has the CRL issued by the CA cached locally on the OCSP. If it does, it can check the revocation status
    locally, and send a response to the client stating whether the certificate is valid or revoked. The response is signed by the OCSP Signing Certificate that is selected during installation. If the OCSP does not have the CRL cached locally, the OCSP Responder
    can retrieve the CRL from the CDP locations listed in the certificate. The OCSP Responder then can parse the CRL to determine the revocation status, and send the appropriate response to the client.

  • A Question about RAW and Previews

    I have just recently starting shooting in RAW (mostly for the post production editing abilities - I am an avid amateur photographer bent on learning as much as I can). I set my camera to capture in RAW + L. I don't know why I feel like I want it to capture both the RAW and JPEG file, and thus leads me to my first question: Is it necessary to have the camera capture both the RAW and Large JPEG? I am assuming the answer to be no, as I am sure if after importing the RAW file into Aperture, you could always export a JPEG if you wanted one? So no need to fill up your internal memory (if using managed masters) with the extra JPEG? Is this thinking correct?
    Next, if you do import RAW-only files and then want to export certain images, do you have a choice to export the original RAW image? It seems that it only allows you to export a JPEG Original Size. To answer my own question, perhaps you have to export the Master in order to export the full RAW file when exporting? If you want to export a JPEG, you have to export not the Master, but a version of the Master? Is this correct?
    Lastly, I wanted to ask a question about Previews. I have my preferences set so that previews have the highest quality with no limits to size. What is the significance of setting it this way? I just assumed that if I wanted to share an image at the highest quality without exporting it, this was the way to go. Is there any validity to this? The reason I ask is that I don't want to have all of these high quality previews taking up internal disk space if I really don't need to. Is there a way to change the preview size once previews are created? Meaning, if you have it set to generate low quality previews, can you change it dynamically to high and vice versa?
    I know this is a lot in one post. Thanks for tackling it.
    Mac

    You can change the quality of the Previews in the Preferences -> Previews tab.
    You can regenerate Previews with the Delete and Update Previews under the Images menu.
    Regards
    TD

  • Question about setup_MITE in the PCI-MIO-16E-1

    I have a quick question about setup_MITE in the PCI-MIO-16E-1. In one of the manuals, it states that if you're using Dell Optiplex GX series for our hardware configuration, is it true we need to re-write the MITE functions to correlate with the hardware? Please if you can clarify what this means, I would really appreciate it. Thank you in advance.

    National Instruments is starting a new newsgroup to provide a forum for customers to discuss register level programming issues and ask questions. This newsgroup is not a direct support channel for register level programming, but may be monitored by National Instruments engineers. Please post you question with additional detail in:
    natinst.public.daq.driver-development.general
    Christian
    Christian Loew, CLA
    Principal Systems Engineer, National Instruments
    Please tip your answer providers with kudos.
    Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system,
    or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject
    to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense

  • Question about size of ints in Xcode

    Hello. I have a a few quick questions about declaring and defining variables and about their size and so forth. The book I'm reading at the moment, "Learn C on the Mac", says the following in reference to the difference between declaring and defining a variable:
    A variable declaration is any statement that specifies a variables name and type. The line *int myInt;* certainly does that. A variable definition is a declaration that causes memory to be allocated for the variable. Since the previous statement does cause memory to be allocated for myInt, it does qualify as a definition.
    I always thought a definition of a variable was a statement that assigned a value to a variable. If a basic declaration like "int myInt;" does allocate memory for the variable and therefore is a definition, can anyone give me an example of a declaration that does not allocate memory for the variable and therefore is not a definition?
    The book goes on, a page or so late, to say this:
    Since myInt was declared to be of type int, and since Xcode is currently set to use 4-byte ints, 4 bytes of memory were reserved for myInt. Since we haven't placed a value in those 4 bytes yet, they could contain any value at all. Some compilers place a value of 0 in a newly allocated variable, but others do not. The key is not to depend on a variable being preset to some specific value. If you want a variable to contain a specific value, assign the value to the variable yourself.
    First, I know that an int can be different sizes (either 4 bytes or 8 bytes, I think), but what does this depend on? I thought it depended on the compiler, but the above quote makes it sound like it depends on the IDE, Xcode. Which is it?
    Second, it said that Xcode is currently set to use 4-byte ints. Does this mean that there is a setting that the user can change to make ints a different size (like 8 bytes), or does it mean that the creators of Xcode currently have it set to use 4-byte ints?
    Third, for the part about some compilers giving a newly allocated variable a value of 0, does this apply to Xcode or any of its compilers? I assume not, but I wanted to check.
    Thanks for all the help, and have a great weekend!

    Tron55555 wrote:
    I always thought a definition of a variable was a statement that assigned a value to a variable. If a basic declaration like "int myInt;" does allocate memory for the variable and therefore is a definition, can anyone give me an example of a declaration that does not allocate memory for the variable and therefore is not a definition?
    I always like to think of a "declaration" to be something that makes no changes to the actual code, but just provides visibility so that compilation and/or linking will succeed. The "definition" allocates space.
    You can declare a function to establish it in the namespace for the compiler to find but the linker needs an actual definition somewhere to link against. With a variable, you could also declare a variable as "extern int myvar;". The actual definition "int myvar;" would be somewhere else.
    According to that book, both "extern int myvar;" and "int myvar;" are declarations, but only the latter is a definition. That is a valid way to look at it. Both statements 'delcare' something to the compiler, but on the second one 'define's some actual data.
    First, I know that an int can be different sizes (either 4 bytes or 8 bytes, I think), but what does this depend on? I thought it depended on the compiler, but the above quote makes it sound like it depends on the IDE, Xcode. Which is it?
    An "int" is supposed to be a processor's "native" size and the most efficient data type to use. A compiler may or may not be able to change that, depending on the target and the compiler. If a compiler supports that option and Xcode supports that compiler and that option, then Xcode can control it, via the compiler.
    Second, it said that Xcode is currently set to use 4-byte ints. Does this mean that there is a setting that the user can change to make ints a different size (like 8 bytes), or does it mean that the creators of Xcode currently have it set to use 4-byte ints?
    I think that "setting" is just not specifying any option to explicitly set the size. You can use "-m32" or "-m64" to control this, but I wouldn't recommend it. Let Xcode handle those low-level details.
    Third, for the part about some compilers giving a newly allocated variable a value of 0, does this apply to Xcode or any of its compilers? I assume not, but I wanted to check.
    I don't know for sure. Why would you ask? Are you thinking of including 45 lines of macro declarations 3 levels deep to initialize values based on whether or not a particular compiler/target supports automatic initialization? Xcode current supports GCC 3.3, GCC 4.0, GCC 4.2, LLVM GCC, CLang, and Intel's compiler for building PPC, i386, and x86_64 code in both debug and release, with a large number of optimization options. It doesn't matter what compiler you use or what it's behavior is - initialize your variables in C.

  • Question about sql batch process in java app

    hi all
    i have few questions about using batch process in the java.sql package. the addBatch method can take sql statements like inserts or updates. can we use a mixture of insert and update then? can we use prepared statement for this? it's just for performance consideration. thanks in advance.

    hi all
    i have few questions about using batch process in the
    java.sql package. the addBatch method can take sql
    statements like inserts or updates. addBatch() is a method that has no parameters. It doesn't 'add' sql statements.
    can we use a
    mixture of insert and update then? can we use
    prepared statement for this? it's just for
    performance consideration. thanks in advance.The point of batching is that you take something that is invariant and then 'add' a variant part.
    Thus a single insert has an invariant part (the table and specific columns) and a variant part (the data for each row by column.)
    You can use anything that is valid SQL (for jdbc, driver, database) and use it presuming your database allows that particular usage in batching. But that does require some regular pattern - it won't work if your usage is random. Nor will it work if some statements need to be executed only some of the time. Finally also note that transaction processing will often require smaller chunks - you can't insert a million rows in one batch.

  • A question about users assigned roles extraction

    Dear all,
    I have a question about users assigned roles list extraction. I need the list of the users who have already been created along with their assigned roles. According to what I found on Google, there is a table named AGR_USERS which provides the roles assigned to each user. Yet, this table provides only the SAP ID of each user along with the assigned roles. What I need more is to have also the first name and second name of each user.
    So, do you know any table providing at least the following information:
    1) First name of each user
    2) Second name of each user
    3) SAP ID of each user
    4) All assigned roles to each user.
    NOTE: I really need to have first name and second name in separate columns
    Thanks in advance,
    Dariyoosh

    >
    Shekar.J wrote:
    > Agr_users for the user ID and role assignments
    > USR02 to check the validity of the User ID
    > and USER_ADDR for the first name and last name
    >
    > You can create a Table join of the above 3 tables to retrieve the data you require
    Thanks to you and others for your attention to my problem
    I don't know anything about ABAP programming, is there any transaction allowing to create this join? As it seems to me the column "UNAME" in the table "AGR_USERS" and the column "BNAME" in the table "USER_ADDR", both refer to the SAP ID of the user. As a result the condition of the join would be "WHERE (UNAME = BNAME)", is there  any transaction/programme allowing to create this join?
    Thanks in advance,
    Dariyoosh

  • A question about foreign key to multiple tables

    Hello everybody,
    I have a question about creating foreign key and I would appreciate if you could kindly give me a hand. Here are my tables:
    CREATE TABLE TEAM1(team_id VARCHAR2(20), project_id VARCHAR2(20));
    ALTER TABLE TEAM1 ADD CONSTRAINT PK_TEAM1 PRIMARY KEY(team_id);
    CREATE TABLE TEAM2(team_id VARCHAR2(20), project_id VARCHAR2(20));
    ALTER TABLE TEAM2 ADD CONSTRAINT PK_TEAM2 PRIMARY KEY(team_id);although the structure of both the tables is exactly the same, the values (in particular team_id) in both tables are different.
    Also I have another table named AGENT
    CREATE TABLE AGENT(agent_id VARCHAR2(20), team_id VARCHAR2(20));
    ALTER TABLE AGENT ADD CONSTRAINT PK_AGENT PRIMARY KEY(agent_id)Now the problem is that the column team_id in AGENT table is actually a foreign key, but the value can be in either TEAM1 or TEAM2. As far as I know a foreign key points only to one table.
    How can I deal with this problem? Whenever there is an INSERT or UPDATE I have to make sure that the value of the column "team_id" in the table "AGENT" is a valid value either in "TEAM1" or "TEAM2"
    Thanks in advance,
    Kind Regards,
    Dariyoosh

    Do you have the ability to change the data model? If so a more appropriate structure may be something like this:
    CREATE TABLE TEAM(team_id VARCHAR2(20), team_name VARCHAR2(20));
    ALTER TABLE TEAM ADD CONSTRAINT PK_TEAM PRIMARY KEY(team_id);
    ALTER TABLE TEAM ADD CONSTRAINT UK_TEAM UNIQUE (team_name);
    CREATE TABLE TEAM_PROJECT(team_id VARCHAR2(20), project_id VARCHAR2(20));
    ALTER TABLE TEAM ADD CONSTRAINT PK_TEAM_PROJECT PRIMARY KEY(team_id, project_id);
    ALTER TABLE AGENT ADD CONSTRAINT FK_TEAM_PROJECT1 FOREIGN KEY (team_id) REFERENCES TEAM(team_id);
    CREATE TABLE AGENT(agent_id VARCHAR2(20), team_id VARCHAR2(20));
    ALTER TABLE AGENT ADD CONSTRAINT PK_AGENT PRIMARY KEY(agent_id);
    ALTER TABLE AGENT ADD CONSTRAINT FK_TEAM FOREIGN KEY (team_id) REFERENCES TEAM(team_id);Edited by: Centinul on Jun 25, 2010 10:50 AM

Maybe you are looking for