The Truth about Uncatchable Exceptions

Dear SDN,
this question must have been raised many times.
I did not find any convincent answer, so I wanted to discuss and get as close as possible to the final truth.
I have already had many major problems caused by UNCATCHABLE EXCEPTIONS, wich are nested behind hundreds of standard classes, programs, etc.
The ABAP runtime environment seems to be far beyond of my development boundaries, which makes me feel completely powerless as a programmer.
So, my question is: should I definately assume that it is absolutely impossible to treat, or handle somehow, those called "uncatchable exceptions" ??
Or should I believe that, there still could be an incredible secret that, once shared within this forum, would provide us with a miraculous remote possibility of doing so ?
Thank you very much.
Fabio

Dear SDN,
this question must have been raised many times.
I did not find any convincent answer, so I wanted to discuss and get as close as possible to the final truth.
I have already had many major problems caused by UNCATCHABLE EXCEPTIONS, wich are nested behind hundreds of standard classes, programs, etc.
The ABAP runtime environment seems to be far beyond of my development boundaries, which makes me feel completely powerless as a programmer.
So, my question is: should I definately assume that it is absolutely impossible to treat, or handle somehow, those called "uncatchable exceptions" ??
Or should I believe that, there still could be an incredible secret that, once shared within this forum, would provide us with a miraculous remote possibility of doing so ?
Thank you very much.
Fabio

