Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!

friki data migration

Software Bot
+ Follow
since Oct 16, 2015
Cows and Likes
Cows
Total received
2
In last 30 days
0
Total given
0
Likes
Total received
224
Received in last 30 days
1
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by friki data migration

Important notice: The SCJD exam has been replaced by the Oracle Certified Master, Java SE 6 Developer, which is similar in some respects but requires a training course to be taken (in addition to having a prerequisite exam). A lot of the content below still relates to the old SCJD rather than its replacement.


These are frequently asked questions relating to the Sun Certified Java Developer certification and the common answers to them.

You can ask any questions about the SCJD exam in the JavaRanch SCJD discussion forum


Frequently Asked Questions


  • Where can I find books / tutorials / links that will help me
  • Where can I find the official FAQ? (broken link removed)



  • What is the policy on posting questions I saw on the exam / details of how to do the assignment?



  • What other certifications do I need before I go for the SCJD certification?
  • I intend to go for SCJD, SCWCD, SCBCD, SCDJWS ... which one should I do first?
  • How important are the scores?



  • How do I sign up for the Assignment?
  • Where can I purchase the assignment in <your country>?
  • Where can I find information on Cost / Location of exam sites in <your country>?
  • Should I purchase both parts (the exams and assignment) at the same time?
  • What site do I use to download / upload my assignment and to see what score I got?
  • How should I name my submission jar file?



  • My voucher for the exam is about to expire, what can I do?
  • I purchased the assignment, but I have not received it yet, what do I do?
  • Help - I cannot upload my assignment
  • Help - I cannot upload my assignment and I have scheduled my exam for today
  • Help - I uploaded my assignment and it says I failed, with no score and no comments



  • How long do I have to complete the assignment?
  • How Long will it take me to complete the assignment?
  • Oracle says it takes 4-6 weeks to grade my assignment, it has been over 6 weeks. What should I do?
  • Should I wait to find out my score from the assignment before taking the essay exam?
  • How do I find out why I lost points?
  • Will I get an email when I pass / fail?
  • How do I contact Oracle Education / Prometric?



  • Why are there add and delete methods in the data class when we don't need it?
  • I don't have access to a UNIX box, do I have to test it on UNIX?
  • What fields should I include in the Fly By Night Services GUI's search functionality?
  • My assignment says I can't use AWT components, but all layouts are in the java.awt package - what do I do?
  • How do I implement the Model-View-Controller pattern for the GUI?
  • Which version of SDK should I use?
  • How can I find out when a version of the JDK was released?
  • Is there a new exam?
  • How may assignments are there?
  • When will the assignments be upgraded ?
  • I have downloaded two different assignments - which one should I do?
  • Has the marking changed between the old assignment and the new assignment?
  • What is 'General Considerations' / 'xxx'?



  • Why do we care about the magic cookie?
  • Can't we synchronize the update() method and ignore the lock() methods?
  • Why do we have lock() methods in the Data class?



  • How can I test my locking mechanism to make sure it is working properly?
  • How can I test my business service?
  • How can I automatically build the submission jar (and test if every file is in the correct directory)?
  • Is there a tool I can use to read the .db file I received with my assignment?





  • What is the policy on posting questions I saw on the exam / details of how to do the assignment?
     

    You may not describe or talk about the questions you saw on any of the Oracle exams - see the JavaRanch Policy on Real Questions for further details. (http://www.javaranch.com/realquestions.jsp)

    For questions / discussions on the assignment, in general we will allow discussion where members are trying to:

  • understand the assignment
  • get a suggestion on how to work on a particular problem,
  • are asking for feedback on small sections of code
  • get suggestions about which tools to use.


  • But we will not allow posting major parts of a solution. For example, you may not post your entire code for locking and unlocking records - this is a major section (currently worth 20% of the assignment) and sections of such code will be removed from any post. Posting just one method (e.g. the lock() method is usually considered reasonable).

    There are multiple reasons for this policy:

  • Oracle do not allow you to share your assignment or a solution to the assignment with others.
  • You have spent time and effort getting your solution right. It would not be right for someone else to just copy your solution without working it out for themselves.
  • If someone did get awarded the SCJD certification after copying your code, and were then given employment because they had that certification, the employer would probably find that the employee cannot actually do the work. Which makes the perceived value of this certificate decrease.
  • If people post too much code, then Oracle may, in the future, request that we do not allow any SCJD code to be posted.




  • What other certications do I need before I go for the SCJD certification?
     

    You must already be certified as a Oracle Certified Programmer (any version).




    I intend to go for SCJD, SCWCD, SCBCD, SCDJWS ... which one should I do first?
     

    There are several schools of thought...


  • Like SCJP, SCWCD is a theory based exam - learn the correct theory, then sit the exam and answer the multiple choice questions (drag n drop, single choice ...). If you enjoy that style of exam (or if you are just in the right "mind-set" to continue with that style having just done it for SCJP) then you might want to continue with SCWCD.
  • Alternatively if you are sick of just studying, and want to get your hands dirty with real coding and working on a real application, then SCJD may be more your style.
  • If you are trying to get certificates now to pad your resume faster / impress your partner faster / get a pay rise faster ... then you can probably study for (and pass) SCWCD faster than you can complete the SCJD assignment (see later question for thoughts on how long it will take to complete the assignment).
  • If your goal is to get all the certificates complete in as short a total elapsed time as possible, then you should be aware that there is a delay between when you complete the SCJD assignment and when you get the results (Oracle say it can be up to 6 weeks from when you submit your assignment / sit the exam to when you get the results - we have seen shorter and longer timeframes). So you might want to do the SCJD first, and then do SCWCD while waiting for the results of SCJD.


  • Side note: Given the time it can take to complete the SCJD assignment, and given that there is no timelimit set by Oracle, some candidates start the SCJD assignment first, and if they feel they need a break they go off and do some other certification then return to SCJD later.

    Of course, SCJD is the friendliest forum to visit




    How important are the scores?
     

    The SCJD certificate does not show the score. However, a nice percentage always looks good on a resume.



    How do I sign up for the Assignment?
     

    You need to purchase the assignment - you may have to contact Oracle. Contact details are on (broken link removed) - in many cases you can purchase the assignment on your local countries' website.



    Where can I purchase the assignment in <your country>?
     

    Take a look at the Oracle World Training centers website (broken link removed). There should be an office in a country close to you - you will be able to purchase the assignment through them. Frequently they provide the ability to purchase the assignment online



    Where can I find information on Cost / Location of exam sites in <your country>?
     


  • Go to https://securereg3.prometric.com/
  • Select your area of study (hint: IT)
  • Choose your country and state if applicable and click "Next"
  • Click "Schedule an appointment"
  • Select "Sun Microsystems" from "Client", and "Sun Microsystems (310,311)" from Program and click "Next"
  • Read the information on Sun/Oracle (NOTE THE CONFIDENTIALITY CLAUSES) and click "Next"
  • Select "310-027 -- SUN CERTIFIED JAVA DEVELOPER" - The price should be displayed at the bottom of the screen
  • Click "Next"
  • See the listing of the testing centers in your Country.




  • Should I purchase both parts (the exams and assignment) at the same time?
     

    You should be aware that as of February 2009 there is a 12-month time limit on completing the assignment.

    Vouchers are valid for different lengths of time from country to country. To the author's knowledge, this can vary from 3 months to 1 year (other periods may be possible).

    There have been reports of some Oracle offices telling candidates that they must purchase the exam voucher at the same time as they purchase the assignment. This is not the case in all Oracle offices though.

    My recommendation would be to only purchase each section when you are ready to use it. That way you do not have to worry about any time limits on each section.

    See also the question: My voucher for the exam is about to expire, what can I do?



    What site do I use to download / upload my assignment and to see what score I got?
     

    Thanks to Ravi Appala for passing on Oracle's response to an email regarding which sites to use:



    https://i7lp.integral7.com/durango/do/login?ownername=sun&channel=sun&basechannel=prometric









    You can also go to the Prometric web site (https://www.register.prometric.com/CandidateHistory.asp) which will show you whether Prometric have acknowledged that you have sat the part II exam. But that is all it will show you: a "Tested" status on the exam.



    How should I name my submission jar file?
     

    The website where you will perform the upload has these directions in the upload screen, but here is a quote from that page

    The name of your submission archive file MUST be derived from your Testing ID, as shown above. Your Testing ID is your 9-digit Social Security Number (U.S. only), or it might be another alphanumeric combination, e.g. sp1234567 (any country).

    Your archive filename MUST BE scjda-AAAAAAAAA.ZZZ, where AAAAAAAAA is your Testing ID, and ZZZ is the appropriate filename extension for your archive type (zip, tar, or jar).



    My voucher for the exam is about to expire, what can I do?
     

    Check the wording on the back of the voucher. It typically has words to the effect of:

    "You must register for an exam prior to the expiration date printed on this voucher. Voucher expiration dates cannot be extended. Your actual testing appointment may be deferred for up to one year after registration."

    So register for the exam before the voucher expires, then contact prometric and defer the exam. You may defer multiple times.

    Be aware that Prometric and the test centers themselves have requirements as to how much notification must be given before defering an exam. So dont leave it to the last minute.



    I purchased the assignment, but I have not received it yet, what do I do?
     

    Oracle do not send the assignment to you, you must download it.

    See the question What site do I use to download / upload my assignment and to see what score I got? for which website to use, and try and download it. If you cannot download it, you will be told who to contact, and what information to provide them in order to get permission to download it.



    Help - I cannot upload my assignment
     

    This is a very common problem. The first day you try to upload your assignment, you will get an error saying that you don't have permission to upload the assignment. When you see this error you should also see an address to write to in order to get your permissions updated (mailto:SunCert@prometric.com). By the next day you should be able to upload your assignment.



    Help - I cannot upload my assignment and I have scheduled my exam for today
     

    This happens quite often. Currently Oracle are kind enough to allow candidates to upload after sitting the exam. Make sure you do send an email to prometric to tell them that you cannot upload, and keep a copy of the email. And upload as soon as Prometric tell you that they have fixed your permissions!!!

    Do not rely on this happening though - Oracle does object if people deliberately plan to take the exam before the upload though, and if they feel that this situation is being abused, they may force people to follow the rules.



    Help - I uploaded my assignment and it says I failed, with no score and no comments
     

    You cannot fail the Part II exam (unless you leave questions unanswered), however Prometric sometimes marks the test as failed in the cert manager database. There have been reports of it having something to do with timing: when they think you did the exam / when they passed the exam data to Oracle / when Oracle acknowledges it.

    Your assignment and your exam will be sent to an examiner, and eventually you will see your score, at which time you will be able to see whether you have passed or failed. Until then unfortunately you may still see the Failed status with no comments or explanations.

    If you are still nervous, you could write to Prometric and/or Oracle and get their assurances as well. (And if you get a better explanation for why you have got a "Failed" status, please update this FAQ).

    If you fail the assignment, you should either get a description of the major area you failed (e.g. missing file) or you should get a points break down for each section showing where you lost points. If you did not get either of these then you have to write to Oracle and get clarification.



    How long do I have to complete the assignment?
     

    The date on your voucher for the assignment indicates the latest date when you must download the assignment. Once you download the assignment, you have up to 12 months to complete it. If you buy your voucher for the Essay portion of the SCJD, then you will have one year from the date of the Essay Voucher to take the Essay exam. The Essay portion voucher is not related to the assignment.

    In confirmation, we have the following statement from Oracle thanks to Andy Michalec:





    How Long will it take me to complete the assignment?
     

    The current assignment provides you with a data file, an interface you must implement in order to work with that file, and some software specifications telling you what your application must do.

    To complete this assignment you must:

  • Write a class which implements the specified interface - this will give you (and Oracle's automated testing programs) a way of accessing and modifying the database.
  • Write a server application which will provide remote access to this data file. This must be written using either RMI or Serialized Objects over Sockets.
  • Write a GUI client which uses JTables and other swing components to provide a way of updating an individual field in the data file.
  • Provide both user documentation and programmer documentation (javadoc) for everything you submit.


  • If you are doing all this everyday in your normal job then you may find this a very simple exercise, and may be able to complete it in under a month full time.

    Very few people do every single one of those tasks every single day, so it is more realistic to look at a minimum of 6 - 8 weeks of work at 40 hours per week.

    Most candidates use this assignment as a learning exercise, picking up techniques and using APIs that they do not normally deal with. They also take the time to try different ways of accomplishing a given task to see which one works better / is easier to understand / is easier to maintain / is more interesting. This is the way that I would recommend people approach this assignment - it will prove more interesting, and you will get more out of it. But then you may find that doing the assignment may take longer as you explore different facets.

    A few candidates are only doing the assignment for the certificate at the end - sometimes a requirement for a job. It is not unheard of for such a person to get the bare minimum done in a couple of weeks (and get a very low pass mark).



    Oracle says it takes 4-6 weeks to grade my assignment, it has been over 6 weeks. What should I do?
     

    For a start - did you take the essay exam after uploading the assignment? Your assignment will not be looked at until after you have completed the part II essay exam.

    If this is not the problem, then you could try contacting Prometric (mailto:SunCert@prometric.com) and Oracle (mailto:who2contact@sun.com) to see what the status is.



    Should I wait to find out my score from the assignment before taking the essay exam?
     

    NO !!!

    Longer answer:

    The answers you write in your essay exam, and your submitted assignment, are handed together to the assessor for assessment. So until you have completed your essay exam nobody will look at your assignment.

    The reason for the exam is quite simple: Oracle need some way to prove that you wrote the code that you submitted. The logic (as I understand it) works like this: When you go into the testing center, you must provide identification to prove who you are. You will then be asked four questions that can only be answered correctly by the person who wrote the code. If the answers you give match the code you submit then the assessor can be reasonably certain that you did write your submitted code.

    Since the questions on the exam are based on the code that you wrote (for exampe: did you choose RMI or Sockets for networking) it is highly unlikely that you could fail the exam unless you didn't write the code. This appears to be Oracle's view as well, as they only list the following three possible parts of the SCJD assignment:

  • Programming Assignment (CX-310-252A)
  • Essay Exam (CX-310-027)
  • Programming Assignment Resubmission (CX-310-252R)


  • If you fail some part of the assignment, then you only have to resubmit the assignment. You do not have to resit the exam.



    How do I find out why I lost points?
     

    You don't.

    Oracle does not provide you any specific detail as to the reasons for point grading. They do break down the scoring by sections, which you can see on the Assignment Watcher web site (see question above on which web sites to use).



    Will I get an email when I pass / fail?
     

    No - you have to check the website on a regular basis to see whether you have passed or failed. You will receive the certification pack sometime after you pass, but this may not be for a week or two after you passed.



    How do I contact Oracle Education / Prometric?
     

    Sun: mailto:who2contact@sun.com
    Prometric: mailto:SunCert@prometric.com



    Why are there add and delete methods in the data class when we don't need it?
     

    Originally the assignment had an added requirement of creating a conversion program to convert a text file into a data file like db.db. In order to do this you would have needed these methods in the Data class.

    This may also be a way for Oracle to test whether you have implemented the provided interface correctly, or whether you have done the bare minimum for your assignment.



    I don't have access to a UNIX box, do I have to test it on UNIX?
     

    In the Instructions.html document that came with the Fly By Night Services assignment it states that you must provide:

    A README.txt file. You must create a single text file (plain ASCII format; word processor formats are unacceptable) called README.txt that describes to the examiner the following information in exactly the order listed:
    * The exact version of JDK you used, including the platform you worked on.

    In the Instructions.html document that comes with the new assignment, there is typically an instruction requiring you to provide:

    A file called version.txt. This must contain pure ASCII (not a word processor format) indicating the exact version of JDK you used, and the host platform you worked on.

    This could mean that they take into consideration what platform you used and probably try it on that platform. Many posts have occured about this, and we haven't found any cases where there was a problem of not having access to a UNIX box.



    What fields should I include in the Fly By Night Services GUI's search functionality?
     

    In the instructions.html. It is a little unclear as to the minimum fields necessary to search.

    In one section:

    The user should be able to select the origin and destination of flights, and the display should update to show only flights that satisfy those criteria. The user must be able to describe enter the string value "any" for the origin, destination, or both, so as to implement a wildcard-like feature.

    So you must have at least origin and destination.

    Then it also states

    For example, the following argument string would select all records describing flights by the SpeedyAir carrier that originate in San Francisco.
    "Carrier='SpeedyAir',Origin='SFO'"

    In this example Carrier is also there. Here is where the confusion comes in. In the first statement carrier is not included, but here it is.

    My take is to also include carrier.



    My assignment says I can't use AWT components, but all layouts are in the java.awt package - what do I do?
     

    While it is true that the layouts (and Font and Color classes) are in the java.awt package, they do not extend java.awt.Component (and are therefore not Components) and can be used in your assignment.

    Personally I suspect that the prohibition on using ant AWT Component was suggested at the time that the SCJP exam required candidates to know what was a java.awt.Component and what wasnt (wasn't that fun ). Since candidates who passed SCJP 1.4 or SCJP 1.5 no longer need to know that class heirachy, the restriction on using ant AWT Component(s) only seems to confuse people.

    If you want to use something that is not explicitly in the swing packages, take a look if it inherits from the java.awt.Component - if not, you can use it.



    How do I implement the Model-View-Controller pattern for the GUI?
     


  • Here is a MVC Pattern Page: http://ootips.org/mvc-pattern.html
  • Here is the JTable Tutorial at Oracle: http://docs.oracle.com/javase/tutorial/uiswing/components/table.html


  • Both will show you examples of how to implement the MVC Pattern.



    Which version of SDK should I use?
     

    Your instructions should have something like this:



    You may use the link in the next question and do the math. When in doubt, just use the latest version.

    Example calc: 1.5.0 was released on Sept 29, 2004, superseding 1.4.2. However you can still use 1.4.2 until it has been superseded by 18 months, so adding the 18 months to Sept 29, 2004 means that you can still use 1.4.2 until March 29, 2006.

    From April 2006 you must use at least JDK 1.5. You can no longer use 1.4.2 or prior versions.



    How can I find out when a version of the JDK was released?
     

    WikiPedia:Java_version_history



    Is there a new exam?
     

    No, there is only one SCJD exam. There are several assignments you may receive, however there is only one exam.



    How may assignments are there?
     

    There are three known assignments:


  • "Fly By Night Services" (FBNS) flight reserverations system
  • "URLyBird" hotel reservation system
  • "Bodgitt & Scarper" contractors


  • FBNS is the old assignment. The other two are the new assignments. To differentiate between the old assignment and the new assignments, the topic line for questions relating to the old assignment is usually prefixed by "FBNS:".

    The assignments are very similar in scope, and most of the same issues apply for all assignments. In all of them, you have to write a GUI (using swing and a JTable), and connect it to a database either directly or via a network. For the network you must choose either RMI or Serialized Objects over Sockets.

    Although there are only three known assignments, there are different versions of these assignments, so the instructions for your assignment may be different than the instructions for another user even if they appear to be doing the same assignment. Oracle have the following warning in the instructions you receive with the assignment:

    You may not use files from sets issued to other certification candidates - even if you believe they are identical.

    To give some examples of the differences:

    In early versions of FBNS, applicants had to convert data from a text file into the "db.db" database file. In later versions the "db.db" file was provided already populated.

    The URLyBird instructions come in at least 6 different versions, and some method signatures have been identified as differing between versions:

    VersionSignature of Unlock method
    1.1.1public void unlock(int recNo, long cookie) throws RecordNotFoundException, SecurityException;
    1.2.1public void unlock(long recNo, long cookie) throws SecurityException;
    1.2.2public void unlock(long recNo, long cookie) throws SecurityException;
    1.2.3public void unlock(long recNo, long cookie) throws SecurityException;
    1.3.1public void unlock(int recNo) throws RecordNotFoundException;
    1.3.3public void unlock(int recNo) throws RecordNotFoundException;




    When will the assignments be upgraded ?
     

    Taken from a Oracle response on this exact question.









    I have downloaded two different assignments - which one should I do?
     

    Several people who downloaded one assignment later tried to download the assignment a second time, and found that they received a different assignment.

    For a definitive answer, you should contact Oracle.

    Those members who did contact Oracle were told that they may continue with the old assignment.



    Has the marking changed between the old assignment and the new assignment?
     

    Yes, the old assignment had a total of 155 marks, with a pass mark of 124 (80%).

    The new assignment has a total of 400 marks with a pass mark of 320 (80%) .

    The marks assigned to each section are (note: these may not be in the same order as specified by Oracle):

    Old assignmentNew assignmentDifference
    General Considerations (Total 58)General Considerations (100 points)Down from 35% to 25%
    Documentation (Total 20)Documentation (70 points)Up from 13% to 18%
    Object-oriented design (30 points)New
    User Interface (Total 24)User Interface (40 points)Down from 16% to 10%
    Data class (40 points)New
    Server Design (Total 23)Server (40 points)Down from 15% to 10%
    Locking (Total 30)Locking (80 points)Up from 19% now 20%




    What is 'General Considerations' / 'xxx'?
     

    The old assignment broke the sections down as follows:


  • General Considerations (Total 58)
    • Ease of use (23)
    • Coding Standards (23)
    • Clarity and Maintainability (12)



  • Documentation (Total 20)
    • user (10)
    • javadoc (5)
    • Comments (5)



  • User Interface (Total 24)
    • Good Human/Computer Interaction (24)



  • Server Design (Total 53)
    • locking (30)
    • error handling (8)
    • search algorithm (14)




    Why do we care about the magic cookie?
     

    Different assignments have different schemas (and meta-data), and thus they have different magic cookies. Take a look at the following two examples of meta-data and schemas (taken from real assignments):





    That has a different magic cookie than the one used for the following meta-data and schema:





    If I write my Data class such that it checks the magic cookie for the first example, and expects the meta-data and schema for that first example, then it will be able to read any file that has the same magic cookie, meta-data and schema. But as you can easily see, without the check on the magic cookie, the Data class would quickly fail when trying to read the second file format - the field sizes are different, and some fields are different.



    Can't we synchronize the update() method and ignore the lock() methods?
    Why do we have lock() methods in the Data class?
     

    Most of the file operations require some synchronization, as they involve accessing a single shared resource. Even worse, they often involve two operations on that single shared resource, where the two operations must behave atomically. That is, you would normally perform a seek() and then a write(), however you do not want any other thread to perform a seek() between when you performed your seek() and when you perform your write(), otherwise you will end up writing in the wrong location within the file.

    (We will ignore for the moment the question of whether it is better to synchronize the entire update() method in Data class, or whether to just put the seek() and write() methods within a syncronized block.)

    So having somehow synchronized the access to the file, we still have a problem of two clients believing that a record is available, and both trying to update it. That is:


  • Client A checks that record 5 is available
  • Client B checks that record 5 is available
  • Client A updates record 5 with their client number
  • Client B updates record 5 with their client number


  • now client B has overwritten client A's booking

    This is where the logical record locking available through the lock() and unlock() methods of the Data class come in - in the above scenario, if client A had logically locked record 5 prior to checking availability, and client B had attempted to locally lock record 5 prior to checking availability, then client B would be blocked until client A had finished - no more problem.



    How can I test my Data class/locking mechanism to make sure it is working properly?
     

    In http://www.coderanch.com/t/427863/Developer-Certification-SCJD/certification/Tests-Data-class-locking-mechanism, you can find tests for the main functionalities of the Data class (such as creating or updating records) and also for the locking mechanism.



    How can I test my business service?
     

    In http://www.coderanch.com/t/484954/Developer-Certification-SCJD/certification/Test-your-business-service, you can find a test for the book-method of your business service.



    How can I automatically build the submission jar (and test if every file is in the correct directory)?
     

    In http://www.coderanch.com/t/450629/Developer-Certification-SCJD/certification/Submission-Jar-test-case-Ant, you can find an Ant build script that will automatically build your submission jar. You can find also a JUnit test case to validate the structure of your submission jar (and also some source checks).



    Is there a tool I can use to read the .db file I received with my assignment?
     

    In http://www.coderanch.com/t/445690/Developer-Certification-SCJD/certification/Database-file-reader, you can find a simple tool that reads the content of the .db file received along with the instructions of your assignment. The goal of this tool is to give people starting with the development an idea of how the .db file is organized and how it can be read.

    CategoryFaq CategoryCertification
    3 years ago
    The CodeRanch Journal July 2012

    Howdy from everyone at the Ranch!



    Hot Dog!!! We Have a Sponsor!!!

    LearnNowJava.com is gleefully sponsoring this edition of the journal.

    Keep Your Java Skills Current - Just $99.99

    Get up to speed quickly in Java and related technologies with our library of video tutorials for Java SE, Java EE, Eclipse, Spring, Hibernate, EJB, JSP, OOP, JavaScript, jQuery and more (200 hours of learning!) - plus keep your skills current with future releases included free.

    Subscribe now at http://www.LearnNowJava.com/Default.aspx?src=RN1034J




    Interesting CodeRanch Forum Posts


  • Wondering on what new programming language to learn?? Then rush to the thread Which New Programming Language to Learn



  • Hear Clojure's Best Usage from Chas Emerick, co-author of the book Clojure Programming



  • Share your views on Marking an overridden method as final in Java



  • Check the favourite national anthems of our ranchers




  • Interesting Staff Blogs


  • Jeanne reviews the all new Eclipse Juno



  • Jeanne shares her course experiences with Udacity and Coursera



  • Mohamed writes about What's in store for Project Lambda in Java 8



  • Mohamed lists the Useful Audio Podcasts for Software Developers




  • Book Promotions and Reviews

    Do you know you can win a free book almost every week by just asking a question? Read more on Book Promotions at CodeRanch
    and check the gross list of the lucky winners


  • Past book promo - Clojure Programming by Chas Emerick, Brian Carper and Christophe Grand



  • Ongoing book promo - Web Workers: Multithreaded Programs in JavaScript by Ido Green (July 24th - 27th)



  • Upcoming book promo - The Well Grounded Java Developer by Benjamin Evans & Martijn Verburg (July 30th)



  • Check our staff review on the book Scala for the Impatient authored by Cay S. Horstmann




  • Suggestions/Feedback

    If you have any feedback on this month's Journal, please share it in this thread.

    If you have any other general suggestions about the CodeRanch Journal, then feel free to open a new thread in our Ranch Office forum



    For more info, or if this JavaRanch journal was one too much, visit our Journal page

    Our previously published journals are available online at JavaRanch Journal

    Your editor this month: John Jai, is a software developer and lives in Chennai, India.

    All this, and much, much, more, on javaranch.com.
    3 years ago
    This describes a way to proxy Tomcat requests through Apache Httd Web Server. I found mod_jk way overly complicated for development purposes. Whether or not proxies are a good idea in production, I do not know.



    ************************* Warning !!! **************************************************


    I found this article while doing a search and noticed some very bad code, specifically this:



    The above code will allow anyone to forward stuff like spam through your Apache server!!

    I think that the original author really wanted to set up a reverse proxy, not a forward proxy.
    Forward proxies are used for things like providing Intranet members with a connection to the Internet. Reverse proxies are used for clustering, load balancing, etc.

    Unless you know what you are doing a good rule of thumb is to NEVER include this directive in your httpd.conf file:


    In fact, unless you are truly creating a forward proxy, you should ALWAYS include this directive:


    I have not changed anything in this article other than to add this warning.

    H. Hall




    I am assuming the following versions of Apache Httpd and tomcat

    Apache Httpd 2.0.59

    Tomcat 5.5.20

    I am currently running Xubuntu Edgy and have installed Apache2 using apt-get.

    First, you need to enable proxies in Apache. You can do the following commands from anywhere on the filesystem.

    sudo ln -s /etc/apache2/mods-available/proxy.conf /etc/apache2/mods-enabled/proxy.conf

    sudo ln -s /etc/apache2/mods-available/proxy_http.load /etc/apache2/mods-enabled/proxy_http.load

    sudo ln -s /etc/apache2/mods-available/proxy.load /etc/apache2/mods-enabled/proxy.load

    Next, edit /etc/apache2/mods-available/proxy.conf with your favorite editor (like VIM) and turn proxies on for All domains. (You can also restrict to specific domains, but since this is local machine development, this is just as easy)



    Now that proxies are enabled, we need to define one. Create a file with the same name as your web application context in the following location:

    /etc/apache2/sites-available/

    For this example, our app is called testApp. Using your favorite editor (like VIM) use the following configuration:



    DocumentRoot points to the location where you are serving static content from, like images, styles, scripts, etc. The ProxyPass and ProxyPassReverse tells apache httpd to send all dynamic requests to Tomcat.

    Now, provide a sym link for this site in /etc/apache2/sites-enabled

    sudo ln -s /etc/apache2/sites-available/testApp /etc/apache2/sites-enabled/testApp

    The last thing is to edit your hosts file (/etc/hosts) to include the ServerName you have specified:

    127.0.0.1

    Now, just restart Apache (sudo apache2ctl restart) and you should be good to go. So now, rather than using port 8080, you would access your web app using the following:

    http://local.somedomain.com/testApp
    3 years ago
    The JavaRanch/CodeRanch is an online community with almost a quarter of a million members which have posted more than 2.4 million messages. Our members come from all over the globe although most of them come from the USA, India and Europe. We discuss a wide range of topics, from distributed computing to certification. Although our main focus is on Java we also have topics about HTML, Groovy, Ruby and others.

    The forums are accessible for new programmers since our only rule is "be nice". We try to help our members by guiding them and letting them figure it out on their own instead of just providing the answers.

    The JavaRanch is founded by Paul Wheaton, aka the Trailboss.
    3 years ago
    (Level: Beginner/Intermediate)

    Few things in the Java language (or any computer language, for that matter) generate as many questions, or get misused as often as TIME, which is surprising, because computer time really is very simple; it's us puny humans - or rather, our perception of time - that complicates things.

    This page is meant to give you a quick overview of how to deal with displaying times, and hopefully to prevent a few common traps that people fall into.

    .

    Lesson 1: Java Time is the same - ALWAYS

    Whenever you write:


    or:


    you are storing a numeric value containing the current time according to the machine's internal clock.

    And if you do it simultaneously on 50 different machines around the world, it will store the same value (OK, it could be out by a few seconds) even though CLOCKS in each of those countries show a different time.

    Why?

    Because computer time uses a universal start point (called the Epoch): in Java's case, 00:00:00 on the 1st of January, 1970 GMT (and that 'GMT' is very important) - and ALL time values are offsets from this point - either negative or positive - in milliseconds.

    Thus, all computer (and Java) times contain an implicit date. Indeed, the basic class for storing times in Java is Date - specifically, java.util.Date (there is also a java.sql.Date class).

    .

    Lesson 2: So what's the problem?

    Simply put: US.

    Even in these days of global communication, we live in our own little world, which includes our own little timezone, and assume that everybody else does the same.

    So, when we ask "what's the time?", we're not asking what the actual time is, we're asking: "what time of day is it HERE?".

    And that's because clock time has nothing to do with actual time (as you'll soon find out if you ever experience jet-lag); it's a convenience for us diurnal humans so that we can deal with where the sun is: "Oh, the sun is overhead; it must be about noon. Time for lunch."

    Moreover, the whole business of regional time zones is quite recent. Before the advent of railways, the local church (or Mosque) was the sole arbiter of "what time it is" - and that was mainly to make sure that everybody got to prayers on time.

    Computers have no such parochial issues. To them, time is simply a nice long chain of milliseconds from a fixed point (the 'Epoch' described above) - and it's the same chain for everyone, anywhere in the world.

    Furthermore, there are network services that allow computers to know where they are and what time it is (the computer's internal clock is good, but even it needs to be corrected every so often) so that they can display the correct CLOCK time accurately.

    Anyone who's taken a laptop across timezones will probably have seen the phenomenon: you turn it on at your destination and it shows the WRONG clock time (usually the time where you came from); connect it to the Internet and, hey presto, within a few seconds it's displaying the correct time again.

    Remember: Timezones are a human invention. They have nothing to do with actual time.

    .

    Lesson 3: Content and Display

    Hopefully, I've now convinced you that, for Java (and outside the laws of relativity), time is the same wherever you are in the world. So if I create a Java time value of 1000 (1000 milliseconds after the Epoch) it will equate to 00:00:01 1/1/1970 GMT.

    What it will NOT do is display the same around the world.

    And this point doesn't just apply to time. Whenever you write Java classes, you need to be very clear to distinguish what they contain from what they look like .

    .

    To display times in human-readable form in Java, you need a DateFormat object; and the easiest one to use is SimpleDateFormat.

    The following code sets up a fairly typical SimpleDateFormat field:



    This will display a time in the form: 2012/01/01 13:45:00 WET, where the timezone will depend on where your machine is located.

    Now, suppose you set up the time described above as follows:



    and display it using the format object above:



    .

    Now, you send that SAME CODE to four different machines in London, Paris, New York and Tokyo.

    In London it will display


    in Paris it will display


    in New York it will display


    and in Tokyo it will display


    because even though the content (ie, the time) is the same (1000L), the rules for display are different.

    And you know what? You don't have to do a darn thing: SimpleDateFormat does it for you. And that's the main point of this lesson (and, in fact, this page):

    You don't need to change Java times in order to have them display properly.

    If you do, you are simply undoing (and usually fouling up) all the work that those nice guys at Sun did when they created the SimpleDateFormat class for you.

    .

    It's probably worth adding that you can also use the class to display a time for timezones that are different to your own, so:





    will display EPlus1 according to Paris time.


    .

    OTHER STUFF

    Since this page is about time, rather than dates, I won't go into the whole mess of different calendars. Suffice to say they are yet another human invention that confuses our notions of time. As of the writing of this page, there is only one Calendar offered by the standard Java classes: GregorianCalendar - and you should get to know it.

    It should also be added that Calendars in Java are concerned with storing and manipulating dates and times, NOT displaying them; and if you look carefully at the API, you'll find that there is nothing in them about display.

    .

    However, it's probably worth mentioning Daylight Savings Time - yet another human pitchfork in the nice, tidy, ordered world of computer time.

    Simple rule: Don't worry about it.

    DST is only a factor when you need to display a clock time, and the classes already mentioned will take care of it; including displaying the correct clock time when DST in in effect.

    Otherwise? Deal with time as a value; or, if you prefer, as (Epoch + millisecond-offset).

    If you always remember that time in Java is a value - and that it's the same for everyone - you're unlikely to run into trouble. It's when you start "overthinking" things that problems crop up.

    .

    Joda Time

    The fact is that Java's date/time API is bad (and I say that as someone who loves the language).

    The classes, other than Date, are clumsy, difficult to follow (Calendar alone contains 49 different fields and 52 methods; and it's not even a concrete class) and scattered all over the place. This is also reflected in the documentation which, while describing how each class works, doesn't really give you any insight as to how you're supposed to use them.

    Joda Time to the rescue. It's an open-source project that was set up by a bunch of chaps with the express purpose of making time easier, and includes all sorts of goodies, including complete working calendars for all the major religions, and the ability to deal with time intervals (the difference between two times) directly.

    It has also been around for quite a while, so you don't need to worry that you're plunging into "bleeding edge" technology, and it's very compatible with the existing Java time classes.

    Indeed, many of its features were suggested to Sun/Oracle as JSR-310 for inclusion into Java Version 7, but were turned down. More fool them, I say.


    .

    FAQs

    is UTC the same as GMT?

    Correct answer: No.

    Simple answer: Yes.

    For anything that you're likely to be dealing with, you can assume that they are the same. Another term for the same time is "Zulu time", often used by the military - particularly sailors.

    Another important thing to know about UTC/GMT/Zulu time is that none of them involves Daylight Savings. EVER.

    .

    What about leap seconds?

    Simple answer: Don't sweat them.

    The fact is that if you know about leap seconds, you're probably past the point where you need this page. Furthermore, they are very rare (only 39 have been added since 1961) and they always occur on June 30th or Dec. 31st. at midnight GMT (again, that 'GMT' is very important).

    There is only one situation where you might have to worry about them: if you need an accurate timing for a duration that spans a leap-second; and if that's the case, you should use System.nanoTime() rather than System.currentTimeMillis(). Indeed, you should always use nanoTime() if you want accurate timings.

    And if the duration is so long that using nanoTime() is impractical? You're stuffed.

    Simply put: there is no way to register leap seconds with System.currentTimeMillis(), because they are removed before you ever get to see the value. Joda Time (see above) does allow you to include leap-seconds, but even it might return a bad value if you're unlucky enough to have a duration that starts or ends ON a leap-second.



    FURTHER READING


  • The first thing you should do is read the APIs for ALL the classes mentioned in this document (they should all be linked). And read them carefully.
  • Also read up on the Locale and TimeZone classes.
  • Unix_time - this is the time system emulated by Java, and the linked article goes into more depth about the mechanics, if you're interested.
  • The JavaDatesFaq also talks about some of these, and other, topics.




  • CategoryWinston
    3 years ago
    How do I access the XYZ file format in java ?

    A large database of file extensions be found at www.file-extensions.org and dotwhat.net

    And if you don't know what type a given file is, they there are various way to determine it programmatically: http://www.rgagnon.com/javadetails/java-0487.html

    An interesting article about Microsoft's binary file formats, especially DOC and XLS, is Why are the Microsoft Office file formats so complicated? (And some workarounds) It also mentions some alternatives to dealing with those formats directly.

    Access
  • Jackcess - library to read and write MDB files
  • HXTT Access - commercial pure Java JDBC driver for MS Access


  • CHM
  • JChm - library to read CHM files


  • Excel
  • Apache Commons CSV, Ostermiller Utils, CSVObjects, CSVBeans, opencsv, Java CSV, Super CSV - libraries to read and write CSV files. CSV is not as easy to read and write as it first looks - once all the special cases are considered, one might as well use a library.
  • POI - library to read and write XLS and XLSX files
  • jXLS - library for writing XLS files based on templates
  • Obba works with Excel spreadsheets on Windows
  • OpenXLS - "OpenXLS is the open source version of ExtenXLS - a Java spreadsheet SDK that allows you to read, modify and create Java Excel spreadsheets from your Java applications."


  • Gedcom
  • GDBI
  • gedcom4j
  • GenJ


  • HDF (Hierarchical Data Format)
  • Java products by the HDF Group


  • Image and movie files
  • ImageJ - Java image processing application and library that has plugins for lots of image file formats
  • JIMI - library to read and write BMP, CUR, GIF, ICO, JPEG, PICT, PNG, PSD, Sun Raster, TGA, TIFF, XBM and XPM. There's a plugin for using JIMI with ImageJ, which also includes a couple of JIMI patches.
  • GIF write, TIFF, RAW, PNM and JPEG2000 read/write support for ImageIO: JAI Image I/O Tools
  • TwelveMonkeys| - additions for the ImageIO API
  • MP4 parser
  • Apache Commons Imaging is a library that reads and writes a variety of image formats, including fast parsing of image info (size, color space, ICC profile, etc.) and metadata.


  • INI
  • ini4j "is a simple Java API for handling configuration files in Windows .ini format."


  • Matlab
  • JMatIO - Matlab's MAT-file I/O in JAVA


  • OpenDocument (ODF)
  • ODFDOM is a Java library for accessing ODF files.
  • jDocument.org has an open-source library for accessing all Open Document file types.
  • Obba works with OpenOffice spreadsheets
  • Office2FO converts ODF documents to XSL-FO documents, making possible further transformations (like conversion to PDF using FOP)


  • Office Open XML
  • These are the XML-based Microsoft Office formats, standardized by ECMA, but implemented by Microsoft in a non-compliant way
  • docx4j - create and edit docx documents using a JAXB content model matching the WordML schema
  • Apache POI implements these formats.


  • OpenOffice Java API
  • OpenOffice can read a number of file formats, and makes them accessible through its API. A starting point might be this article and of course the OO developer site
  • Some introductory information about the OO file format can be found here
  • JODConverter is a Java library that uses the OO Java API to perform document conversions between any formats supported by OO


  • Outlook / PST
  • The Apache POI project developed some code that can read the texual contents of Outlook's MSG files. This page talks about that.
  • Xena can convert multiple file formats -including MSG- to XML. Either the result of that conversion, or Xena's source code, may be helpful.
  • JPST can read and extract PST files.
  • java-libpst is a pure Java library that can access 64bit PST files.


  • PDF
  • PDF is a hard to read format. The best one can do is try to extract the text contained in a PDF file.
  • OpenODF is a library to create PDFs built on top of iText2, but still licensed under a business-friendly license. code example - more examples - javadocs
  • PDFBox - library that can create, merge, split and print PDFs, extract text, create images from PDFs, encrypt/decrypt PDFs, fill in PDF forms and more. See PDFBoxExample for example code of how to use it to create a PDF.
  • FOP - library to create PDFs (and other formats) from XML by using XSL-FO transformations
  • FlyingSaucer - library to convert CSS-styled XHTML to PDF
  • JPedal - library for viewing and printing PDFs, can also extract text (how to print PDFs); commercial (the LGPL version provides PDF viewing only)
  • PDFxStream - commercial library to extract text from PDFs
  • PDF Renderer is a more up-to-date PDF viewer that renders using Java2D. Download, Examples, Printing PDFs
  • ICEPdf is another library that can render PDFs.
  • Qoppa offers numerous libraries for PDF-related tasks
  • Aspose.Pdf for Java is a commercial library for reading and writing PDFs
  • jPod is a rich PDF manipulation and rendering framework
  • OrsonPDF is a fast, lightweight PDF generator for the Java platform


  • PowerPoint

  • The Apache POI project developed some code that can open and (to a limited extent) edit PPT files. This page talks about it.


  • Project
  • The MPXJ library can work with several Project file formats.


  • QIF (used by Microsoft Money and Quicken)
  • Buddi and Eurobudget are Java applications that can import and export QIF files (and thus contain code you may be able to use in your application). Both are licensed under the GPL.


  • RTF
  • jRTF can create RTFs
  • iText 2 can create RTFs: jar file, javadocs
  • JavaCC - is a lexer/parser for which an RTF grammar is available. From that an RTF reader can be constructed.


  • Visio
  • The Apache POI project developed some code that can read Visio files. This page talks about that.


  • Word

  • POI - library to read and write DOC and DOCX files. It can also be used for extracting the text of a document.
  • WordApi.exe is native Windows component with a Java interface, which lets you create Word documents, and alter word templates. Some impressions about it can be found here.
  • Java2Word - library to create Word documents, especially reports, on the fly.




  • Something else?
    If you encounter an obscure format for which no library is available, it may be feasible to create a reader for it if you have a file format description (which may be available on Wotsit, see link above). Several libraries, so-called lexers and parsers, are available that help in creating a reader, especially if the file format is ASCII, and not binary. You will need knowledge of regular expressions, though. Some file formats that have been tackled using this approach include RTF, CSV, HPGL and PBM/PGM/PPM. Lexers are easier to start with, but parsers can do more of the work for you. All these have ready-to-use examples on their web sites.

  • Lexers: JFlex (introductory article in the JavaRanch Journal)
  • Parsers: Antlr, SableCC, JavaCC



  • CategoryFaq CategoryHowTo
    3 years ago
    What are "accessor methods"?

    Accessor methods (also called getters/setters) are methods which encapsulate the access to fields of an object.









    Why don't I just access the fields directly?

    There are several reasons why this would probably be a not-so-good idea:


  • An object should have full control over its data. With direct field access, it doesn't know when a value gets changed and can't react accordingly. You might later want to cache some data, lazily initialize it, calculate it on the fly instead of putting it into a field, notify someone of a change or a myriad of other things. Without accessor methods, you don't have a place to put that behaviour.


  • (Some languages make it possible to switch from direct access to access through methods without the clients even noticing. Java doesn't, so it's often quite costly to do that switch later.)


  • Fields aren't polymorphic. If you later want to make use of polymorphic behaviour - for example getting a value from a different source in a subclass, or applying the DecoratorPattern - you can't do so with direct field access.



  • As someone else might expand on, good ObjectOriented design and experienced ObjectOriented developers suggest that developing message- and behavior-based systems is a good thing.


  • So, should I have AccessorMethods for all my fields?


  • Uh, no. Sometimes you don't need 'em (see Wiki:YouAintGonnaNeedIt) and sometimes it isn't appropriate to allow outsiders access to your state (see above).


  • What about field access in the class itself? In Subclasses?

    Related threads:


  • http://www.coderanch.com/t/98276/patterns/Getter-Setter-Methods
  • http://www.coderanch.com/t/98435/patterns/getters-setters-evil


  • Other resources:


  • Wiki:AccessorsAreEvil
  • http://www.javaworld.com/javaworld/jw-09-2003/jw-0905-toolbox.html?

  • 3 years ago
    As a general rule, we do not delete accounts without a very good reason.

    Stopping emails from JavaRanch

    The usual reason users want their accounts deleted is because they no longer want to get emails from JavaRanch. However there is no need to delete an account just for this. Just click on "My Profile", and edit the part that says can JavaRanch send you email to no. (or just set all the email stuff to no)

    Not wishing the user name to be displayed publicly

    If someone used their real name for their account, it can happen that some time later they no longer want it to be displayed in public, since it can easily be found using search engines. In that case just change it to some fictional -although real-sounding- name. This can also be done under "My Profile". In some ways, it's too late by the time you are asking anyway - assorted caches around the web already have the original.

    Why can't you delete my account?

    The forum software does not provide the facility to delete accounts - this would have to be added.

    One of the main reasons JavaRanch exists is so that people can learn, and one of the ways to learn is by reading past posts. So even though your account may not have value to you, the posts associated with your account may still have value to the greater community.

    From our perspective, the bigger question is: what should happen to your posts once your account is deleted?

    If every post you have ever made was in a topic that you created, then we could go against the aims of JavaRanch and delete the topics you created - at a loss to the community in general.

    However if you have created posts in topics that others have created, then it becomes far harder: if we delete your posts then replies to your posts may make no sense.

    An option would be to reassign your posts to an account named "ex-user". However even this is sub-optimal as many members refer to users by name in their replies, especially if they are responding to 2 or 3 posts in a single topic. So even if your account didn't exist, your name could still appear in topics. For some (many) people this would be worse than if their original account existed. Imagine if your account was reassigned to "ex-user" but because your name was used in a response to your topic, it was still searchable through Google. So someone comes and looks at that topic. They see your message, and potentially 3 or 4 posts further down they see a totally ridiculous response by another "ex-user". Now they might associate you with that ridiculous response.

    The end result is that there does not appear to be an automatic way of removing all traces of a user from our system. And if it is not automatic, then it is not likely to be done (as an example, imagine if I were to leave: could you imagine asking a volunteer to go through 1000+ posts and determine what can be deleted totally and what needs to be edited - I cannot imagine a single volunteer who would agree to that (and 1000 posts is not unusual - there are users with more than 10,000 posts)).
    3 years ago
    You can now show your accomplishments on JavaRanch/CodeRanch on your own site through a custom badge :



    Copy/paste the following code into your site, and change the id to your own ranch id. Your ranch id is shown in your public profile (At the top of any forum page like this one, click "My Profile" and then click "view public profile" )




    Add your badge to your Blogger/Blogspot blog

    If you have a blog at blogspot.com then you can display your CodeRanch badge on your blog as follows:


  • Login to your blog
  • Go to "Design" -> "Page Elements" tab
  • Click "Add a Gadget"
  • Select the "Picture" gadget
    • Give a "Title" and "Caption" of your choice
    • In the "Link" part add http://www.javaranch.com/ (Note that this link will be used when you "click" on the image on your blog)
    • For uploading the image, select the "From the web" radio button and specify your user specific badge URL



  • Click Save
  • Then Save this new change.


  • That's it, your blog will now have a CodeRanch Badge.


    Looking for something fancier?

    If you're not afraid to do a bit programming then there is a REST API you can use to build even fancier badges for user profiles, forums and topics. Read all about those at RestApis.


    CategoryJForum
    3 years ago
    About me:

    Graduated from Staffordshire University. Currently, serving Digital Applications Inc. as a Java Technical Lead. I am Oracle Certified DBA and Sun Certified Java Programmer.

    Open, straight, lively and religious. I am good when it comes to visual/spatial intelligence. Others may take their environments for granted but not me. From shapes in nature to the structure of an automobile, a countless variety of things hold my interest.

    JavaRanch Profile | LinkedIn Profile | Back to CategoryHomepage--
    3 years ago
    Nobody knows everything. There are even some things which no one knows.

    If somebody asks a hard question at the Saloon, it's OK to guess at an answer. But please, please, let them know when you're guessing. Don't say, "Just delete all your gorms, then reboot," unless you're sure that's the solution. Say "I'm just guessing here, but have you tried smarming the framistat?" Or "I'm not sure, but I think it has something to do with boontling."

    If somebody asks an easy question, don't guess at all: wait for somebody who knows the answer to come along. You don't want to confuse a greenhorn with wrong answers.

    Back to HowToAnswerQuestionsOnJavaRanch
    3 years ago
    This is the FAQ for the Android forum. It's editable by everyone, so feel free to add content to it.

  • What Java API is supported by Android? How does it differ from JME?
  • Where can I get an SDK? What platforms does it support?
    • The latest version of the SDK is available for Windows, OS X and Linux here.
  • Do I need to buy hardware if I want to start writing applications that run on Android?
    • You can start writing applications even if you don?t have hardware to run them on. The Android SDK comes with an emulator and all tools necessary for application development and deployment.
    • Another option is Google's Android Studio which is based on IntelliJ.
  • Which hardware devices support Android?
  • What is Dalvik? How is it different from JVM?
    • Dalvik is a register based virtual machine optimized to run on a slow CPU,with relatively little RAM and on an OS without swap space. WikiPedia:Dalvik_virtual_machine
  • What are the different Media formats supported on Android?
  • Where can I publish my Android applications?
  • How can I get insight into how people are using my app?
  • I'd like to display ads in my app without having to negotiate it all by myself. What are my options?
  • What support does Android or Dalvik VM provide for running native C code?
    • The NDK (Native Development Kit) gives developers the ability to call into native code from Android applications. There is a Google group for NDK-related discussions. At present, Android supports libc, libm, JNI interface headers, libz, liblog, OpenGL ES 1.1 and OpenGL ES 2.0, libjnigraphics, a minimal set of headers for C++ support, OpenSL ES native audio libraries and Android native application APIs.
  • How can I view PDFs and Office documents?
  • Which Android versions are being used out in the field?
  • Is Android code compiled to a .class file?
    • The Java bytecode of a compiled class is converted into Dalvik executables or (.dex) files, using the "dx" tool bundled with the SDK . The application is packaged into .apk file which are zipped .dex files. The Dalvik virtual machine runs Dalvik executables in the apk file.
  • I want to write Android Applications too but dont know where to start?
  • Do Android projects have deployment descriptors?
  • My Application throws an Exception, where is the Stack Trace dumped?
    • Exceptions are written to a log file, named Logcat in the emulator. You can obtain a dump by executing the adb logcat command. To write log messages from your application, use the static methods of JavaDoc:android.util.Log class(Log.v(), Log.d(), Log.i(), etc.). If you are using Eclipse with ADT plugin, you can open "Logcat" view to see the logged messages.
  • What functionality of the actual device can the emulator emulate?
    • For Emulator How-Tos and limitations, read this
  • How can I send email from an Android application?
  • How can I use JAXB on Android?
  • What options for storing data do I have?
  • What 3rd party libraries should I check out?
  • How do I get the Android source code?


  • Reference material

  • Android Home Page
  • Developer Guide
  • API Reference


  • Books

  • Application Security for the Android Platform by Jeff Six
  • Professional Android 4 Application Development by Reto Meier
  • Introduction to Android Application Development: Android Essentials and Sams Teach Yourself Android Application Development in 24 Hours by Shane Conder and Lauren Darcey
  • Advanced Android 4 Games by Vladimir Silva
  • Learn Java for Android Development by Jeff Friesen
  • The Android Developer's Cookbook: Building Applications with the Android SDK by Schwarz, Dutson, Steele, To


  • Other

  • Following the Android Developers Blog is a must.
  • In-depth tutorials on many subjects by Lars Vogel
  • Frameworks for developing cross-platform mobile applications: Rhodes, Titanium Mobile, Unity, Infinite Monkeys, Kendo UI, Apache Cordova (formerly known as PhoneGap), Tabris, React Native, NativeScript-Vue, Flutter
  • Android 4.4, KitKat: The complete FAQ
  • Android 5, Lollipop: The complete FAQ
  • Android 6, Marshmallow: The complete FAQ
  • Android 7, Nougat: The complete FAQ
  • Android 8, Oreo: The complete FAQ
  • Android 9, Pie: The complete FAQ


  • Other Android variants

  • WikiPedia:Fire_OS is developed by Amazon and also based on the AOSP; it runs on Amazon's Kindle family of devices: FireOS Development
  • BlackBerry 10 can run repackaged Android apps : http://developer.blackberry.com/android/
  • Not really a variant, but Windows Phone 10 can run Android apps that have been adapted to it, as well as Cordova apps



  • CategoryFaq JavaMicroEditionFaq
    3 years ago
    June 2004

    Hi my name is Angela Evans, I live in Northern Virginia. I just signed up to this website a couple of days ago. I am a newbie. I became interested in Java Programming by attending a brief seminar where I work. I have two small children so my time is limited. Like right now!

    I recently purchased the "Java Head First" book and it has renewed my interest in learning Java and that's why I went site surfing again because I would like some interactive learning along with the book. I came across this site which is not exactly what I was looking for as far as interactive, hands on learning of Java but it is most interesting and fun!


    CategoryHomepage

    It's been a long time! I have switched careers and moved. Time is still limited.
    3 years ago
    This is a simple example of using annotations at runtime. Note the RetentionPolicy setting which determines whether or not an annotation can be retrieved by code at runtime. The code also demonstrates default values and annotations with more than one field.




    CategoryCodeSamples CodeBarn
    3 years ago
    Setting up Cruise Control with SVN and Ant

    Software Required:


  • apache_2.0.59-win32-x86-no_ssl.msi
  • svn-1.4.4-setup.exe
  • TortoiseSVN-1.4.4.9706-win32-svn-1.4.4.msi
  • cruisecontrol-bin-2.8
  • svnant-1.2.1
  • jdk-1_5_0_01-windows-i586-p.exe
  • junit-4.6.jar


  • (Does it have to be these exact versions? For which ones of those can other versions be substituted? --Ulf)

    Installation Guide:

    • Installing jdk-1_5 – Install jdk-1_5.

    • Installing Apache

    1. Install Apache 2.0. Most of the installation screens should be self explanatory. But, when you get to "Server Information" screen (Unless you are installing this for a server that has a domain name attached to it), you can just put in localhost for both Network Domain and Server Name. For Administrator's Email Address, enter an appropriate email address.

    2. If you already have a web server (IIS) running on port 80, then to run apache on a different port, open the httpd.conf file that is located in C:\Program Files\Apache Group\Apache2\conf (assuming you did a standard install) and change the line that says:Listen 80 to Listen 81. You can use a port other than 81.

    3. Save the file and restart the Apache2 service.

    4. If Apache is running correctly, you should be able to navigate to http://localhost:81 and a web page should display

    • Installing Subversion

    1. Download and install Subversion (Use the windows installer version).

    2. When you reach the "Select Additional Task"screen, make sure that you have the "Install and configure Subversion modules..." checkbox checked.

    • Installing TortoiseSVN

    1. Download and install TortoiseSVN. TortoiseSVN is a shell extension for Windows that will make managing the Subversion server much easier.

    • Installing CruiseControl

    1. Download the binary version of cruisecontrol-bin-2.8 and unzip it.

    2. Create the following directory C:\cc-sandbox. Copy the unzipped cruisecontrol-bin-2.8 to the directory.

    3. Run CruiseControl from the installation directory. For example, c:\cc-sanbox\cruisecontrol-bin-2.8.2\cruisecontrol.bat.

    4. The Set-up is complete, you should now be able to access the following links: http://localhost:8080/dashboard, http://localhost:8080/cruisecontrol

    5. Setup for Cruise Control is complete, for your reference CruiseContol provides with a sample project connectfour.

    Configuration Guide

    • Creating your first Subversion Repository

    1. Subversion will let you create repositories in any directory of your server that you want. You should create a top level directory that all of the other repositories will live under. You will see why in a few more instructions. We will be creating our repositories under the c:\svn directory. You should use either svn or subversion as your top level directory name so that you can recognize it easily when you are navigating your hard drive. So, your first step should be to create the svn directory off of the root of the c: drive.

    2. Using File Explorer, navigate into c:\svn and create a subdirectory under it called test. This will be the location of our test repository.

    3. Once you've created the test directory, right click the directory and select "TortoiseSVN" > "Create Repository Here..." from the menu.

    4. When the dialog box appears asking about FSFS or BDB, select FSFS and press the "OK" button.

    • Configure Apache to see your Subversion repository

    1. Open the httpd.conf file that is located in c:\program files\Apache Group\Apache2\conf (assuming you did a standard install) and scroll to the bottom of the file. Add the following lines:









    2. Save the httpd.conf file and restart the Apache2 service.

    3. At this point, you should be able to access http://localhost:81/svn/test using your web browser, but anyone can access the files. What you need to do next is add in basic authentication. To do that you will need to add usernames and passwords to an .htaccess file and then you will need to attach that file to the svn directory.

    4. To create usernames and passwords, you will need to run the htpasswd.exe program in the bin directory of the Apach2 program files. The first time you run this file, you should use the -cm flags to create the file and use MD5 hashing. Every other time you run it, you will use the -m flag ONLY.
    htpasswd -cm c:\svn\htaccess abhi
    will prompt for a password and create a file named htaccess in the c:\svn directory with the username and password for the user "abhi". I like to keep the password file in the root directory of where my subversion repositories live.

    5. Open the httpd.conf file that is located in c:\program files\Apache Group\Apache2\conf (assuming you did a standard install) and scroll to the bottom of the file. Make the following changes to the lines added above:



















    Save the httpd.conf file and restart the Apache2 service.

    6. If everything has been configured correctly, you should be prompted for a username and password when you access http://localhost:81/svn/test. Once you supply one of the username/password combinations that you provided via the htpasswd utility, you should see the same page you saw when all we had enabled was anonymous access.

    Integrating a simple HelloWorld project with Subversion and CruiseControl.

    http://www.coderanch.com/t/446303/Ant-Maven-Other-Build-Tools/Setting-up-Cruise-Control-with

    http://www.coderanch.com/t/446308/Ant-Maven-Other-Build-Tools/Integrating-simple-HelloWorld-project-with


    BuildToolsFaq
    3 years ago