Internal Workings of Deserialization

I was wondering if anyone understood the internal workings of the ObjectInputStream class in respect to deserializing an object. By reading through the source code I was able to determine how the no-arg constructor of the first non-serializable superclass is called (via reflection). What is alluding me is how the appropriate sub-class is created without calling any constructor.
Related to this question is the workings of the ReflectionFactory. When the no-arg constructor of the superclass is found a method call to ReflectionFactory, newConstructorForSerialization, is called and is passed the name of the class to be created and the no-arg constructor. The constructor that is returned is stored as the no-arg constructor. Should I believe that the no-arg constructor is somehow altered to produce a chain of specialized constructors that in turn create the appropriate subclass?
Thanks for your time

See if this helps you out:
http://java.sun.com/j2se/1.4/docs/guide/serialization/spec/serialTOC.doc.html

Similar Messages

  • Java.rmi.ServerException: Internal Server Error (deserialization error: XML

    I am trying to transmit a document as a byte array to a web service using jax-rpc, and I get the following error:
    2004-05-25 08:04:39,468 exception [Thread-5] - [email protected]33fd java.rmi.ServerException: Internal Server Error (deserialization error: XML parsing error: com.sun.xml.rpc.sp.ParseException:58: Expected "</ns0:receivexmldocument>" to terminate element starting on line 2)
         at com.sun.xml.rpc.client.StreamingSender._raiseFault(StreamingSender.java:370)
         at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:231)
         at com.mobius.cmsl.client.contentindexlistener.ContentWebServiceListenerIF_Stub.receivexmldocument(ContentWebServiceListenerIF_Stub.java:63)
         at com.mobius.cmsl.adapters.convera.client.ContentWebServiceClient.sendxml(ContentWebServiceClient.java:89)
         at com.mobius.cmsl.adapters.convera.client.ContentInterceptor.doGet(ContentInterceptor.java:89)
         at com.mobius.cmsl.adapters.convera.client.ContentInterceptor.doPost(ContentInterceptor.java:110)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
         at java.lang.Thread.run(Thread.java:536)
    The code looks like:
    Client:
    clientStub = (ContentWebServiceListenerIF_Stub)new ContentIndexService_Impl().
    getContentWebServiceListenerIFPort();
    clientStub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, endPoint);
    obj = clientStub.receivexmldocument(cd.externalLink.contents,inxml);
    Web Service:
    public String receivexmldocument(byte docstream[],
    String inxml
    ) throws RemoteException {
    The wsdl looks like:
    <message name="ContentWebServiceListenerIF_receivexmldocument">
    <part name="arrayOfbyte_1" type="xsd:base64Binary"/>
    <part name="String_2" type="xsd:string"/></message>
    <operation name="receivexmldocument" parameterOrder="arrayOfbyte_1 String_2">
    <input message="tns:ContentWebServiceListenerIF_receivexmldocument"/>
    <output message="tns:ContentWebServiceListenerIF_receivexmldocumentResponse"/></operation>
    The documents I am sending do contain special characters like maybe japanese or italian.

    Sounds like the xml you are sending is not well-formed. Please start with simple xml documents to see if it works.

  • The internal workings implicitly popping from Navigation Controller

    I'm just curious to how a Navigation Controller is working when you pop out from a child view to a parent view. The reason I'm asking is because I have this kind of set up:
    App Delegate:
    Creates Nav Controller and inits it with a Root View
    Root View:
    Just some table view that allows to drill down a row to "Second View" lets call it
    When I push the second view into the Nav's stack, it'll automatically create a back button to pop. I am noticing when I hit back, it displays the Root View but the view event methods, i.e. viewWillAppear, are not called. Why is this?
    Since this is the case, what is the best way for me to reload the table view's data when I do a pop?

    Hey Ray,
    Sorry for all the confusion previously. I didn't have my personal computer at work so I wasn't able to copy/paste the exact code snippets but I can assure you that my print logs are working correctly. I actually have figured out what my issue was and I'll present to you (and anyone else who have run into a similar problem) what my problem was and what I did to solve it.
    First of all, let me address your previous questions. I am creating my Nav controller and the root view in the app delegate via the applicationDidFinishLaunching method. So something like this:
    myViewController *vc = [[myViewController alloc] initWithNibName@"myViewController" bundle:nil];
    myNavController = [[UINavigationController alloc] initWithRootViewController:myViewController];
    This was not the issue. The issue stems from the design of my app.
    The *root view controller* is actually a view that acts as a *container for two other view controllers*. One of them a *UITableViewController that controls a UITableView*, and the other is a *UIViewController that controls a MKMapView*.
    The UITableView has the ability to drill down into another table view, which invokes some actions that updates the list from the first view. This all works fine as I'm seeing in my logs.
    The problem was when I pop back to the root view I don't see the list updated; this pop back I'm referring to is the "Back" UIBarButtonItem that gets prefabbed for me when I push something to the Nav controller's stack. From my logs, the UITableViewController's inherited method, viewWillAppear is not being invoked, therefore, the [self.tableView reloadData]; that I placed in there is not being called.
    For some reason, a light bulb went on in my head today to investigate the container's view controller! *What I found out was only the container view controller's view event methods was getting called*; so all the viewWillAppear, viewDidAppear, etc... that I did not previously implement wasn't getting called and not appearing in the logs.
    So now, in the container's view controller's viewWillAppear, I call the UITableViewController's viewWillAppear, and my UITableView's list gets updated. So it's all working perfectly now.
    Thanks!

  • Internal Differences between MacBook and MacBook Pro?

    I was wondering if anyone has concrete information on whether on not the un-coustomizable, internal workings of the MacBook and MacBook Pro are different, such as the motherboard, logic board, other interfaces, etc.
    I have been talking with Apple reps and none have been able to give me a deffinate answer or written proof. Does anyone have info. supporting or refuting the statement that MacBooks and MacBook Pros are condigured/maunfactured with the same parts, aside from the Video Card?
    Thanks

    They are not the same; the disassembley pictures for both are here so you can compare for yourself
    MacBook - http://www.ifixit.com/Guide/86.1.0.html
    MacBook Pro - http://www.ifixit.com/Guide/85.1.0.html

  • Got a Deserialization Error

    Hi, I get the following Deserialization error when I used a Custom defined class as a parameter in the Client class. I followed the rules stated in the JAX-RPC tutorial:
    To be supported by JAX-RPC, an application class must conform to the following rules:
    It must have a public default constructor.
    It must not implement (either directly or indirectly) the java.rmi.Remote interface.
    Its fields must be supported JAX-RPC types.
    The class may contain public, private, or protected fields. For its value to be passed (or returned) during a remote call, a field must meet these requirements:
    A public field cannot be final or transient.
    A non-public field must have corresponding getter and setter methods.
    And when I looked in the generated class files I saw that custom object's SOAPBuilder and SOAPSerializer classes were generated.
    Also, the WSDL file thats generated included the custom object's information (member names) in the complexType section.
    ===================================================================
    java.rmi.ServerException: Internal Server Error (deserialization error: unexpected XML reader state. expected: END but found: START: arta)
    at com.sun.xml.rpc.client.StreamingSender._raiseFault(StreamingSender.java:357)
    at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:228)
    at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:54)
    at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:279)
    at com.sun.xml.rpc.client.dii.CallInvocationHandler.doCall(CallInvocationHandler.java:96)
    at com.sun.xml.rpc.client.dii.CallInvocationHandler.invoke(CallInvocationHandler.java:68)
    at $Proxy0.requestFid(Unknown Source)
    at fidserv.FidServClient.main(Unknown Source)
    ========================================================================
    Any help would be much appreciated...
    Thanks,
    Manjula

    I am invoking my own webservice designed very similar to the DII Client Example in the JWSDP Tutorial. Basically the problem I have now is that I can't pass around any arrays or user-defined objects as Parameters from the client. I have put in lines to the config.xml to include the Integer array type and userdefined class. Is there any documentation on how to do this? I am trying to use an int[] as a parameter...
    I keep getting a java.lang.Class cast exception:
    serialization error: java.lang.ClassCastException
    at com.sun.xml.rpc.encoding.PolymorphicArraySerializer.serialize(PolymorphicArraySerializer.java:106)
    at com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.serialize(ReferenceableSerializerImpl.java:59)
    at com.sun.xml.rpc.encoding.soap.SOAPRequestSerializer.doSerializeInstance(SOAPRequestSerializer.java:84)
    at com.sun.xml.rpc.encoding.ObjectSerializerBase.serialize(ObjectSerializerBase.java:100)
    at com.sun.xml.rpc.client.StreamingSender._writeRequest(StreamingSender.java:441)
    at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:63)
    at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:54)
    at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:279)
    at fidserv.FidServClient.main(Unknown Source)
    Below is my Client Code:
    public class FidServClient {
         private static String endpoint = "http://localhost:8080/fidserv-jaxrpc/fidserv";
         private static String qnameService = "FidService";
         private static String qnamePort = "FidServPort";
         private static String BODY_NAMESPACE_VALUE = "http://com.test/wsdl/FidService";
         private static String ENCODING_STYLE_PROPERTY = "javax.xml.rpc.encodingstyle.namespace.uri";
         private static String NS_XSD = "http://www.w3.org/2001/XMLSchema";
         private static String URI_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/";
         public static void main(String[] args) {
              try
                   ServiceFactory factory = ServiceFactory.newInstance();
                   Service service = factory.createService(new QName(qnameService));
                   QName port = new QName(qnamePort);
                   Call call = service.createCall(port);
                   call.setTargetEndpointAddress(endpoint);
                   call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true));
                   call.setProperty(Call.SOAPACTION_URI_PROPERTY, "");
                   call.setProperty(ENCODING_STYLE_PROPERTY, URI_ENCODING);
                   QName QNAME_TYPE_STRING = new QName(NS_XSD, "string");
                   QName QNAME_TYPE_LONG = new QName(NS_XSD, "long");
                   QName QNAME_TYPE_INT = new QName(NS_XSD, "int");
                   //QName QNAME_TYPE_INT_ARRAY = new QName(NS_XSD, "Array");
                   //Temp parameters
                   String acid = "UAL500";
                   String orig = "IAD";
                   String dest = "LAX";
                   Long sgtd = new Long(1010);
                   Long artd = new Long(1020);
                   Long arta = new Long(1520);
                   Long data_time = new Long(2010);
                   Long fid = new Long(5555);
                   int[] known_fids = new int[2];
                   known_fids[0] = 0;
                   known_fids[1] = 1;
                   //ResultTypes
                   Long resultRequest = new Long(0);
                   String resultUpdate = new String("");
                   //for (int i = 0; i < 20; i++){
                        //***** Call to requestFid *******************************************************
                        call.removeAllParameters();
                        call.setReturnType(null);
                        call.setReturnType(QNAME_TYPE_LONG);
                        call.setOperationName(new QName(BODY_NAMESPACE_VALUE, "requestFid"));
                        call.addParameter("String_1", QNAME_TYPE_STRING, ParameterMode.IN);
                        call.addParameter("String_2", QNAME_TYPE_STRING, ParameterMode.IN);
                        call.addParameter("String_3", QNAME_TYPE_STRING, ParameterMode.IN);
                        call.addParameter("long_4", QNAME_TYPE_LONG, ParameterMode.IN);
                        call.addParameter("long_5", QNAME_TYPE_LONG, ParameterMode.IN);
                        call.addParameter("long_6", QNAME_TYPE_LONG, ParameterMode.IN);
                        call.addParameter("long_7", QNAME_TYPE_LONG, ParameterMode.IN);
                        call.addParameter("arrayOfint_8", XMLType.SOAP_ARRAY, ParameterMode.IN);                    
                        resultRequest = (Long)call.invoke(new Object[]{acid, orig, dest, sgtd, artd, arta, data_time,
    known_fids });     
                        System.out.println("RequestFid: " + resultRequest);          
    Thanks for the help

  • Help! Can no longer connect xp to my AP Express

    Hi all,
    I've had an aiport express base station for a few years now.
    I recently had to reset it, and ever since, cannot use my xp notebook on it.
    I also have a desktop pc (with belkin wifi card) and a macbook, which connect fine.
    My XP notebook (a Lenovo T60) sees the network and connects, but no web/email throughput (interestingly enough, I can get streaming internet radio).
    It's WEP encrypted, btw, but the same problems occur when it's not. Also, I can use the airport utilities regardless...
    Any ideas? I'm clueless at this point.
    - JG

    Thanks BD, I'll look into that.
    Whilst in terminal I followed someone's instructions to "fsck -fy".
    I don't know what the words mean, but it appeared to run a full check on the disk. No problems found. Is that as good as running Disk Utility?
    As I say, it seems to me possible (complete guesswork here as I know nothing about Apple's internal workings) that - whilst Time Machine was storing my files in a dedicated folder on my drive* - it was also making its own SnowLeopard changes to files within the invisible "var" folder on that drive (or some such other system folder); and that those changes have prevented Tiger from recognising my users and passwords. If were the case, then perhaps there is something straightforward I can do to point Tiger back towards my users - with or without passwords.
    I've also just spotted this: http://www.macobserver.com/tip/2003/06/16.1.shtml
    Anyone know if I'm likely to do more harm than good with it?
    I won't have time to do either today - but very grateful for any further suggestions.

  • After upgrading to Windows 8, FireFox only brought in A-C. Bookmarks were arranged in folders. How do I import?

    After upgrading one of our PCs to Windows 8, not all of the bookmarks were in FireFox upon opening the browser for the first time after the upgrade. Only A-C were brought in. We've tried several methods of getting the rest back into the browser with no such luck.
    The folder where all the bookmarks are housed was found and backed up. The problem as I see it is that all of the individual bookmarks were sorted into Folders. When the main Bookmarks folder is opened, it contains individual pages (similar to what one would see if they saved the page as a .html page, instead of printing or another save method), and then there are subfolders, that contain even more individual pages. (If this is confusing, I can post an image or a link to an image.) In order to access a bookmarked page, we currently have to go to File Explorer, navigate to the Bookmarks folder, search through the links (which show as the full URL) and folders, to click on the url to have it open in the default browser.
    As far as I've been able to discern, through research and trial-and-error, these won't be read by FireFox in the format they are as I view them currently; they need to be in one single .html with links and sublinks, not individual clickable pages. But since they are no longer viewable in the Bookmarks section in FireFox, I am unable to Export them to the correct format.
    How do I get *all* of the bookmarks back into FireFox's Bookmarks menu dropdown?
    Thanks.
    (Btw, the computer/browser I'm using are not the PC in reference above, in fact, it is not even a PC, so please do not use any info that may show regarding any automatically inserted text about the "internal workings of [my] browser, as it is of no value to this issue.)

    The disk folder you're describing sounds a lot like the Windows Favorites folder. That's actually completely independent from Firefox's bookmark storage.
    After your upgrade, did you freshly install Firefox? In that case, the problem might be an incomplete import of your Windows Favorites (IE Favorites) instead of an incomplete recovery of your old Firefox bookmarks.
    To see whether you still have your Firefox bookmarks, in your backup -- for example, the C:\Windows.old\ folder, or a backup on external media -- could you try to track down a folder named '''bookmarkbackups'''. By default, this is hidden folder, so you may need to turn on viewing of hidden files and folders. This article has the steps: [http://windows.microsoft.com/en-us/windows/show-hidden-files].
    Let me know what you find and then I can suggest next steps.

  • Please help!! Computer dummy + water damage

    I know this is a very common, probably annoying, question asked in Apple forums but I can't find a recently updated discussion page to post this on. My Google searches aren't really coming up with a specific answer, just pages of forums from 2005-2008. I didn't see any with recent dates, and I really need someone to give advice asap. I am in graduate school and desperately need to get my computer running again or at the VERY least find out if the hard drive is still functional so I can access my important files and transfer them to a new computer.
    My Macbook was sitting on my bed, closed and unplugged. I am normally very careful with my Macbook, and I thought my Nalgene water bottle was tightly closed (it wasn't) and a safe distance from my laptop (wrong again). Since water bottles don't fly, I assume my cat knocked my water bottle off the bedside table and onto the bed....more specifically, onto my Macbook. I was in the bathroom getting ready for bed when this occurred. I came out of the bathroom to find a large puddle on the bed and an empty water bottle nearby. And just my luck, the Macbook was right in the middle of the puddle. It was about 15 ounces of water. The area surrounding the computer was soaked through the bedspread, all the way down to the sheets. I'm guessing the water was on the laptop for about 3-5 minutes while I was out of the room.
    Here is what I did upon finding this disaster:
    1) I immediately moved the Macbook to a dry area, and used a dry towel to blot up what I thought was all of the water. Some water had even gotten to the keyboard/screen, even though the laptop was closed.
    2) I was not thinking straight and I know nothing about internal workings of laptops, so I performed the panicky knee-jerk reaction.... "ok, I got most of the water, I should check see if it still works" and tried to turn it on. I realize now that was a dumb move, and I am very angry with myself. But anyway, it began to start up normally, but right after making the Apple noise that it usually makes upon restarting, it faded to a blue screen with the apple logo for a second, then went black. I know this is bad, but I didn't heard any abnormal noises like something was being fried, it just shut off.
    3) I removed the plastic Incase protective shell. Note to self: it is not watertight. Some water was trapped underneath the shell, but I didn't realize how much had gone inside the computer yet.
    4) I dried off the top and bottom of the laptop
    5) I removed the battery. Water came dripping out. Sad times.
    6) With another dry towel, I blotted everywhere I could to soak up as much water as possible, and placed the laptop on a towel on a desk in an upside down V shape. The battery is next to it.
    This all happened at 11pm on 2/2/2010. The Macbook has been sitting in the same position ever since, in a low-humidity room with an overhead fan. I do not have Apple Care but I know water damage isn't covered anyway. I've also read that Apple charges anywhere from $700-900 to repair water damage, so I might as well buy a new laptop if this damage is irreparable. Given my situation, my questions are:
    1) How much longer should I wait before trying to turn it back on? It has been almost 48 hours.
    2) Can anyone give me any advice (other than "be more careful next time") for what to do next? Does putting the laptop in a sealed box full of rice really help get the moisture out? How about a hair dryer?
    3) Should I follow the instructions on ifixit.com to take the computer apart to allow for more evaporation? Because if it is strongly recommended that I do this, I can have my fiance (who is very good with computers) do it for me....but I am very worried that taking it apart will damage it even further.
    3) If all else fails and the logic board is fried, can I still remove the hard drive and get my files off of it?
    Any responses will be greatly appreciated.

    hey, sorry to hear about your computer.
    i'll try to answer your questions, so here goes:
    1. you could try again to turn on the computer, but the only issue is that the parts of the computer are already fried and might not work. you could try though, it can't hurt to try. also, when doing this listen for beeps coming from the computer. if that happens, i can send a list of beep codes that might narrow down what might have been damaged.
    2. i have heard that rice does work since it absorbs a lot of moisture. i've never (thankfully) had to try it before, but other people says it works fine. you might try that before turning on the computer again. it'll just get rid of the excess moisture.
    3. taking apart the computer won't damage it if done correctly. ifixit is a good place to go for that kind of stuff. just know that if something does break, you'll be charged for a replacement part (though it looks like you'll have to pay for some replacements anyway). this might work for drying out, but i'd stick with the rice to be safe, just because it doesn't involve disassembling the computer.
    4. if your logic board is fried, you can possibly recover the data from the hard drive. the only possibility is that water entered the drive, rendering it useless. if you are going to attempt to salvage the hard drive, you'll need another laptop to put it in or get a drive reader. it plugs into another computer and reads the drive through the Disk Utility. i'm not quite sure where to get those, but i'm sure you can find on on Newegg.com or some reputable computer parts store.
    i'm not totally sure how much apple charges for water damage repairs, but it's worth going to a store and they can see whats wrong and come up with an estimate and then decide whether to get a new macbook or to forgo the cost of repairs.
    i'm really sorry to hear about your macbook, but i really hope something can be done. write back if you need more help.
    -MacDarling55

  • Controlling the page of an SQL report region

    I have an SQL report region containing 70 rows. It shows the status of a bidding process that takes place in sequence, from the guy in the first row to the guy in the last. I use a "red light/green light" technique in each row to show who is currently eligible.
    Typically users will login and then hit the next button to get to where the action is once the first 15 folks are done (number of rows = 15). Is there some way to set which set of rows first appears?
    I looked at the URLs. When I first logged in I got:
    http://htmldb.ciscoinc.com/bill/f?p=173:3:15341208186623218430::NO:::
    After clicking "Next" I got:
    http://htmldb.ciscoinc.com/bill/f?p=173:3:15341208186623218430:pg_R_4821423314714801953:NO&pg_min_row=16&pg_max_rows=15&pg_rows_fetched=15
    How do I come up with:
    pg_R_4821423314714801953 ?
    Any thoughts? Thanks.
    Bill

    Bill,
    I would suggest using a dynamic query that’s referencing a page item to limit the result set so that the correct records are shown when the user branches to the report page. Manually modifying the pagination URL is not supported. The URL contains the internal region ID, and is setting some internal pagination variables. The internal workings of report pagination could change in future versions of HTML DB, so manually manipulating those values could cause your report to break duing a future upgrade.
    Regards,
    Marc

  • Redesigning the Collections Framework

    Hi!
    I'm sort of an experienced Java programmer, in the sense that I program regularly in Java. However, I am not experienced enough to understand the small design specifics of the Collections Framework (or other parts of Javas standard library).
    There's been a number of minor things that bugged me about the framework, and all these minor things added up to a big annoyance, after which I've decided to (try to) design and implement my own framework.
    The thing is however, that since I don't understand many design specifics about the Collection Framework and the individual collection implementations, I risk coming up short with my own.
    (And if you are still reading this, then I thank you for your time, because already now I know that this entry is going to be long. : ) )
    Since I'm doing my Collection framework nearly from scratch, I don't have to worry too much about the issue of backwards compatibility (altough I should consider making some parts similar to the collection framework as it is today, and provide a wrapper that implements the original collection interfaces).
    I also have certain options of optimizing several of the collections, but then again, there may be very specific design issues concerning performance and usability that the developers of the framework (or other more experienced Java progammers) knew about, that I don't know.
    So I'm going to share all of my thoughts here. I hope this will start an interesting discussion : )
    (I'm also not going to make a fuss about the source code of my progress. I will happily share it with anyone who is interested. It is probably even neccessary in order for others to understand how I've intended to solve my annoyances (or understand what these annoyances were in the first place). ).
    (I've read the "Java Collections API Design FAQ", btw).
    Below, I'm going to go through all of the things that I've thought about, and what I've decided to do.
    1.
    The Collections class is a class that consists only of static utility methods.
    Several of them return wrapper classes. However the majority of them work on collections implementing the List interface.
    So why weren't they built into the List interface (same goes for methods working only with the Collection interface only, etc)? Several of them can even be implemented more efficiently. For example calling rotate for a LinkedList.
    If the LinkedList is circular, using a sentry node connecting the head and tail, rotate is done simply by relocating the sentry node (rotating with one element would require one single operation). The Collections class makes several calls to the reverse method instead (because it lacks access to the internal workings of a LinkedList).
    If it were done this way, the Collections class would be much smaller, and contain mostly methods that return wrapped classes.
    After thinking about it a while, I think I can answer this question myself. The List interface would become rather bloated, and would force an implementation of methods that the user may not need.
    At any rate, I intend to try to do some sort of clean-up. Exactly how, is something I'm still thinking about. Maybe two versions of List interfaces (one "light", and the other advanced), or maybe making the internal fields package private and generally more accessible to other package members, so that methods in other classes can do some optimizations with the additional information.
    2.
    At one point, I realized that the PriorityQueue didn't support increase\decrease key operations. Of course, elements would need to know where in the backing data structure it was located, and this is implementation specific. However, I was rather dissapointed that this wasn't supported somehow, so i figured out a way to support this anyway, and implemented it.
    Basically, I've wrapped the elements in a class that contains this info, and if the element would want to increase its key, it would call a method on the wrapping class it was contained in. It worked fine.
    It may cause some overhead, but at least I don't have to re-implement such a datastructure and fiddle around so much with the element-classes just because I want to try something with a PriorityQueue.
    I can do the same thing to implement a reusable BinomialHeap, FibonacciHeap, and other datastructures, that usually require that the elements contain some implementation-specific fields and methods.
    And this would all become part of the framework.
    3.
    This one is difficult ot explain.
    It basically revolves around the first question in the "Java Collections API Design FAQ".
    It has always bothered me that the Collection interface contained methods, that "maybe" would be implemented.
    To me it didn't make sense. The Collection should only contain methods that are general for all Collections, such as the contains method. All methods that request, and manipulate the Collection, belonged in other interfaces.
    However, I also realized that the whole smart thing about the current Collection interface, is that you can transfer elements from one Collection to another, without needing to know what type of Collection you were transferring from\to.
    But I still felt it violated "something" out there, even if it was in the name of convenience. If this convenience was to be provided, it should be done by making a separate wrapper interface with the purpose of grouping the various Collection types together.
    If you don't know what I'm trying to say then you might have to see the interfaces I've made.
    And while I as at it, I also fiddled with the various method names.
    For example, add( int index, E element), I felt it should be insert( int index, E element). This type of minor things caused a lot of confusion for me back then, so I cared enough about this to change it to somthing I thought more appropriate. But I have no idea how appropriate my approach may seem to others. : )
    4.
    I see an iterator as something that iterates through a collection, and nothing else.
    Therefor, it bothered me that the Iterator interface had an optional remove method.
    I myself have never needed it, so maybe I just don't know how to appreciate it. How much is it used? If its heavily used, I guess I'm going to have to include it somehow.
    5.
    A LinkedList doesnt' support random access. But true random access is when you access randomly relative to the first index.
    Iterating from the first to the last with a for statement isn't really random access, but it still causes bad performance in the current LinkedList implementation. One would have to use the ListIterator to achieve this.
    But even here, if you want a ListIterator that starts in the middle of the list, you still need to traverse the list to reach that point.
    So I've come up with LinkedList that remembers the last accessed element using the basic methods get, set, remove etc, and can use it to access elements relatively from it.
    Basically, there is now an special interal "ListIterator" that is used to access elements when the basic methods are used. This gives way for several improvements (although that may depend how you look at it).
    It introduces some overhead in the form of if-else statemenets, but otherwise, I'm hoping that it will generally outperform the current LinkedList class (when using lists with a large nr of elements).
    6.
    I've also played around with the ArrayList class.
    I've implemented it in a way, that is something like a random-access Deque. This has made it possible to improvement certain methods, like inserting an element\Collection at some index.
    Instead of always shifting subsequent element to the right, elements can be shifted left as well. That means that inserting at index 0 only requires a single operation, instead of k * the length of the list.
    Again, this intrduces some overhead with if-else statements, but is still better in many cases (again, the List must be large for this to pay off).
    7.
    I'm also trying to do a hybrid between an ArrayList and a Linked list, hopefully allowing mostly constant insertion, but constant true random access as well. It requires more than twice the memory, since it is backed by both an ArrayList and a LinkedList.
    The overhead introduced , and the fact that worst case random access is no better than that of a pure LinkedList (which occurs when elelements are inserted at the same index many times, and you then try to access these elements), may make this class infeasible.
    It was mostly the first three points that pushed my over the edge, and made me throw myself at this project.
    You're free to comment as much as you like.
    If no real discussion starts, thats ok.
    Its not like I'm not having fun with this thing on my own : )
    I've started from scratch several times because of design problems discovered too late, so if you request to see some of the source code, it is still in the works and I would have to scurry off and add a lot of java-comments as well, to explain code.
    Great. Thanks!

    This sort of reply has great value : )
    Some of them show me that I need to take some other things into consideration. Some of them however, aren't resolved yet, some because I'm probably misunderstanding some of your arguments.
    Here goes:
    1.
    a)
    Are you saying that they're were made static, and therefor were implemented in a utility class? Isn't it the other way around? Suppose that I did put them into the List interface, that would mean they don't need to be static anymore, right?
    b)
    A bloated List interface is a problem. Many of them will however have a default not-so-alwyas-efficient implementation in a abstract base class.
    Many of the list-algorithms dump sequential lists in an array, execute the algorithm, and dump the finished list back into a sequential list.
    I believe that there are several of them where one of the "dumps" can be avoided.
    And even if other algorithms would effectively just be moved around, it wouldn't neccesarily be in the name of performance (some of them cannot really be done better), but in the name of consistency\convenience.
    Regarding convenience, I'm getting the message that some may think it more convenient to have these "extra" methods grouped in a utility class. That can be arranged.
    But when it comes to consistency with method names (which conacerns usability as well), I felt it is something else entirely.
    For example take the two methods fill and replaceAll in the Collections class. They both set specific elements (or all of them) to some value. So they're both related to the set method, but use method names that are very distinguished. For me it make sense to have a method called setAll(...), and overload it. And since the List interface has a set method, I would very much like to group all these related methods together.
    Can you follow my idea?
    And well, the Collections class would become smaller. If you ask me, it's rather bloated right now, and supports a huge mixed bag of related and unrelated utitlity methods. If we should take this to the extreme, then The Collections class and the Arrays class should be merged.
    No, right? That would be hell : )
    2,
    At a first glance, your route might do the trick. But there's several things here that aren't right
    a)
    In order to delete an object, you need to know where it is. The only remove method supported by PriorityQueue actually does a linear search. Increase and decrease operations are supposed to be log(n). Doing a linear search would ruin that.
    You need a method something like removeAt( int i), where i would be the index in the backing array (assuming you're using an array). The elemeny itself would need to know that int, meaning that it needs an internal int field, even though this field only is required due to the internal workings of PriorityQueue. Every time you want to insert some element, you need to add a field, that really has nothing to with that element from an object-oriented view.
    b)
    Even if you had such a remove method, using it to increase\decrease key would use up to twice the operations neccesary.
    Increasing a key, for example, only requires you to float the element up the heap. You don't need to remove it first, which would require an additional log(n) operations.
    3.
    I've read the link before, and I agree with them. But I feel that there are other ways to avoid an insane nr of interfaces. I also think I know why I arrive at other design choices.
    The Collection interface as it is now, is smart because it can covers a wide range of collection types with add and remove methods. This is useful because you can exchange elements between collections without knowing the type of the collection.
    The drawback is of course that not all collection are, e.g modifiable.
    What I think the problem is, is that the Collection interface is trying to be two things at once.
    On one side, it wants to be the base interface. But on the other side, it wants to cast a wide net over all the collection types.
    So what I've done is make a Collection interface that is infact a true base interface, only supporting methods that all collection types have in common.
    Then I have a separate interface that tries to support methods for exchanging elements between collections of unknown type.
    There isn't neccesarily any performance benefit (actually, it may even introduces some overhead), but in certainly is easier to grasp, for me at least, since it is more logically grouped.
    I know, that I'm basically challenging the design choices of Java programmers that have much more experience than me. Hell, they probably already even have considered and rejected what I'm considering now. In that case, I defend myself by mentioning that it isn't described as a possiblity in the FAQ : )
    4.
    This point is actually related to point 3., becausue if I want the Collection interface to only support common methods, then I can't have an Iterator with a remove method.
    But okay....I need to support it somehow. No way around it .
    5. 6. & 7.
    The message I'm getting here, is that if I implement these changes to LinkedList and ArrayList, then they aren't really LinkedList and ArrayList anymore.
    And finally, why do that, when I'm going to do a class that (hopefully) can simulate both anyway?
    I hadn't thought of the names as being the problem.
    My line of thought was, that okay, you have this arraylist that performs lousy insertion and removal, and so you avoid it.
    But occasionally, you need it (don't ask me how often this type of situation arises. Rarely?), and so you would appreciate it if performed "ok". It would still be linear, but would often perform much better (in extreme cases it would be in constant time).
    But these improvements would almost certainly change the way one would use LinkedList and ArrayList, and I guess that requires different names for them.
    Great input. That I wouldn't have thought of. Thanks.
    There is however some comments I should comment:
    "And what happens if something is suibsequently inserted or removed between that element and the one you want?"
    Then it would perform just like one would expect from a LinkedList. However if that index were closer to the last indexed position, it would be faster. As it is now, LinkedList only chooses either the first index or the last to start the traversal from.
    If you're working with a small number of elements, then this is definitely not worth it.
    "It sounds to me like this (the hybrid list) is what you really want and indeed all you really need."
    You may be right. I felt that since the hybrid list would use twice as much memory, it would not always be the best choice.
    I going to think about that one. Thanks.

  • How can I replace soundtrack in QT7 movie by other one?

    Hi There,
    I am trying to replace soundtrack from one movie by other soundtrack of better quality al in the same movie. How it can be done in QT7? And can I adjust it some video does not overlap audio? I am experimenting with movie properties window but I can't drag and drop new soundtrack there.
    Thanks

    I'm not sure that I will ever understand why anyone who is not intimately familiar with the internal workings of iSync would ever want to do this - just to be able to see a more desirable icon appear - but, that said, here is how to do it:
    Rename a copy of your tiff file: SET610.tiff
    First, make a copy of iSync. No, really. [The process of reinstalling and updating iSync 2 is rather painful.]
    Control-click on iSync and select Show Package Contents, then navigate this path…
    Contents:Plugins:ApplePhoneConduit.syncdevice:Contents:PlugIns:PhoneModelsSync.p honeplugin:Contents:Resources
    There - in the Resources folder - you will find the SET610.tiff file to replace.

  • AT&T upgrade jargon, if anyone knows (for iPhone 6)

    I have an iPhone 5C, which has served me pretty faithfully for the time that I've had it. Sadly, over the weekend it was dropped onto a hard floor and broke. (It had been in a case, which I had removed for cleaning...of course.) The screen is intact but full of flashing lines instead of being visible. Also the light on the back won't turn off. I've got a picture of what it's doing now if anyone is interested. I'd like to get an iPhone 6, if possible, since iOS 8 seems to be rather creaky on the iPhone 5C.
    My phone is on my parents' plan, so my mother told me to check if an upgrade is available. I went to AT&T's site, and this is what it told me:
    "Congratulations! This line is eligible for an AT&T NEXT installment plan upgrade. Or upgrade with a 2-year service agreement and a $40 upgrade."
    Forgive me, but I have no idea what this means. I mean, I do, but I don't trust AT&T any farther than I can throw them, and my inherently suspicious  nature makes me suspect that they're not being entirely honest, i.e., they're trying to bait me in by making me think an upgrade would be free or just a one-time $40 payment. What follows is a list of several phones listing how much they would cost a month.
    What's the difference between an "installment plan upgrade" and a "2-year service agreement" costing $40? I figure that what AT&T is trying to sell me is a new phone with a two-year contract on top of the one my family already has.
    Again, forgive my ignorance if I am way off, but I'd just like to understand what my options are before I march into the AT&T store to get a new phone. Of course, if anyone thinks that it might be cheaper to take the phone to the Apple Store to have it repaired, tell me. The internal workings seem to be alright, as I plugged it into my MacBook Pro to back it up. This is the state it's in now:

    iPhone 5C out of warranty replacement is $269.
    Or upgrade with a 2-year service agreement and a $40 upgrade."
    This simply puts you into a 2 year extension of you current AT&T contract.
    You get to pay $199 for a new iPhone in addition to the $40 fee from AT&T is the “upgrade/activation” fee (it’s simply extra $$ they can get from consumer).
    Just tell them you do not want to pay it or want it refunded. They can easily do this.
    This line is eligible for an AT&T NEXT installment plan upgrade.
    The “installment plan upgrade" (aka the NEXT plan) is you simply purchase a new phone at full price and the payments are spread out over 20 or 24 months.
    You are not stuck on a 2 year contract. In addition, your service is usually $25 less per month (but you pay an extra +$25 for the phone).
    Either way, you are paying the same full price for the phone (whether it is directly for the phone or extra $$ on the 2 year contract).

  • A bunch of ArrayLists

    Overview
    My program needs to store 11 different types of data (numbered 1 through 12, skipping 5, although I may find a way to fill this gap soon). Each type of data needs to have a bunch of entries of undeterminate size (ArrayList), but I know there will always be 11 different types of data. I figured instead of having 11 different ArrayList variables and 11 getters, 11 setters, and 11 removers, I could just store them all in an array of some sort, and then only have 1 getter/setter/remover/etc which takes an argument of what data type it is.
    Problem
    Problem is, I'm not exactly sure what to use to group these ArrayLists together. I tried an array, but it complains about the generic typing:
    ArrayList<Resource> resList[] = new ArrayList<Resource>[13]();
    or any combination/order of [13] and () and it always complains "Cannot create a generic array of ArrayList<Resource> or "Cannot convert from ArrayList<Resource> to ArrayList<Resource>[]"
    Solution
    Using basic google skills, I discovered I could use:
    ArrayList resList[] = new ArrayList[12];
    essentially just dropping the type...
    and then loop through the 13 new ArrayList<Resource>();
    Resulting Problem
    Then when I go to add one of the datatypes to its respective data type ArrayList
    resList[Resource.PATH].add(new Path());
    it warns me: "...Type Safety... raw type ArrayList... should be Parameterized"
    it also says the same thing, somewhat surprisingly, when I generalize the path data type back down to Resource:
    resList[Resource.PATH].add((Resource)new Path());
    since I did declare each arraylist of type <Resource>. Yet it makes the same complaint.
    Conclusion
    There's basically 4 possible outcomes to this that I can think up.
    1) (Mostly desirable) There is a solution to my Type Safety warning.
    2) (Undesirable) use @SuppressWarnings
    3) An alternative to bunching them in arrays (I had a glance at Arrays.asList, but wasn't so sure about it)
    4) (Undesirable) just leave them as 11 different ArrayList variables and make them public.
    Thanks in advance,
    -IsmAvatar

    @musicalscale, thanks, I think. Is this just creating
    an ArrayList of ArrayLists? Because I don't think
    that's appropriate here because the 11 data types are
    unchanging (until I fill in the gap at 5, in which
    case it's simply a matter of slight recoding which
    I'm more than happy to do).Yes, it's an ArrayList of ArrayLists. It will get rid of the generics warnings. If you don't plan on changing the size of the outer ArrayList, then you don't have to change it. Only your one class that keeps the private ArrayList of ArrayLists will have direct access to the outer list (unless you code it otherwise). So, you don't have to worry that someone else will mess up the list.
    Or, after you create the initial list of lists, store the private reference as an unmodifiable List:
    private final List< List < Resource > > resList;// In your constructor (or another method):
    // create tempResList with generics as described,
    // then set the instance variable as
    resList = Collections.unmodifiableList(tempResList);Then even your local class can't add or remove things from the outer list (they can still modify the inner lists).
    As for HashMap, I guess it doesn't matter that the
    order may change, since we have the key paired with
    it. But is HashMap also dynamically resizable? Maybe
    I'm just blind to the internal workings.Yes, a HashMap is dynamically resizable. Since you have a key, yes, the order doesn't matter (there is also a TreeMap that keeps the keys sorted, but you don't really need that for your stated purposes). You can make an unmodifiable Map similar to how you make an unmodifiable List.

  • Firefox 22.0 ONLY connects to Internet in Windows 7 'Safe Mode' (IE does connect)

    FireFox 22.0 only works in Windows 7 'Safe Mode'. Any other program on computer that needs the Internet connects fine; i.e. the Internet connection is good.
    Have not recently installed an update, nor 'Add-On'; this is PURELY a FireFox problem. The problem started "suddenly".. no new installs of programs etc.
    Actions:
    - Deleted Firefox; Re-Installed it → Same result, FF does not connect
    - Reset Computer to earlier time/date → Same result.
    - Created new FireFox Profile; signed in with new profile → Same result.
    - Renamed 'Firefox.exe' to 'Firefox1.exe' → Same Result
    - Run 'Norton Antivirus' scan → no problems found; Same result
    - Deleted "Norton AntiVirus' → Same result.
    - Run latest updated 'Malwarebytes Anti-Malware' scan → no problems found; Same result
    - Deleted 'Anti-Malware' → Same result.
    - Cleaned Registry of any 'Mozilla' and 'FireFox' reference → Same result
    → Checked in 'Safe Mode' 'Task Manager - Processes' ... few files there.
    → Checked in 'Normal Mode' 'Task Manager - Processes'.. a lot of files there...
    > In 'Normal Mode' deleted 'Processes' files to bare minimum, testing FireFox after each deletion → Same Result.
    Note:
    In Windows 7 'Safe Mode', there are two files which are NOT shown in 'Normal Mode' in
    'Task Manager - Processes';
    - ctfmon.exe &
    - dllhost.exe.
    Can't find info on them if they're needed by FireFox or not to connect to the Internet.
    > In 'Safe Mode': they are present, and FF connects.
    > In 'Normal Mode': they're not present, FF does NOT connect.
    Could still be coincidence.
    As for the "Troubleshooting Information" that's associated with the Question page for posting this question ("..This information gives details about the internal workings of your browser that will help in answering your question...."):
    "...A window will (NOT) open in the top corner..."...
    Because it ONLY works in FireFox webbrowser.. and guess what?...
    My Mozilla FireFox Web Browser can NOT connect to the Internet... (See Top of this Question Page).
    And guess what happens when I click on "...Try these manual steps..." to provide troubleshooting information?!?!?!?
    Another "..Fill in the details of your question.." page opens up...
    Anybody any thoughts? Pascal Finette? Jamie Zawinski? Dave Hyatt? Joe Hewitt? Blake Ross?
    Maybe anybody else from the Netscape Navigator days still around??!?! ;-)

    Had deleted '''HideMyIP-P''' from computer recently, and didn't have problems untill I re-started computer... Which, come to think of it now, wasn't until a few days after deleting ''''HMIP-P''''... (computer is 'on' 24/7).
    Then, on start-up, it wouldn't allow FireFox to connect to the Internet.
    After reading through the website you recommneded, which mentiond ''HideMyIP-P'', I re-Installed ''HMIP-P'', then turned the "hiding" 'off' and was allowed(!) with FireFox to connect again.

  • How  to communicate with a remote application that uses http post to request connection

    Ok, I will try to make this simple as to avoid any
    confusion.
    I am trying to receive connection requests from remote applications installed on user pc's.
    The application uses POST method to send the request to connect to my database, and if required update some tables.
    The application is not a webpage. I have no access to the internal workings of the application nor do I have any specific information about how it sends its POST. I am sure of the following:
    The app will POST to my .cfm page
    "IsConnectionAllowed" = "yes"
    This is asking my cfm page if its ok to connect. I would need to use a <cfif> to verify the the first part of the POST is in fact
    "IsConnectionAllowed" = "yes"
    If this returns true, (the app also uses to POST to pass "username" and "password") my .cfm page will then perform a query and check the username and password against the database. If a matching record is found, the application expects my page to reply with
    "#Answer# OK- connected;"
    Once the answer is given the application will then respond with data to insert or update my tables.
    Now, I know how to do the queries and update tables etc, but I have never received data from an application before.
    I tried using the <cfform> tag with a mehod of GET, and then trying to send my reply with <cfoutput>, but that didn't work. The application doesn't give any feedback or error messages. It either connects or not.
    I also tried the <cfhttp> tag, but that didnt work either. I am not very experinced with coldfusion. I used it years ago and am just getting back into it.
    I am sure this is a pretty easy thing to do, but my methods arent working.
    Using the above information, can somone please show me how I would accomplish this communication? I can then use the same method to retrieve the data for my table updates and queries.
    Here is a sample of what I have already tried:
    <cfform method="get">
    <cfif>
    "IsConnectionAllowed" = "yes"
    <!-- I need to query a username or password. But for testing I will just give the OK to connect -->
    <cfoutput>#Answer# Ok - connected;</cfoutput>
    <cfelse>
    <!-- When I query username and password, if the query returns no records I deny the connection -->
    <cfoutput>#Answer# Not connected;</cfoutput>
    </cfif>
    </cfform>
    BTW, I have examples of this being done using .php and .asp. I need to do this using .cfm. I can post the either the .php or.asp code if it will be helpful in converting the function into a .cfm page.

    Thanks Fernis.
    That code allowed me to connect!
    I have an error on the remote application, but I think thats due to the fact that I commented out the database connection and query strings. As I am mostly concerned with connection at this point, I just wanted to test that my cfm page will recognise the POST request and send the right answer, In this case
    ##Answer## Ok - connected;
    That worked perfectly and the application received the ok to connect.
    I can now use your code as a base to carry on with my database connection and update query.
    I can't thank you enough. I wouldnt have figured that out in a million years of trial and error.
    I knew it was simple though. I was over thinking it.
    I do have one last question though... In the code you presented you have
    <cfif structKeyExists(Form,"isConnectionAllowed") AND form.isConnectionAllowed EQ "yes">
    Can you you explain this    structKeyExists(Form,"isConnectionAllowed")
    I have never seen this before. Why the Form followed by a comma? I am guessing you are asking if there is an element in the POST called "isConnectionAllowed". Is that correct?  If so, do I not need to do that for each POST'ed element such as username, password, and each of the other fields that will be updated in the session?

Maybe you are looking for