Similar Messages

  • TS1702 Hi, I bought The Truth About Love album on itunes as a complete my album from my Iphone4S.  I can see the name of the album as a purchase on my Mac Notebook 2004, however I am not unable to add the music to my itouch and is doesn't show up in music

    Hi,
    I bought the Truth About Love/Pink's album on itunes as a complete my album purchase as I had bought a song from the album previously. I bought it via my Iphone 4S.  When I turn on itunes on my Mac Notebook 2004 (IOS X 10.4.11) I can see the album as a purchase but it is not listed in my library music nor can I add it to my Itouch 2nd generation.  Do you know why?  I can access the songs on my iphone but nowhere else.

    They will only be on your computer's iTunes if you put them there. If you are in a country where you can re-download music then they should show under the Purchased Link under Quick Links on the right-hand side of the iTunes store home page on your computer's iTunes. If they don't show there then you can connect your phone to your computer's iTunes and do File > Devices > Transfer Purchases to copy them over.

  • Reveal the truth about these skype hacking and spy...

    Hey, Im a skype user from sometime and I appreciate the great service done through this towards all... But as it's seen, though I thought calling(video n voice) is secure through skype, now I doubt a bit. coz there are so many software available( I really dunno if they work or not) to hack into skype accounts and even to personal webcams through skype without even knowing.... are these all a false or what?
    I lately found out this software available that says; using that, anyone can spy on us by just knowing our skype ID... Is that possible? I saw it when I was just moving around in YouTube. And with all these comments people saying it's really working. I didn't try to download it and find the truth coz I felt its not a good idea as it can affect my computer or my own skype account....
    Can anyone please describe the truth on this.... If you want, I can give the link to that youTube video to see what I'm telling here.....
    Thought this would be a good discussion for the whole skype community....

    p2011 wrote:
    Hey, Im a skype user from sometime and I appreciate the great service done through this towards all... But as it's seen, though I thought calling(video n voice) is secure through skype, now I doubt a bit. coz there are so many software available( I really dunno if they work or not) to hack into skype accounts and even to personal webcams through skype without even knowing.... are these all a false or what?
    I lately found out this software available that says; using that, anyone can spy on us by just knowing our skype ID... Is that possible? I saw it when I was just moving around in YouTube. And with all these comments people saying it's really working. I didn't try to download it and find the truth coz I felt its not a good idea as it can affect my computer or my own skype account....
    Can anyone please describe the truth on this.... If you want, I can give the link to that youTube video to see what I'm telling here.....
    Thought this would be a good discussion for the whole skype community....
    I think that those software that you mentioned could actually do harm in your computer, rather than to do what they claim they can do.  Those programs that claim that can hack Skype calls are most likely fake software and most likely contain viruses/malware/spyware or similar elements.
    People/parties who promote such software also make use of fake social media accounts to put comments saying that their software actually work (which is a very common practice of scammers).  
    and you made the right choice on not to download those programs in your computer.  Who knows what damage they could do in your computer system/accounts.
    IF YOU FOUND OUR POST USEFUL THEN PLEASE GIVE "KUDOS". IF IT HELPED TO FIX YOUR ISSUE PLEASE MARK IT AS A "SOLUTION" TO HELP OTHERS. THANKS!
    ALTERNATIVE SKYPE DOWNLOAD LINKS | HOW TO RECORD SKYPE VIDEO CALLS | HOW TO HANDLE SUSPICIOS CALLS AND MESSAGES
    SEE MORE TIPS, TRICKS, TUTORIALS AND UPDATES in
    | skypefordummies.blogspot.com | 

  • Question about SAP + SLES10 + vSphere and the truth about memory

    Hi,
    we are using vSphere and SLES 10 for a SolutionManager 7.0 on MaxDB 7.6.
    The system is configured with 2 GB RAM in the VM. The database is configured to use 125000 pages as cache (100000 KB).
    Yes, I know the system is configured very small for this usage, but it is a demo system...
    But the system is really slow. I can't figure out whats the problem.
    The RAM is configured with 2 GB in the VM a "free" in linux shows me that there is 500 MB used for file system chache
                 total       used       free     shared    buffers     cached
    Mem:       2076908    2002704      74204          0      28936     578212
    -/+ buffers/cache:    1395556     681352
    Swap:      6185016    3037744    3147272
    so this shoud be ok, for me it is close to the limit...
    But VMware infrastruture client shows me, that there are only 300 MB of the 2GB is used ... but the database should use 1 GB and SAP should use some RAM , too.
    So who tells the truth? Where does the RAM goes to if it is not used in VMware? Could this be the performance problem?
    An other problem is, that the show dev_io of the database shows me very slow access to the files ...
    i.e.
    I/O via Device Processes:
      UNIX Devspace                                                Read    avg_read      Write  avg_write
       tid name                                                           count       time            count       time
    28596 /sapdata/SYS/sapdata/DISKD01       6532     0.0294        101     0.2077
    But VMWare shows that there is nearly no usage of DISK ... average is shown as 150 KBps...
    So again, who tells the truth?
    What else could be the problem?
    Thank you.
    Best regards
    Christian

    > I know 2 GB is less, but the system is still 32 bit Linux, so 6 GB is "impossible".
    Why that? The 32bit limit is a per process limit, not a limit for the amount of total supported memory.
    > During the long weekend the system is switched to an other VMServer I am going to request more RAM. What a pitty that 32 bit does not support more than 3 GB....
    I don't know who told you that but it's wrong
    > But there is still the question whats correct? The linux variant of free or the VMware infrastructure client monitoring the RAM?
    > What could slow down the Database IO performance?
    > USE_OPEN_DIRECT we are already using ...
    Are you sure it's the I/O peformance? A couple of questions arise then:
    - What filesystem is underneath?
    - How are your data files distributed?
    - What are your I/O times for a single I/O (you can switch that on using DB50 - TAsk manager - and press on the "clock", the time will then be displayed in the database analyzer.
    If you use VMWare on a recent processor you can also switch nicely to a 64bit Linux.
    Markus

  • Iphone and at&t - the truth about at&t service for the iphone

    i love my iphone.
    the only problem has been using at&t in southern california. in los angeles there are major holes in the service, and multiple hour delays on delivery of voicemails and emails. so ive been on the phone with technical and customer support dealing with this for months.
    Well, yesterday I was on the at&t support line for about an hour with this nice girl that gave my account a credit and finally told me what's really going on and why at&t service and coverage actually ***** so bad.
    here's the scoop straight from their mouths to your eyes:
    -when at&t bought cingular they ended up having too many cell towers for monopoly rules, so they had to sell a whole bunch and then lease back the service capacity that their network here needed.
    -they've gotten cheap and over the past 9 months have not been leasing the entire network capacity as needed.
    -this means dropped calls for you and me, network busy, call failed, no edge connection, and voicemail and email delivery hours or even days late.
    -i asked if there was any remedy in the works, and she told me that they have a plan to build more towers but that it was stalled in the bureaucracy. she said the more complaints they got from customers the sooner these towers will be built.
    -i asked if they were doing anything for their customers and she told me that they would let people out of their contracts early without a penalty because of these issues!
    so, finally i get to the question, how's t-mobile service in southern california? los angeles?
    i also want to get a discussion of service going in general. i know network issues are not apple's fault, but they affect the iphone experience and are going to affect the iphone bottom line eventually as more and more customers grow tired of at&t's business antics. apple does have a responsibility to its customers to be working with at&t to resolve service issues so that i can continue to love my iphone (i sleep with it).

    adrock00,
    Have you been spying on my wife and me?? You are writing, verbatum, our experiences with the iPhone. Same thing - love the iPhone, HATE the AT&T service. It's shameful. I spend a good deal of money a month (paying for two iPhones), and I can not, I swear to you, remember the last time I had a conversation on it without the line being dropped (going through this procedure 3-4 times to complete the call) or completely mangled and incomprehensive for periods of time. Love the 'i' in the iPhone, but hate the "phone" Feel like a fool, really, and stuck. In this land of choices, and quality assurances, shouldn't one be allowed to switch service if the service you signed up for is inadequate. With these contracts, they have you by the cojones and laugh all the way to the bank. Shame.
    Fully agree with you, also, that although Apple has provided an exceptional product, that I can not tell enough great things about, it should carry some of the responsibility for forcing us to use the lousy service provided by AT&T.
    Just my experience. I'm also in LA, BTW.
    Cheers

  • The truth about pagefile (SSD)

    Good afternoon!
    Two years ago you guys (especially Harm) helped me to build a PC for Premiere. After two years I had to update my disks setup and decided to buy a Samsung 830 SSD for OS. Now, after I've read tons of informations about how to setup the drive, I know nothing...
    As I remember, and as I checked on this forum, if you have 4 disks setup, you should set your pagefile on any other disk but OS disk - especially if You work in Photoshop, which uses pagefile a lot. This statement was totally ok for me until I found these:
    Quote :
    You don't need a pagefile at all with 8 gigs of RAM -- turn it off.
    "This may be true, but it could also cause grief.   Each user is different, and it's dangerous to make generalizations such as this because people use different amounts of RAM depending on the combination of programs and documents/files that they have open at any one point in time.
    To find out how much pagefile you need, run Task Manager (Ctrl+Shift+Esc) and click the "Performance" tab.   The "Memory" bar graph (to the left of the "Physical Memory Usage History" graph) shows how much memory you're using.   Start up all the programs you might possibly run at the same time and use them to open the biggest documents/files/photos/movies that you may ever have open at once. Note the amount of RAM in the bar graph and add perhaps 25% to 50% as a safety margin.   For example, if your bar graph shows 6GB, then you'd probably be safe in assuming that you need no more than 8GB of memory."
    And MORE IMPORTANT:
    "Do you understand what happens to an SSD that has run out of write cycles on it's NAND? It becomes read-only memory. It doesn't simply stop working. I work in manufacturer's SSD R&D (who also makes much of the NAND used in many SSD's) and while typical "current" 25nm and 34nm MLC is rated between 3000-5000 write cycles, it is "conservatively" rated as such.  Neither you or any of your friends who work with Photochop or Win Temp files are blowing through this many write cycles in a 6 month period without doing "other" much more destructive writing.
    In fact it's extremely rare that any SSD has all of it's write cycles burned up. It is FAR more likely that there is a controller failure from firmware or other electrical burnouts/failures, that have nothing to do with the number of write cycle endurance left in the NAND. Even in our labs running 24x7 weeks-long full write tests, which is a thousand times more intensive than photoshop or win pagefiles, we rarely use up all the write cycles of the NAND before other failures occur. While these "other" (aka non NAND write-endurance related) failures suck when they happen, it has nothing to do with anything photoshop or win pagefiles is going to make occur faster or slower.
    If your "friends" are buring out current SSD's in 6 month periods, they are either buying crappy SSD's, doing odd things to the SSD's, or simply have failures they are blaming erroneously on NAND write cycle limitations.  Don't get me wrong, SSD's will fail, but unfortunately, very rarely will the failure be from write cycle endurance life of the NAND, and definately not because the SSD is used with photshop scrathdisks or win pagefiles.
    To use a unpopular automotive analogy, the NAND write cycle life is like the engine of a car that is used where they use salt on the roads to melt ice. While it is possible for the engine to die from being used too much, it is much more likely the body of the car is going to rust/rot away before the engine has outlived it's useful life. And this car does not care if photoshop or win temp files are in the passenger seat. If the SSD fails under 2-3 years of normal use, it won't be because of photoshop or win pagefiles using up the NAND write cycles. "
    As I understand, this guy (who actually produces SSDs) says that firstly -  you CAN set your pagefile on SSD - and secondly - you do NOT need to set up a pagefile for photoshop at all.
    Now I am REALLY confused... I trust Harm and I trust all of your expierence guys and would be very thankful for any information about this.
    P.S. After I bought the SSD I found out that my MB has crappy Marvell SATA3 Controller... :/
    My setup is:
    GA-X58-UDR3
    i7 930 @3.8Ghz
    G.Skill Dual ECO 1.35v CL8 12GB
    GeForce GTX460
    Samsung SSD 830 128GB
    Samsung F3 Spinpoint 2x1TB
    WD something 160GB (just for backup or trash)
    Regards,
    Paul

    Windows8 and possibly Windows7 - I'm not sure about Win7 - will create a pagefile in case of a system hang for the memory dump and it will create that on the C: drive, even if you have a pagefile on another drive. Windows will only start if there is a pagefile. If there is no pagefile defined, it will automatically create a dynamic one on the C: drive.
    With these two items as a given, the question remains, what is wise. Jim always says let Windows decide, so his suggestion is a dynamic page file.
    Pagefiles are a relic of the past, dating back to the times when memory was scarce, only 2, 4 or maybe 8 GB memory and at that moment the rule was to use up to 1.5 to 2.0 x  the amount of memory for the pagefile, a rule Windows still adheres to in its default setting. With systems now abundant that contain 32 or even 64 GB of memory, that no longer holds. You will have a difficult time to run PR where it uses more than 24 GB of memory, let alone 48 or more GB's. (AE is a different matter).
    So, IMO we have to lose the old and outdated assumption that it is best to use a pagefile with a size of 1.5 or 2.0 times the physical memory. It no longer holds true. I think that a sum total of physical memory plus pagefile amounting to around 64 GB is more than enough for most cases. So I suggest the following rule of thumb for your pagefile, depending on your use of PR and AE, the nature of your source material and the complexity of your timelines:
    With less than 32 GB installed, use a static pagefile of X GB to bring the sum total up to 32 - 48 GB.
    With 32 GB installed, use a static pagefile of 32 GB to bring the sum total up to 64 GB.
    With 64 GB installed, use a static pagefile of at least 1 GB, but no more than 16 GB. Everything more is a waste of space.
    I intentionally mention STATIC pagefile, in contrast to Jim's suggestion, who pleads for dynamic pagefiles for the following reason:
    Every time the pagefile changes its size, under Windows direction, it not only means that the data changes, but also that the file allocation table at the beginning of the disk needs to be rewritten to reflect the changed size. Every alteration in file size thus requires extra writing to the SSD, reducing its limited lifespan and leads to fragmentation of that pagefile. A static file does not have these negative consequences. Only data need to be written in the file, no alterations to the file allocation table need to be made. And Windows does not need to keep logs of those changes, further reducing the need to write additional data.
    For example, if your bar graph shows 6GB, then you'd probably be safe in assuming that you need no more than 8GB of memory.
    It is pretty easy with only Premiere Pro open and playing back a timeline to reach 24 GB memory use. Now add a few other applications and it is safe to say you need 32 GB memory at least, so with 8 GB memory, you need to add a pagefile of 24 GB or more.

  • SOS!! What's the matter about this exception

    java.rmi.MarshalException: error marshalling return; nested exception is:
         java.io.NotSerializableException: java.util.RandomAccessSubList
         at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
         at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:284)
         at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:244)
         at ejb.CategoryEJB_r6fvxc_EOImpl_812_WLStub.searchItems(Unknown Source)
         at test.ejb.TestCategoryEJBTestClient.testSearchItems(TestCategoryEJBTestClient.java:342)
    ...(Click for full stack trace)...
    Caused by: java.io.NotSerializableException: java.util.RandomAccessSubList
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
         at java.util.HashMap.writeObject(HashMap.java:958)
         at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
         at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:795)
         at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1294)
         at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1245)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
         at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1330)
         at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1302)
         at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1245)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
         at weblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:116)
         at weblogic.rjvm.MsgAbbrevOutputStream.writeObject(MsgAbbrevOutputStream.java:93)
         at ejb.CategoryEJB_r6fvxc_EOImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
         at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:108)
         at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:353)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
         at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
         at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

    my project is running on weblogic 8.1sp2, the code snap :
    public Page implements Serialable{
        List list = new ArrayList;
        public Page(){
    SearchSessionBean extends SessionBean {
        public Page search(Command cmd){
             //execute search
             listHandler.executeSearch(criteria);
             //construct the page
             page.setList(listHandler.getNextList());
             //***DEBUG:the <code>page</code> here is right
             return page.
    }i test this method by junit , the code will return the right Page,but i deploy it to weblogic,the exception throws, why???????

  • What is the truth about flashlights on iPhones being hacked?

    I recently saw a youtube posting:
    Cybersecurity Expert Gary Miliefsky from snoop wall Information about a popular smartphone application that could expose your personal information to cyber criminals-
    https://www.youtube.com/watch?feature=player_embedded&v=Q8xz8xKEFvU#t=0
    which states that flashlight apps are being used as spyware to steal personal information. 
    Is the flashlight that comes factory installed on my iPhone susceptible to such spyware?

    I recently saw a youtube posting:
    Cybersecurity Expert Gary Miliefsky from snoop wall Information about a popular smartphone application that could expose your personal information to cyber criminals-
    https://www.youtube.com/watch?feature=player_embedded&v=Q8xz8xKEFvU#t=0
    which states that flashlight apps are being used as spyware to steal personal information. 
    Is the flashlight that comes factory installed on my iPhone susceptible to such spyware?

  • The Truth about Apple's Pro Care---

    I am debating whether or not I should purchase Apple's Pro Care for my new ibook. So I am interested in knowing if the level and quality of support is worth the cost.
    -anyone out there have thoughts on this?

    Hi,
    Pro Care is a different option than Apple care for Apple customers. Pro Care gives you the ability to be seen quickly by a Genius, additionally you get one-on-one training by their Creative Genuises. I took advantage of my first one-on-one session last Friday at the Apple Store, SoHo and I was completely impressed. Questions about iLife '06 and more technical issues about transferring delicate files were answered confidently.
    If you're thinking about Pro Care, remember that it's not just care for the machine. Pro Care is support for YOU. For $99, you get personal tutoring for the year! I'm all for it.
    Woody Adams
    iMac G5 2.1 GHz

  • The Truth About BB10 Boot Times, Please.

    Hi, devs and support techs.
    I'm just trying to get some sort of official information regarding the reason for the long boot times on the BB10 OS.
    I'm currently on 10.2.1.2102 (2141) and it take a few minutes to boot up. I know that it was changed recently to ensure that the Hub is loaded as soon as the OS says it is done booting.
    People seem to be confused as to exactly why the devices (including BBOS) took so long to boot.
    There are some theories about it scanning the OS to make sure that it is ok before booting.
    Can you please provide some official documentation regarding this and exactly why it takes so long. Some people are claiming that the boot time is inexcusable.
    Honestly, I don't mind it that much - I do think it is long and can be annoying if your device restarts regularly by itself, but mine doesn't so I don't have any issue with it.
    I would rather have a long boot time and a very smooth OS than what I get on other platforms.

    nharzhool wrote:
    Yeah, but sometimes I am awake at stupid hours of the morning and completely forget these very obvious things...also, I'm not what you would call "A smart man". Lol.
    Unfortunately, bringing this up on CrackBerry just incites a furious bickering session between the various fanboys.
    Don't short change yourself. I'm betting you're smarter than 90% of the CB community... since you chose not to post there.
    nharzhool wrote:
    I was hoping there were some App Devs or OS experts that maybe know why this happens...
    Nope, as you can see at the top of every page of this forum, we're a peer-to-peer to community.
    The boot-up time is what it is. I just now rebooted mine... 1:20 seconds... I don't see any big deal.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • The truth about objects, references, instances and cloning (Trees and Lists

    Hello
    As a few of you may have know from my postings over the past few weeks, ive been building my first real java ap and trying to learn along the way, hitting a few snags here and there.
    One main snag i seem to have been hitting a fair bit is objects and instances, im kinda learning on how they work and what they mean but as a php programmer it seems to be very different.
    as pointed out to me if you have objectA=objectB then in php you have two objects that share the same value but in java you have still one object value and one object pointing to the value.
    sooo my first question is
    if i have this
    Object objA=new Object()
    Object objB=objA()then object A creates a new memory allocation for the object data right? and object B is simply a reference to the object A memory allocation right?
    so therefore there is no instance of objectB? or is there an instance of object B but it just takes up the same memory allocation as object A?
    anyway, what is the point of being able to say objB=objA what can that be used for if not for making a copy of an object (i understand now that it doesnt copy an object)
    My second question (which i think i actually understand now, but im posting it to see if the answers may help others)
    If i have a List structure (e.g. arraylist) then when i add a datatype such as a treemap does it not add the changed treemap, ill try and explain with code
    ArrayList mylist=new ArrayList()
    Treemap myTree=new Treemap()
    myTree.put("hello","howdy");
    myTree.put("bye","cya");
    mylist.put(myTree);
    System.out.println(mylist.toString());
    myTree.put("another","one");
    mylist.put(myTree);
    System.out.println(mylist.toString());now to be honest ive not actually tried that code and it may actually procude the right results, but from my experience so far that similar sort of thing hasnt been working (by the way i know the above code wont compile as is :p)
    anyway what i assume is that will output this
    [Hello,howdy,bye,cya] <<this is the first system out
    [Hello,howdy,bye,cya,another,one  <<this is the second system out
    Hello,howdy,bye,cya,another,one] <<this is the second system out
    where it should produce this
    [Hello,howdy,bye,cya,
    Hello,howdy,bye,cya,another,one]
    Why when I update the treemap does the arraylist change, is this because the thing that is being put in the array list is infact not an object but simply a reference to an object?
    thanks for everyones help so far :)

    as pointed out to me if you have objectA=objectB then
    in php you have two objects that share the same value
    but in java you have still one object value and one
    object pointing to the value.Some years ago, I built a small website managing data saved in an XML file using PHP. Being used to Java, I used an OO approach and created classes managing data structures and having setter/getter methods. The fact that PHP did actually create a copy of any object being passed as and argument made me crazy. This way, I wasn't able to reach the same instances from several different places in my code. Instead, I had to put a certain operator ("&" I think) before any reference to force PHP not to make a copy but pass the reference. I also found a note on the PHP site saying that copying was faster than passing the reference, which I actually couldn't believe. If I'm not wrong, they changed the default behaviour in PHP5.
    if i have this
    Object objA=new Object()
    Object objB=objA()then object A creates a new memory allocation for the
    object data right? and object B is simply a reference
    to the object A memory allocation right?The statement "new <Class>" allocates memory. The reference itself just takes up a few bytes in order to maintain some administrative data (such as the memory address). References are basically like pointers in C, though there's no pointer arithmetics and they can't point to any arbitrary place in memory (only a legal instance or null).
    so therefore there is no instance of objectB? or is
    there an instance of object B but it just takes up
    the same memory allocation as object A?There is an instance of objectB, but it's just the same instance that objectA is pointing at. Both references objectA and objectB contain the same memory address. That's why they'd produce a result of "true" if compared using the "==" operator.
    anyway, what is the point of being able to say
    objB=objA what can that be used for if not for making
    a copy of an object (i understand now that it doesnt
    copy an object)Sometimes you don't want to make a copy, as 1) it consumes more memory and 2) you'd lose the reference to it (making it more difficult to tell what instance is actually accessed). If there was no way to pass a reference to an object into a method, methods wouldn't be able to affect the original instance.
    Why when I update the treemap does the arraylist
    change, is this because the thing that is being put
    in the array list is infact not an object but simply
    a reference to an object?The ArrayList doesn't change at all. It's the instance that's being changed, and the ArrayList has a reference to it.

  • The Bug about 'DB_SECONDARY_BAD' still exists in BerkeleyDB4.8!

    The Bug about 'DB_SECONDARY_BAD' still exists in BerkeleyDB4.8?
    I'm sorry for my poor English, But I just cannot find anywhere else for help.
    Thanks for your patience first!
    I'm using BDB4.8 C++ API on Ubuntu 10.04, Linux Kernel 2.6.32-24-generic
    $uname -a
    $Linux wonpc 2.6.32-24-generic #43-Ubuntu SMP Thu Sep 16 14:17:33 UTC 2010 i686 GNU/Linux
    When I update(overwrite) a record in database, I may get a DB_SECONDARY_BAD exception,
    What's worse, This case doesn't always occures, it's random. So I think it probably a bug
    of BDB, I have seen many issues about DB_SECONDARY_BAD with BDB4.5,4.6...
    To reproduce the issue, I make a simplified test program from my real program.
    The data to be stroed into database is a class called 'EntryData', It's defined in db_access.h,
    where also defines some HighLevel API functions that hide the BDB calls, such as
    store_entry_data(), which use EntryData as its argument. The EntryData have a string-type
    member-data 'name' and a vector<string>-type mem-data 'labels', So store_entry_data() will
    put the real data of EntryData to a contiguous memory block. The get_entry_data() returns
    an EntryData builed up from the contiguous memory block fetched from database.
    The comlete test program is post following this line:
    /////////db_access.h////////////
    #ifndef __DB_ACCESS_H__
    #define __DB_ACCESS_H__
    #include <string>
    #include <vector>
    #include <db_cxx.h>
    class EntryData;
    //extern Path DataDir; // default value, can be changed
    extern int database_setup();
    extern int database_close();
    extern int store_entry_data(const EntryData&, u_int32_t = DB_NOOVERWRITE);
    extern int get_entry_data(const std::string&, EntryData*, u_int32_t = 0);
    extern int rm_entry_data(const std::string&);
    class DBSetup
    // 构造时调用database_setup, 超出作用域自动调用database_close .
    // 该类没有数据成员.
    public:
    DBSetup() {
    database_setup();
    ~DBSetup() {
    database_close();
    class EntryData
    public:
    typedef std::vector<std::string> LabelContainerType;
    EntryData() {}
    EntryData(const std::string& s) : name(s) {}
    EntryData(const std::string& s, LabelContainerType& v)
    : name(s), labels(v) {}
    EntryData(const std::string&, const char*[]);
    class DataBlock;
    // 直接从内存块中构建, mem指针将会从数据库中获取,
    // 它就是EntryData转化成的DataBlock中buf_ptr->buf的内容.
    EntryData(const void* mem_blk, const int len);
    ~EntryData() {};
    const std::string& get_name () const { return name; }
    const LabelContainerType& get_labels() const { return labels; }
    void set_name (const std::string& s) { name = s; }
    void add_label(const std::string&);
    void rem_label(const std::string&);
    void show() const;
    // get contiguous memory for all:
    DataBlock get_block() const { return DataBlock(*this); }
    class DataBlock
    // contiguous memory for all.
    public:
    DataBlock(const EntryData& data);
    // 引进一块内存作为 buf_ptr->buf 的内容.
    // 例如从数据库中获取结果
    DataBlock(void* mem, int len);
    // 复制构造函数:
    DataBlock(const DataBlock& orig) :
    data_size(orig.data_size),
    capacity(orig.capacity),
    buf_ptr(orig.buf_ptr) { ++buf_ptr->use; }
    // 赋值操作符:
    DataBlock& operator=(const DataBlock& oth)
    data_size = oth.data_size;
    capacity = oth.capacity;
    if(--buf_ptr->use == 0)
    delete buf_ptr;
    buf_ptr = oth.buf_ptr;
    return *this;
    ~DataBlock() {
    if(--buf_ptr->use == 0) { delete buf_ptr; }
    // data()函数因 Dbt 构造函数不支持const char*而被迫返回 char*
    // data() 返回的指针是应该被修改的.
    const char* data() const { return buf_ptr->buf; }
    int size() const { return data_size; }
    private:
    void pack_str(const std::string& s);
    static const int init_capacity = 100;
    int data_size; // 记录数据块的长度.
    int capacity; // 已经分配到 buf 的内存大小.
    class SmartPtr; // 前向声明.
    SmartPtr* buf_ptr;
    class SmartPtr
    friend class DataBlock;
    char* buf;
    int use;
    SmartPtr(char* p) : buf(p), use(1) {}
    ~SmartPtr() { delete [] buf; }
    private:
    std::string name; // entry name
    LabelContainerType labels; // entry labels list
    }; // class EntryData
    #endif
    //////db_access.cc/////////////
    #include <iostream>
    #include <cstring>
    #include <cstdlib>
    #include <vector>
    #include <algorithm>
    #include "directory.h"
    #include "db_access.h"
    using namespace std;
    static Path DataDir("~/mydict_data"); // default value, can be changed
    const Path& get_datadir() { return DataDir; }
    static DbEnv myEnv(0);
    static Db db_bynam(&myEnv, 0); // using name as key
    static Db db_bylab(&myEnv, 0); // using label as key
    static int generate_keys_for_db_bylab
    (Db* sdbp, const Dbt* pkey, const Dbt* pdata, Dbt* skey)
    EntryData entry_data(pdata->get_data(), pdata->get_size());
    int lab_num = entry_data.get_labels().size();
    Dbt* tmpdbt = (Dbt*) malloc( sizeof(Dbt) * lab_num );
    memset(tmpdbt, 0, sizeof(Dbt) * lab_num);
    EntryData::LabelContainerType::const_iterator
    lab_it = entry_data.get_labels().begin(), lab_end = entry_data.get_labels().end();
    for(int i = 0; lab_it != lab_end; ++lab_it, ++i) {
    tmpdbt[ i ].set_data( (void*)lab_it->c_str() );
    tmpdbt[ i ].set_size( lab_it->size() );
    skey->set_flags(DB_DBT_MULTIPLE | DB_DBT_APPMALLOC);
    skey->set_data(tmpdbt);
    skey->set_size(lab_num);
    return 0;
    //@Return Value: return non-zero at error
    extern int database_setup()
    const string DBEnvHome (DataDir + "DBEnv");
    const string dbfile_bynam("dbfile_bynam");
    const string dbfile_bylab("dbfile_bylab");
    db_bylab.set_flags(DB_DUPSORT);
    const u_int32_t env_flags = DB_CREATE | DB_INIT_MPOOL;
    const u_int32_t db_flags = DB_CREATE;
    rmkdir(DBEnvHome);
    try
    myEnv.open(DBEnvHome.c_str(), env_flags, 0);
    db_bynam.open(NULL, dbfile_bynam.c_str(), NULL, DB_BTREE, db_flags, 0);
    db_bylab.open(NULL, dbfile_bylab.c_str(), NULL, DB_BTREE, db_flags, 0);
    db_bynam.associate(NULL, &db_bylab, generate_keys_for_db_bylab, 0);
    } catch(DbException &e) {
    cerr << "Err when open DBEnv or Db: " << e.what() << endl;
    return -1;
    } catch(std::exception& e) {
    cerr << "Err when open DBEnv or Db: " << e.what() << endl;
    return -1;
    return 0;
    int database_close()
    try {
    db_bylab.close(0);
    db_bynam.close(0);
    myEnv.close(0);
    } catch(DbException &e) {
    cerr << e.what();
    return -1;
    } catch(std::exception &e) {
    cerr << e.what();
    return -1;
    return 0;
    // 返回Dbt::put()的返回值
    int store_entry_data(const EntryData& e, u_int32_t flags)
    int res = 0;
    try {
    EntryData::DataBlock blk(e);
    // data()返回的buf中存放的第一个字符串便是 e.get_name().
    Dbt key ( (void*)blk.data(), strlen(blk.data()) + 1 );
    Dbt data( (void*)blk.data(), blk.size() );
    res = db_bynam.put(NULL, &key, &data, flags);
    } catch (DbException& e) {
    cerr << e.what() << endl;
    throw; // 重新抛出.
    return res;
    // 返回 Db::get()的返回值, 调用成功时 EntryData* e的值才有意义
    int get_entry_data
    (const std::string& entry_name, EntryData* e, u_int32_t flags)
    Dbt key( (void*)entry_name.c_str(), entry_name.size() + 1 );
    Dbt data;
    data.set_flags(DB_DBT_MALLOC);
    int res = db_bynam.get(NULL, &key, &data, flags);
    if(res == 0)
    new (e) EntryData( data.get_data(), data.get_size() );
    free( data.get_data() );
    return res;
    int rm_entry_data(const std::string& name)
    Dbt key( (void*)name.c_str(), name.size() + 1 );
    cout << "to remove: \'" << name << "\'" << endl;
    int res = db_bynam.del(NULL, &key, 0);
    return res;
    EntryData::EntryData(const std::string& s, const char* labels_arr[]) : name(s)
    {   // labels_arr 需要以 NULL 结尾.
    for(const char** i = labels_arr; *i != NULL; i++)
    labels.push_back(*i);
    EntryData::EntryData(const void* mem_blk, const int len)
    const char* buf = (const char*)mem_blk;
    int consumed = 0; // 已经消耗的mem_blk的大小.
    name = buf; // 第一串为 name
    consumed += name.size() + 1;
    for (string label = buf + consumed;
    consumed < len;
    consumed += label.size() + 1)
    label = buf + consumed;
    labels.push_back(label);
    void EntryData::add_label(const string& new_label)
    if(find(labels.begin(), labels.end(), new_label)
    == labels.end())
    labels.push_back(new_label);
    void EntryData::rem_label(const string& to_rem)
    LabelContainerType::iterator iter = find(labels.begin(), labels.end(), to_rem);
    if(iter != labels.end())
    labels.erase(iter);
    void EntryData::show() const {
    cout << "name: " << name << "; labels: ";
    LabelContainerType::const_iterator it, end = labels.end();
    for(it = labels.begin(); it != end; ++it)
    cout << *it << " ";
    cout << endl;
    EntryData::DataBlock::DataBlock(const EntryData& data) :
    data_size(0),
    capacity(init_capacity),
    buf_ptr(new SmartPtr(new char[init_capacity]))
    pack_str(data.name);
    for(EntryData::LabelContainerType::const_iterator \
    i = data.labels.begin();
    i != data.labels.end();
    ++i) { pack_str(*i); }
    void EntryData::DataBlock::pack_str(const std::string& s)
    int string_size = s.size() + 1; // to put sting in buf separately.
    if(capacity >= data_size + string_size) {
    memcpy(buf_ptr->buf + data_size, s.c_str(), string_size);
    else {
    capacity = (data_size + string_size)*2; // 分配尽可能大的空间.
    buf_ptr->buf = (char*)realloc(buf_ptr->buf, capacity);
    memcpy(buf_ptr->buf + data_size, s.c_str(), string_size);
    data_size += string_size;
    //////////// test_put.cc ///////////
    #include <iostream>
    #include <string>
    #include <cstdlib>
    #include "db_access.h"
    using namespace std;
    int main(int argc, char** argv)
    if(argc < 2) { exit(EXIT_FAILURE); }
    DBSetup setupup_mydb;
    int res = 0;
    EntryData ed(argv[1], (const char**)argv + 2);
    res = store_entry_data(ed);
    if(res != 0) {
         cerr << db_strerror(res) << endl;
         return res;
    return 0;
    // To Compile:
    // $ g++ -ldb_cxx -lboost_regex -o test_put test_put.cc db_access.cc directory.cc
    //////////// test_update.cc ///////////
    #include <iostream>
    #include <cstdlib>
    #include <string>
    #include <boost/program_options.hpp>
    #include "db_access.h"
    using namespace std;
    namespace po = boost::program_options;
    int main(int argc, char** argv)
    if(argc < 2) { exit(EXIT_SUCCESS); }
    DBSetup setupup_mydb;
    int res = 0;
    po::options_description cmdopts("Allowed options");
    po::positional_options_description pos_opts;
    cmdopts.add_options()
    ("entry", "Specify the entry that will be edited")
    ("addlabel,a", po::value< vector<string> >(),
    "add a label for specified entry")
    ("removelabel,r", po::value< vector<string> >(),
    "remove the label of specified entry")
    pos_opts.add("entry", 1);
    po::variables_map vm;
    store( po::command_line_parser(argc, argv).
    options(cmdopts).positional(pos_opts).run(), vm );
    notify(vm);
    EntryData entry_data;
    if(vm.count("entry")) {
    const string& entry_to_edit = vm["entry"].as<string>();
    res = get_entry_data( entry_to_edit, &entry_data );
    switch (res)
    case 0:
    break;
    case DB_NOTFOUND:
    cerr << "No entry named: \'"
    << entry_to_edit << "\'\n";
    return res;
    break;
    default:
    cerr << db_strerror(res) << endl;
    return res;
    } else {
    cerr << "No entry specified\n";
    exit(EXIT_FAILURE);
    EntryData new_entry_data(entry_data);
    typedef vector<string>::const_iterator VS_CI;
    if(vm.count("addlabel")) {
    const vector<string>& to_adds = vm["addlabel"].as< vector<string> >();
    VS_CI end = to_adds.end();
    for(VS_CI i = to_adds.begin(); i != end; ++i) {
    new_entry_data.add_label(*i);
    if(vm.count("removelabel")) {
    const vector<string>& to_rems = vm["removelabel"].as< vector<string> >();
    VS_CI end = to_rems.end();
    for(VS_CI i = to_rems.begin(); i != end; ++i) {
    new_entry_data.rem_label(*i);
    cout << "Old data| ";
    entry_data.show();
    cout << "New data| ";
    new_entry_data.show();
    res = store_entry_data(new_entry_data, 0); // set flags to zero permitting Over Write
    if(res != 0) {
    cerr << db_strerror(res) << endl;
    return res;
    return 0;
    // To Compile:
    // $ g++ -ldb_cxx -lboost_regex -lboost_program_options -o test_update test_update.cc db_access.cc directory.cc

    ////////directory.h//////
    #ifndef __DIRECTORY_H__
    #define __DIRECTORY_H__
    #include <string>
    #include <string>
    #include <sys/types.h>
    using std::string;
    class Path
    public:
    Path() {}
    Path(const std::string&);
    Path(const char* raw) { new (this) Path(string(raw)); }
    Path upper() const;
    void operator+= (const std::string&);
    // convert to string (char*):
    //operator std::string() const {return spath;}
    operator const char*() const {return spath.c_str();}
    const std::string& str() const {return spath;}
    private:
    std::string spath; // the real path
    inline Path operator+(const Path& L, const string& R)
    Path p(L);
    p += R;
    return p;
    int rmkdir(const string& path, const mode_t mode = 0744, const int depth = -1);
    #endif
    ///////directory.cc///////
    #ifndef __DIRECTORY_H__
    #define __DIRECTORY_H__
    #include <string>
    #include <string>
    #include <sys/types.h>
    using std::string;
    class Path
    public:
    Path() {}
    Path(const std::string&);
    Path(const char* raw) { new (this) Path(string(raw)); }
    Path upper() const;
    void operator+= (const std::string&);
    // convert to string (char*):
    //operator std::string() const {return spath;}
    operator const char*() const {return spath.c_str();}
    const std::string& str() const {return spath;}
    private:
    std::string spath; // the real path
    inline Path operator+(const Path& L, const string& R)
    Path p(L);
    p += R;
    return p;
    int rmkdir(const string& path, const mode_t mode = 0744, const int depth = -1);
    #endif
    //////////////////// All the code is above ////////////////////////////////
    Use the under command
    $ g++ -ldb_cxx -lboost_regex -o test_put test_put.cc db_access.cc directory.cc
    to get a test program that can insert a record to database.
    To insert a record, use the under command:
    $ ./test_put ubuntu linux os
    It will store an EntryData named 'ubuntu' and two labels('linux', 'os') to database.
    Use the under command
    $ g++ -ldb_cxx -lboost_regex -lboost_program_options -o test_update test_update.cc db_access.cc directory.cc
    to get a test program that can update the existing records.
    To update the record, use the under command:
    $ ./test_update ubuntu -r linux -a canonical
    It will update the with the key 'ubuntu', with the label 'linux' removed and a new
    label 'canonical'.
    Great thanks to you if you've read and understood my code!
    I've said that the DB_SECONDARY_BAD exception is random. The same operation may cause
    exception in one time and may goes well in another time.
    As I've test below:
    ## Lines not started with '$' is the stdout or stderr.
    $ ./test_put linux os linus
    $ ./test_update linux -r os
    Old data| name: linux; labels: os linus
    New data| name: linux; labels: linus
    $ ./test_update linux -r linus
    Old data| name: linux; labels: linus
    New data| name: linux; labels:
    dbfile_bynam: DB_SECONDARY_BAD: Secondary index inconsistent with primary
    Db::put: DB_SECONDARY_BAD: Secondary index inconsistent with primary
    terminate called after throwing an instance of 'DbException'
    what(): Db::put: DB_SECONDARY_BAD: Secondary index inconsistent with primary
    已放弃
    Look! I've received a DB_SECONDARY_BAD exception. But thus exception does not always
    happen even under the same operation.
    For the exception is random, you may have not the "luck" to get it during your test.
    So let's insert a record by:
    $ ./test_put t
    and then give it a great number of labels:
    $ for((i = 0; i != 100; ++i)); do ./test_update t -a "label_$i"; done
    and then:
    $ for((i = 0; i != 100; ++i)); do ./test_update t -r "label_$i"; done
    Thus, the DB_SECONDARY_BAD exception is almost certain to happen.
    I've been confused by the problem for times. I would appreciate if someone can solve
    my problem.
    Many thanks!
    Wonder

  • The chapter about php_db4 in the BDB documentation need to be updated

    Hi all,
    I think the chapter about php_db4 in the BerkeleyDB documentation should be updated.
    The first sentence "A PHP 4 extension for this release of Berkeley DB..." gave me the concept that the extension can be ONLY run with PHP 4. I've got the idea that DBXML's php extension can run with PHP 5, so the BDB's extension should work with PHP 5 too.(Perhaps I'm not clever enough, but it did give me the wrong thought.)
    It's too simple in the documentation to let everyone know how to sovle the problems in compile process(and such subjects are hard to be found through search engines).
    I had compiled BDB 4.5 on my Fedora Core 6. When I make the php_db4, it could not finish normally(with some errors). When I added CPPFLAGS=-DHAVE_CXX_STDHEADERS, it solved - this should be written somewhere in the documentation or at lease in the INSTALL file, right?
    In the INSTALL file, it says "PHP can itself be forced to link against libpthread either by manually editing its build files (which some distributions do), or by building it with --with-experimental-zts". But at least I can't find this option in the configure of PHP 5.2.1. Only an option '--enable-maintainer-zts' can be found, and it is noted as 'for code maintainers only'(so it should not be enabled by end-users with less experience, isn't it?). PHP 5.2.1's TSRM is ptheads-enabled by default, I don't know whether I should follow the note about pthreads or not.
    Anyway, I can use the native API of BerkeleyDB in my php code now. Thanks for the developers! Hope the documentation can be updated with more directives, so the new users of php_db4 can use it more smoothly:-)

    nikkap wrote:
    I haven't updated to the latest software because I didn't want my google maps to change to the new version they made with poorer directions.
    To each their own, but you can always install the Google Maps app.
    nikkap wrote:
    I also didn't want to lose battery charge quicker and didn't want certain functions to cease working like wifi which I've heard has been a problem.  It just seems that since my phone is so 'old' that updating it could cause more harm than good. 
    Nothing is further from the truth.  Installing updates does not cause hardware issues or hardware to stop working.  Anyone that tells you otherwise is completely ignorant.
    I (and millions of others) have installed iOS updates with little or no adverse affects.  The vast majority of issues that arise during an iOS update can be rectified with basic troubleshooting from the User's Guide.
    There is no legitimate reason to not update the iOS which adds new features and fixes security issues in iOS.
    nikkap wrote:
    My other problem is that someone proxied the call to ATT to obtain the unlock so I don't know exactly what happened and if in fact they did agree to unlock or perhaps lied instead or did something else.  But I don't have the account information for ATT since it's a group account so i'm SOL. 
    Well, there you go.  You need to contact AT&T or get the correct information and go to AT&T's website and request the unlock.
    There are no codes, as you've already found out.
    Once the unlock has been approved, AT&T will email you to let you know it has been processed and that the next step is to restore the device.

  • I would like to be able to keep tabs from last session open but have the cookies follow my exception list. Is this possible?

    For example, I like to keep Gmail (gmail.com) and Pocket (getpocket.com) pinned but when I close Firefox, I want it to remember my pinned tabs but automatically log me out of Gmail but NOT out of Pocket. I can get close to this functionality but Gmail's cookies seem to be tied to browser history. Pocket's are not. If this is not possible, is there a place I can make it a suggestion or is this something to do with Google.
    My privacy settings: nothing checked except 'clear history when firefox closes' -- under that: only 'download history', 'active logins', 'form and search history' and 'cache' are checked.
    Any help would be appreciated.

    Gmail is probably using a secure HTTPS connection.<br />
    If getpocket<i></i>.com is using a normal HTTP connection then you can try this:
    Set the <b>browser.sessionstore.privacy_level</b> pref to 1 (non-HTTPS) on the <b>about:config</b> page to disable saving cookies from secure connection via session restore.
    * http://kb.mozillazine.org/browser.sessionstore.privacy_level

  • Office 365 App using NAPA - "The system cannot find the file specified. (Exception from HRESULT: 0x80070002)"

    Hello,
    I am creating an app using NAPA tool in Office 365. I am trying to "Add an attachment" to a custom list item using SPServices. When I am using my code  (jquery code) in content editor web part on a page, its working fine, but when I am adding
    the same code in an app, its giving me error :  "The system cannot find the file specified. (Exception from HRESULT:
    0x80070002)" - 500 Internal Server error.
    (function () {
    // This code runs when the DOM is ready and creates a context object which is
    // needed to use the SharePoint object model
    $(document).ready(function () {
    //alert('In doc ready');
    $('.attachmentButton').change(function(event){
    var listName = 'UploadTest',
    itemId = 2;
    handleFileChange(listName,itemId,event.target.files);
    function handleFileChange(listName,itemId,files){
    alert('In handleFileChange :=' + listName + "" + itemId + "" + files[0]);
    alert('files.length :=' + files.length);
    var filereader = {},
    file = {},
    i=0;
    //loop over each file selected
    for(i = 0; i < files.length; i++) {
    alert('In for loop');
    file = files[i];
    filereader = new FileReader();
    filereader.filename = file.name;
    alert('filereader.filename :=' + filereader.filename);
    filereader.onload = function() {
    var data = this.result;
    var n=data.indexOf(";base64,") + 8;
    //alert('n :=' + n);
    //removing the first part of the dataurl give us the base64 bytes we need to feed to sharepoint
    data= data.substring(n);
    //alert('data :=' + data);
    alert('Above SPServices this.filename :=' + this.filename);
    $().SPServices({
    operation: "AddAttachment",
    listName: listName,
    asynch: false,
    listItemID:itemId,
    fileName: this.filename,
    attachment: data,
    completefunc: function (xData, Status) {
    console.log('attachment upload complete',xData,status);
    alert('Status :=' + Status);
    if (Status.toLowerCase() == "error"){
    alert(xData.responseText);
    alert(xData.status);
    alert(xData.statusText);
    filereader.onabort = function() {
    alert("The upload was aborted.");
    filereader.onerror = function() {
    alert("An error occured while reading the file.");
    //fire the onload function giving it the dataurl
    filereader.readAsDataURL(file);
    alert(xData.responseText); - gives error - " "The system cannot find the file specified. (Exception from HRESULT: 0x80070002)""
    alert(xData.status); - gives error - "500"
    alert(xData.statusText); - gives error - "Internal server error"
    Server Publishing infrastructure and Server publishing features are activated on site collection and site respectively.
    Any suggestions, why I am getting this error in NAPA ?

    Hi,
    According to your post, my understanding is that you have an issue about adding attachments to list items in app.
    To add attachment to list item in the host web, we should first get the list and the list items from the host web, then add the attachments to the list items.
    There are two articles about retrieve the list and list items in the host web, you can refer to them.
    http://www.dotnetcurry.com/showarticle.aspx?ID=1028
    http://www.c-sharpcorner.com/UploadFile/93cb27/retrieve-sharepoint-app-host-web-list-items-in-sharepoint-ho/
    What’s more, we can also use the REST API to achieve the same scenario.
    http://www.c-sharpcorner.com/UploadFile/472cc1/add-attachments-to-list-items-in-sharepoint-2013-using-rest/
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

Maybe you are looking for