Clearing Images and Destroying Instances

Two separate questions here.
First I'd like to know how to clear an image that has been drawn, with it being on a random background with multiple colors, without having to redraw the background over and over again. I have an image that moves across the screen and I have the background update only when it needs to to save processing power, but now, obviously, the moving image remains drawn wherever it goes. That or if there's a way to "move" an already drawn image.
Secondly, I'd like to know how to delete an instance of a class from within that class. I have a class that gets called a lot (example: Caller.java), and each time it's called, it creates a new instance of another class (example: NewClass.java), but when Caller.java is called, it is only used once, and I don't want all those instances to just remain there. I'd like to force GC to take care of them at the end of their tasks.
If anyone can provide answers to either of those questions, thank you.

hi,
try to read this it may helpfor the subject:its from thinking in java 2nd edition by bruce eckel:
Cleanup: finalization and
garbage collection
Programmers know about the importance of initialization, but often forget the importance of cleanup. After all, who needs to clean up an int? But with libraries, simply �letting go� of an object once you�re done with it is not always safe. Of course, Java has the garbage collector to reclaim the memory of objects that are no longer used. Now consider a very unusual case. Suppose your object allocates �special� memory without using new. The garbage collector knows only how to release memory allocated with new, so it won�t know how to release the object�s �special� memory. To handle this case, Java provides a method called finalize( ) that you can define for your class. Here�s how it�s supposed to work. When the garbage collector is ready to release the storage used for your object, it will first call finalize( ), and only on the next garbage-collection pass will it reclaim the object�s memory. So if you choose to use finalize( ), it gives you the ability to perform some important cleanup at the time of garbage collection. [ Add Comment ]
This is a potential programming pitfall because some programmers, especially C++ programmers, might initially mistake finalize( ) for the destructor in C++, which is a function that is always called when an object is destroyed. But it is important to distinguish between C++ and Java here, because in C++ objects always get destroyed (in a bug-free program), whereas in Java objects do not always get garbage-collected. Or, put another way: [ Add Comment ]
Garbage collection is not destruction.
If you remember this, you will stay out of trouble. What it means is that if there is some activity that must be performed before you no longer need an object, you must perform that activity yourself. Java has no destructor or similar concept, so you must create an ordinary method to perform this cleanup. For example, suppose in the process of creating your object it draws itself on the screen. If you don�t explicitly erase its image from the screen, it might never get cleaned up. If you put some kind of erasing functionality inside finalize( ), then if an object is garbage-collected, the image will first be removed from the screen, but if it isn�t, the image will remain. So a second point to remember is: [ Add Comment ]
Your objects might not get garbage-collected.
You might find that the storage for an object never gets released because your program never nears the point of running out of storage. If your program completes and the garbage collector never gets around to releasing the storage for any of your objects, that storage will be returned to the operating system en masse as the program exits. This is a good thing, because garbage collection has some overhead, and if you never do it you never incur that expense. [ Add Comment ]
What is finalize( ) for?
You might believe at this point that you should not use finalize( ) as a general-purpose cleanup method. What good is it? [ Add Comment ]
A third point to remember is:
Garbage collection is only about memory.
That is, the sole reason for the existence of the garbage collector is to recover memory that your program is no longer using. So any activity that is associated with garbage collection, most notably your finalize( ) method, must also be only about memory and its deallocation. [ Add Comment ]
Does this mean that if your object contains other objects finalize( ) should explicitly release those objects? Well, no�the garbage collector takes care of the release of all object memory regardless of how the object is created. It turns out that the need for finalize( ) is limited to special cases, in which your object can allocate some storage in some way other than creating an object. But, you might observe, everything in Java is an object so how can this be? [ Add Comment ]
It would seem that finalize( ) is in place because of the possibility that you�ll do something C-like by allocating memory using a mechanism other than the normal one in Java. This can happen primarily through native methods, which are a way to call non-Java code from Java. (Native methods are discussed in Appendix B.) C and C++ are the only languages currently supported by native methods, but since they can call subprograms in other languages, you can effectively call anything. Inside the non-Java code, C�s malloc( ) family of functions might be called to allocate storage, and unless you call free( ) that storage will not be released, causing a memory leak. Of course, free( ) is a C and C++ function, so you�d need to call it in a native method inside your finalize( ). [ Add Comment ]
After reading this, you probably get the idea that you won�t use finalize( ) much. You�re correct; it is not the appropriate place for normal cleanup to occur. So where should normal cleanup be performed? [ Add Comment ]
You must perform cleanup
To clean up an object, the user of that object must call a cleanup method at the point the cleanup is desired. This sounds pretty straightforward, but it collides a bit with the C++ concept of the destructor. In C++, all objects are destroyed. Or rather, all objects should be destroyed. If the C++ object is created as a local (i.e., on the stack�not possible in Java), then the destruction happens at the closing curly brace of the scope in which the object was created. If the object was created using new (like in Java) the destructor is called when the programmer calls the C++ operator delete (which doesn�t exist in Java). If the C++ programmer forgets to call delete, the destructor is never called and you have a memory leak, plus the other parts of the object never get cleaned up. This kind of bug can be very difficult to track down. [ Add Comment ]
In contrast, Java doesn�t allow you to create local objects�you must always use new. But in Java, there�s no �delete� to call to release the object since the garbage collector releases the storage for you. So from a simplistic standpoint you could say that because of garbage collection, Java has no destructor. You�ll see as this book progresses, however, that the presence of a garbage collector does not remove the need for or utility of destructors. (And you should never call finalize( ) directly, so that�s not an appropriate avenue for a solution.) If you want some kind of cleanup performed other than storage release you must still explicitly call an appropriate method in Java, which is the equivalent of a C++ destructor without the convenience. [ Add Comment ]
One of the things finalize( ) can be useful for is observing the process of garbage collection. The following example shows you what�s going on and summarizes the previous descriptions of garbage collection:
//: c04:Garbage.java
// Demonstration of the garbage
// collector and finalization
class Chair {
static boolean gcrun = false;
static boolean f = false;
static int created = 0;
static int finalized = 0;
int i;
Chair() {
i = ++created;
if(created == 47)
System.out.println("Created 47");
public void finalize() {
if(!gcrun) {
// The first time finalize() is called:
gcrun = true;
System.out.println(
"Beginning to finalize after " +
created + " Chairs have been created");
if(i == 47) {
System.out.println(
"Finalizing Chair #47, " +
"Setting flag to stop Chair creation");
f = true;
finalized++;
if(finalized >= created)
System.out.println(
"All " + finalized + " finalized");
public class Garbage {
public static void main(String[] args) {
// As long as the flag hasn't been set,
// make Chairs and Strings:
while(!Chair.f) {
new Chair();
new String("To take up space");
System.out.println(
"After all Chairs have been created:\n" +
"total created = " + Chair.created +
", total finalized = " + Chair.finalized);
// Optional arguments force garbage
// collection & finalization:
if(args.length > 0) {
if(args[0].equals("gc") ||
args[0].equals("all")) {
System.out.println("gc():");
System.gc();
if(args[0].equals("finalize") ||
args[0].equals("all")) {
System.out.println("runFinalization():");
System.runFinalization();
System.out.println("bye!");
} ///:~
The above program creates many Chair objects, and at some point after the garbage collector begins running, the program stops creating Chairs. Since the garbage collector can run at any time, you don�t know exactly when it will start up, so there�s a flag called gcrun to indicate whether the garbage collector has started running yet. A second flag f is a way for Chair to tell the main( ) loop that it should stop making objects. Both of these flags are set within finalize( ), which is called during garbage collection. [ Add Comment ]
Two other static variables, created and finalized, keep track of the number of Chairs created versus the number that get finalized by the garbage collector. Finally, each Chair has its own (non-static) int i so it can keep track of what number it is. When Chair number 47 is finalized, the flag is set to true to bring the process of Chair creation to a stop. [ Add Comment ]
All this happens in main( ), in the loop
while(!Chair.f) {
new Chair();
new String("To take up space");
You might wonder how this loop could ever finish, since there�s nothing inside the loop that changes the value of Chair.f. However, the finalize( ) process will, eventually, when it finalizes number 47. [ Add Comment ]
The creation of a String object during each iteration is simply extra storage being allocated to encourage the garbage collector to kick in, which it will do when it starts to get nervous about the amount of memory available. [ Add Comment ]
When you run the program, you provide a command-line argument of �gc,� �finalize,� or �all.� The �gc� argument will call the System.gc( ) method (to force execution of the garbage collector). Using the �finalize� argument calls System.runFinalization( ) which�in theory�will cause any unfinalized objects to be finalized. And �all� causes both methods to be called. [ Add Comment ]
The behavior of this program and the version in the first edition of this book shows that the whole issue of garbage collection and finalization has been evolving, with much of the evolution happening behind closed doors. In fact, by the time you read this, the behavior of the program may have changed once again. [ Add Comment ]
If System.gc( ) is called, then finalization happens to all the objects. This was not necessarily the case with previous implementations of the JDK, although the documentation claimed otherwise. In addition, you�ll see that it doesn�t seem to make any difference whether System.runFinalization( ) is called. [ Add Comment ]
However, you will see that only if System.gc( ) is called after all the objects are created and discarded will all the finalizers be called. If you do not call System.gc( ), then only some of the objects will be finalized. In Java 1.1, a method System.runFinalizersOnExit( ) was introduced that caused programs to run all the finalizers as they exited, but the design turned out to be buggy and the method was deprecated. This is yet another clue that the Java designers were thrashing about trying to solve the garbage collection and finalization problem. We can only hope that things have been worked out in Java 2. [ Add Comment ]
The preceding program shows that the promise that finalizers will always be run holds true, but only if you explicitly force it to happen yourself. If you don�t cause System.gc( ) to be called, you�ll get an output like this:
Created 47
Beginning to finalize after 3486 Chairs have been created
Finalizing Chair #47, Setting flag to stop Chair creation
After all Chairs have been created:
total created = 3881, total finalized = 2684
bye!
Thus, not all finalizers get called by the time the program completes. If System.gc( ) is called, it will finalize and destroy all the objects that are no longer in use up to that point. [ Add Comment ]
Remember that neither garbage collection nor finalization is guaranteed. If the Java Virtual Machine (JVM) isn�t close to running out of memory, then it will (wisely) not waste time recovering memory through garbage collection. [ Add Comment ]
The death condition
In general, you can�t rely on finalize( ) being called, and you must create separate �cleanup� functions and call them explicitly. So it appears that finalize( ) is only useful for obscure memory cleanup that most programmers will never use. However, there is a very interesting use of finalize( ) which does not rely on it being called every time. This is the verification of the death condition[29] of an object. [ Add Comment ]
At the point that you�re no longer interested in an object�when it�s ready to be cleaned up�that object should be in a state whereby its memory can be safely released. For example, if the object represents an open file, that file should be closed by the programmer before the object is garbage-collected. If any portions of the object are not properly cleaned up, then you have a bug in your program that could be very difficult to find. The value of finalize( ) is that it can be used to discover this condition, even if it isn�t always called. If one of the finalizations happens to reveal the bug, then you discover the problem, which is all you really care about. [ Add Comment ]
Here�s a simple example of how you might use it:
//: c04:DeathCondition.java
// Using finalize() to detect an object that
// hasn't been properly cleaned up.
class Book {
boolean checkedOut = false;
Book(boolean checkOut) {
checkedOut = checkOut;
void checkIn() {
checkedOut = false;
public void finalize() {
if(checkedOut)
System.out.println("Error: checked out");
public class DeathCondition {
public static void main(String[] args) {
Book novel = new Book(true);
// Proper cleanup:
novel.checkIn();
// Drop the reference, forget to clean up:
new Book(true);
// Force garbage collection & finalization:
System.gc();
} ///:~
The death condition is that all Book objects are supposed to be checked in before they are garbage-collected, but in main( ) a programmer error doesn�t check in one of the books. Without finalize( ) to verify the death condition, this could be a difficult bug to find. [ Add Comment ]
Note that System.gc( ) is used to force finalization (and you should do this during program development to speed debugging). But even if it isn�t, it�s highly probable that the errant Book will eventually be discovered through repeated executions of the program (assuming the program allocates enough storage to cause the garbage collector to execute). [ Add Comment ]

Similar Messages

  • HT5148 i am using final cut pro x. i have imported some images and video in my timeline. when i play back my video it looks fuzzy. but, when i pause it, it looks clear. how do i get my video to play clear.

    i am using final cut pro x. i have imported some images and video in my timeline. when i play back my video it looks fuzzy. but, when i pause it, it looks clear again. how do i get my video to play clear and not fuzzy?

    Same reply.

  • Previous image flashes on the screen occasionally when opening safari. Even after clearing history and cache.

    Occasionally an image from a previous website appears briefly when opening safari. I'm afraid it might do it with a site that has private information and other individuals use this ipad. Is this a problem fixed in the updates to the iOS or something different entirely.  The image flashes sometimes even after clearing history and cache.

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try another cable
    - Try on another computer                            
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
      Apple Retail Store - Genius Bar                              

  • How can I create clearer, sharper images and buttons in Muse?

    How can I create buttons and images that have a vector like clarity? When I upload images (buttons, jpegs and pngs) a lot of the time they seem to have a slightly fuzzy quality to them. I have read previous posts on this matter and none have helped. Any feedback on this will be greatly appreciated. Thanks

    When you place your images in exactly the size you saved them in Photoshop or whatever, Muse doesn’t touch it.
    The quality in this case is the quality you saved the image.
    The best way is, to examine in Muse the available pixel size of the image and then use Photoshop to obtain this size
    A helpful widget to examine the potential size of an image in advance, is the "lore ipsum"-Muse-widget, that you find in the free widget collection "Andrew’s Prototypes":
    Andrew Prototypes | Exchange | Adobe Muse CC

  • AS3 Load external image and add multiple instances to mcs

    Hi,
    Is there any way to load an external image and add it to more than one movie clip?
    Thanks,
    Chris McLaughlin

    Hi kglad,
    I was loading a larger jpeg to which I was applying 20 different masks so using the bitmapdata class to create duplicates was the best solution.
    It took me some time to wrap my head around it, but all is well.
    Thanks for pointing me in the right direction.
    Best regards,
    Chris

  • How to display URL images and URL link (html) from Smartforms?

    Hi Gurus,
    I'm having difficulty on how to display targeted URL images and URL link from the smartforms, after i sending it out as html mail. The mail i sent just can be preview as a plain text, which can't execute the html code that i put inside the smartforms itself. I follow a few step from this very useful blog.. Hopefully, you guys can give me some solutions or ideas on this.
    /people/pavan.bayyapu/blog/2005/08/30/sending-html-email-from-sap-crmerp -thanks to Pavan for his useful blog.
    My code is like this..
    <--- Start Code.
    FORM call_smartforms.
      DATA : lv_subject TYPE so_obj_des,
             lc_true(1) VALUE 'X',
             lw_control_parameters TYPE ssfctrlop,
             lw_output_options TYPE ssfcompop,
             lc_graphics(8) VALUE 'GRAPHICS',
             lw_xsfparam_line TYPE ssfxsfp,
             lc_extract(7) VALUE 'EXTRACT',
             lc_graphics_directory(18) VALUE 'GRAPHICS-DIRECTORY',
             lc_mygraphics(11) VALUE 'mygraphics/',
             lc_content_id(10) VALUE 'CONTENT-ID',
             lc_enable(6) VALUE 'ENABLE',
             lw_job_output_info TYPE ssfcrescl,
             lw_html_data TYPE trfresult,
             lw_graphics TYPE ssf_xsf_gr,
             lt_graphics TYPE tsf_xsf_gr,
             lv_html_xstr TYPE xstring,
             lw_html_raw LIKE LINE OF lw_html_data-content,
             lv_incode TYPE tcp00-cpcodepage VALUE '4110',
             lv_html_str TYPE string,
             lv_html_len TYPE i,
             lc_utf8(5) VALUE 'utf-8',
             lc_latin1(6) VALUE 'latin1',
             lv_offset TYPE i,
             lv_length TYPE i,
             lv_diff TYPE i,
             lt_soli TYPE soli_tab,
             lw_soli TYPE soli,
             lc_mime_helper TYPE REF TO cl_gbt_multirelated_service,
             lv_name TYPE mime_text VALUE 'sapwebform.htm',
             lv_xstr TYPE xstring,
             lw_raw TYPE bapiconten,
             lt_solix TYPE solix_tab,
             lw_solix TYPE solix,
             lv_filename TYPE string,
             lv_content_id TYPE string,
             lv_content_type TYPE w3conttype,
             lv_obj_len TYPE so_obj_len,
             lv_bmp TYPE so_fileext VALUE 'BMP',
             lv_description TYPE so_obj_des VALUE 'Graphic in BMP format',
             lc_doc_bcs TYPE REF TO cl_document_bcs,
             lc_bcs TYPE REF TO cl_bcs,
             lc_send_exception TYPE REF TO cx_root,
             lw_adsmtp TYPE lty_adsmtp,
             lv_mail_address TYPE ad_smtpadr,
             lc_recipient TYPE REF TO if_recipient_bcs,
             lc_send_request TYPE REF TO cl_bcs,
             lv_sent_to_all TYPE os_boolean.
      DATA : v_language TYPE sflangu VALUE 'E',
             v_e_devtype TYPE rspoptype.
      v_form_name = 'ZTEST_EMAIL'.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = v_form_name
        IMPORTING
          fm_name            = v_namef
        EXCEPTIONS
          no_form            = 1
          no_function_module = 2
          OTHERS             = 3.
      IF sy-subrc = 0.
       break mhusin.
      ENDIF.
    starting here. ***
    Set title for the output
      lv_subject = 'Smartforms.'.
    Set control parameters to "no dialog"
      lw_control_parameters-no_dialog = lc_true.
    IF lw_service_subject-code = lc_fm1.
    *--- To get output device type
      CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
        EXPORTING
          i_language    = v_language
          i_application = 'SAPDEFAULT'
        IMPORTING
          e_devtype     = v_e_devtype.
      lw_output_options-tdprinter = v_e_devtype.
      lw_control_parameters-getotf = 'X'.
      IF sy-subrc = 0.
       break mhusin.
      ENDIF.
    Set output options
      lw_output_options-xsf        = lc_true.
      lw_output_options-xsfcmode   = lc_true.
      lw_output_options-xsfoutmode = 'A'.
      lw_output_options-xsfoutdev  = space.
      lw_output_options-xsfformat  = lc_true.
      lw_xsfparam_line-name  = lc_graphics.
      lw_xsfparam_line-value = lc_extract.
      APPEND lw_xsfparam_line TO lw_output_options-xsfpars.
      lw_xsfparam_line-name  = lc_graphics_directory.
      lw_xsfparam_line-value = lc_mygraphics.
      APPEND lw_xsfparam_line TO lw_output_options-xsfpars.
      lw_xsfparam_line-name  = lc_content_id.
      lw_xsfparam_line-value = lc_enable.
      APPEND lw_xsfparam_line TO lw_output_options-xsfpars.
    Get the smartform content
      CALL FUNCTION v_namef
        EXPORTING
          control_parameters   = lw_control_parameters
          output_options       = lw_output_options
    *pass other application specific parameters (eg order number, items ).
      IMPORTING
          job_output_info    = lw_job_output_info
      TABLES
          tt_tabh              = tt_tabh
          tt_tabb              = tt_tabb
          tt_tabf              = tt_tabf
      EXCEPTIONS
          formatting_error = 1
          internal_error   = 2
          send_error       = 3
          user_canceled    = 4
          OTHERS           = 5.
      IF sy-subrc = 0.
       break mhusin.
      ENDIF.
      lw_html_data  = lw_job_output_info-xmloutput-trfresult.
      lt_graphics[] = lw_job_output_info-xmloutput-xsfgr[].
      CLEAR lv_html_xstr.
      LOOP AT lw_html_data-content INTO lw_html_raw.
        CONCATENATE lv_html_xstr lw_html_raw INTO lv_html_xstr IN BYTE MODE.
      ENDLOOP.
      lv_html_xstr = lv_html_xstr(lw_html_data-length).
      CALL FUNCTION 'SCP_TRANSLATE_CHARS'
        EXPORTING
          inbuff       = lv_html_xstr
          incode       = lv_incode
          csubst       = lc_true
          substc_space = lc_true
        IMPORTING
          outbuff      = lv_html_str
          outused      = lv_html_len
        EXCEPTIONS
          OTHERS       = 1.
    *HACK THE HTML CODE GENERATED BY SMARTFORM TO MAKE THE
    *EXTERNAL IMAGES APPEAR AS <IMG> TAG IN HTML
      REPLACE ALL OCCURRENCES OF '<IMG' IN lv_html_str WITH '<IMG' IGNORING CASE.
      REPLACE ALL OCCURRENCES OF '/>' IN lv_html_str WITH '/>' IGNORING CASE.
      REPLACE ALL OCCURRENCES OF '</A>' IN lv_html_str WITH '' IGNORING CASE.
      REPLACE ALL OCCURRENCES OF '<' IN lv_html_str WITH '<' IGNORING CASE.
      REPLACE ALL OCCURRENCES OF '>' IN lv_html_str WITH '>' IGNORING CASE.
    CALL METHOD html_control - >load_mime_object
       EXPORTING
         object_id  = 'ZWN'
         object_url = 'ZWN.GIF'
       EXCEPTIONS
         OTHERS     = 1.
      REPLACE ALL OCCURRENCES OF lc_utf8 IN lv_html_str WITH lc_latin1.
    REPLACE ALL OCCURRENCES OF lc_utf8 IN lv_html_str WITH 'iso-8859-1'.
       break mhusin.
      lv_html_len = STRLEN( lv_html_str ).
      lv_offset = 0.
      lv_length = 255.
      WHILE lv_offset < lv_html_len.
        lv_diff = lv_html_len - lv_offset.
        IF lv_diff > lv_length.
          lw_soli-line = lv_html_str+lv_offset(lv_length).
        ELSE.
          lw_soli-line = lv_html_str+lv_offset(lv_diff).
        ENDIF.
        APPEND lw_soli TO lt_soli.
        ADD lv_length TO lv_offset.
      ENDWHILE.
      CREATE OBJECT lc_mime_helper.
      CALL METHOD lc_mime_helper->set_main_html
        EXPORTING
          content     = lt_soli
          filename    = lv_name
          description = lv_subject.
      LOOP AT lt_graphics INTO lw_graphics.
        CLEAR lv_xstr.
        LOOP AT lw_graphics-content INTO lw_raw.
          CONCATENATE lv_xstr lw_raw-line INTO lv_xstr IN BYTE MODE.
        ENDLOOP.
        lv_xstr = lv_xstr(lw_graphics-length).
        lv_offset = 0.
        lv_length = 255.
        CLEAR lt_solix[].
        WHILE lv_offset < lw_graphics-length.
          lv_diff = lw_graphics-length - lv_offset.
          IF lv_diff > lv_length.
            lw_solix-line = lv_xstr+lv_offset(lv_length).
          ELSE.
            lw_solix-line = lv_xstr+lv_offset(lv_diff).
          ENDIF.
          APPEND lw_solix TO lt_solix.
          ADD lv_length TO lv_offset.
        ENDWHILE.
        CONCATENATE lc_mygraphics lw_graphics-graphics text-001 INTO lv_filename.
        CONCATENATE lc_mygraphics lw_graphics-graphics text-001 INTO lv_content_id.
        lv_content_type = lw_graphics-httptype.
        lv_obj_len      = lw_graphics-length.
    *Add images to the email
        CALL METHOD lc_mime_helper->add_binary_part
          EXPORTING
            content      = lt_solix
            filename     = lv_filename
            extension    = lv_bmp
            description  = lv_description
            content_type = lv_content_type
            length       = lv_obj_len
            content_id   = lv_content_id.
      ENDLOOP.
      TRY.
          lv_subject = lv_subject.
          lc_doc_bcs = cl_document_bcs=>create_from_multirelated(
                   i_subject          = lv_subject
                   i_multirel_service = lc_mime_helper ).
        CATCH cx_document_bcs INTO lc_send_exception.
        CATCH cx_bcom_mime INTO lc_send_exception.
        CATCH cx_gbt_mime INTO lc_send_exception.
      ENDTRY.
    Create send request
      TRY.
          lc_bcs = cl_bcs=>create_persistent( ).
        CATCH cx_send_req_bcs INTO lc_send_exception.
      ENDTRY.
      TRY.
          lc_bcs->set_document( i_document = lc_doc_bcs ).
        CATCH cx_send_req_bcs INTO lc_send_exception.
      ENDTRY.
    Set-up email receiver
      lv_mail_address = '[email protected]'.
    TRANSLATE lv_mail_address TO UPPER CASE.
      TRY.
          lc_recipient = cl_cam_address_bcs=>create_internet_address(
              i_address_string = lv_mail_address ).
        CATCH cx_address_bcs INTO lc_send_exception.
      ENDTRY.
      TRY.
          lc_bcs->add_recipient( i_recipient = lc_recipient ).
        CATCH cx_send_req_bcs INTO lc_send_exception.
      ENDTRY.
    Send smartforms as HTML email
      TRY.
          lc_bcs->send( ).
        CATCH cx_send_req_bcs INTO lc_send_exception.
      ENDTRY.
      COMMIT WORK.
      WRITE:/ 'Mail sent'.
    ENDFORM.                    "call_smartforms
    End Code --->
    Thanks and Regards.

    1- put your images in a directory under the web app directory. Example: app/images/
    2- in your jsp, use: String file = application.getRealPath("/images/"); to get the images directory. See http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String)
    3- it's not the right forum to post this kind of question. Post them in the JSP/Servlet JSTL forum instead

  • Zooming an image and scrolling it using a JScrollPane

    Hi all, I know this is one of the most common problems in this forum but i cant get any of the replys to work in my code.
    The problem:
    I create an image with varying pixel colors depending on the value obtained from an AbstractTableModel and display it to the screen.
    I then wish to be able to zoom in on the image and make it scrollable as required.
    At the minute the scrolling method is working but only when i resize or un-focus and re-focus the JInternalFrame. Ive tried calling revalidate (and various other options) on the JScrollPane within the paintComponents(Graphics g) method but all to no avail.
    Has anyone out there any ideas cause this is melting my head!
    Heres the code im using (instance is called and added to a JDesktopPane):
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.awt.geom.AffineTransform;
    import uk.ac.qub.mvda.gui.MVDATableModel;
    import uk.ac.qub.mvda.utils.MVDAConstants;
    public class HCLSpectrumPlot extends JInternalFrame implements MVDAConstants
      AbstractAction zoomInAction = new ZoomInAction();
      AbstractAction zoomOutAction = new ZoomOutAction();
      double zoomFactorX = 1.0;
      double zoomFactorY = 1.0;
      private AffineTransform theTransform;
      private ImagePanel imageViewerPanel;
      private JScrollPane imageViewerScroller;
      public HCLSpectrumPlot(String title, MVDATableModel model)
        super(title, true, true, true, true);
        int imageHeight_numOfRows = model.getRowCount();
        int imageWidth_numOfCols = model.getColumnCount();
        int numberOfColourBands = 3;
        double maxValueInTable = 0;
        double[][] ValueAtTablePosition =
            new double[imageHeight_numOfRows][imageWidth_numOfCols];
        for(int i=0; i<imageHeight_numOfRows; i++)
          for(int j=0; j<imageWidth_numOfCols; j++)
         ValueAtTablePosition[i][j] = ((Double)model.getValueAt
                 (i,j)).doubleValue();
        for(int i=0; i<imageHeight_numOfRows; i++)
          for(int j=0; j<imageWidth_numOfCols; j++)
         if ( ValueAtTablePosition[i][j] > maxValueInTable)
           maxValueInTable = ValueAtTablePosition[i][j];
        BufferedImage newImage = new BufferedImage(imageWidth_numOfCols,
              imageHeight_numOfRows, BufferedImage.TYPE_3BYTE_BGR);
        WritableRaster newWritableImage = newImage.getRaster();
        int colourB;
        double pixelValue, cellValue, newPixelValue;
        for (int x = 0; x < imageHeight_numOfRows; x++)
          for (int y = 0; y < imageWidth_numOfCols; y++)
         colourB = 0;
         cellValue = ValueAtTablePosition[x][y];
         pixelValue = (1 - (cellValue / maxValueInTable)) * 767;
         pixelValue = pixelValue - 256;
         while (colourB < numberOfColourBands)
           if ( pixelValue < 0 )
             newPixelValue = 256 + pixelValue;
             newWritableImage.setSample(x, y, colourB, newPixelValue);
             colourB++;
                while ( colourB < numberOfColourBands )
               newWritableImage.setSample(x, y, colourB, 0);
               colourB++;
         else
           newWritableImage.setSample(x, y, colourB, 255);
         colourB++;
         pixelValue = pixelValue - 256;
          }//while
         }//for-y
        }//for-x
        imageViewerPanel = new ImagePanel(this, newImage);
        imageViewerScroller =     new JScrollPane(imageViewerPanel,
                            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                   JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
        this.getContentPane().setLayout(new BorderLayout());
        this.getContentPane().add(imageViewerScroller, BorderLayout.CENTER);
        JToolBar editTools = new JToolBar();
        editTools.setOrientation(JToolBar.VERTICAL);
        editTools.add(zoomInAction);
        editTools.add(zoomOutAction);
        this.getContentPane().add(editTools, BorderLayout.WEST);
        this.setVisible(true);
      class ImagePanel extends JPanel
        private int iWidth, iHeight;
        private int i=0;
        private BufferedImage bufferedImageToDisplay;
        private JInternalFrame parentFrame;
        public ImagePanel(JInternalFrame parent, BufferedImage image)
          super();
          parentFrame = parent;
          bufferedImageToDisplay = image;
          iWidth = bufferedImageToDisplay.getWidth();
          iHeight = bufferedImageToDisplay.getHeight();
          theTransform = new AffineTransform();
          //theTransform.setToScale(parent.getContentPane().getWidth(),
                                    parent.getContentPane().getHeight());
          this.setPreferredSize(new Dimension(iWidth, iHeight));
        }//Constructor
        public void paintComponent(Graphics g)
          super.paintComponent(g);
          ((Graphics2D)g).drawRenderedImage(bufferedImageToDisplay,
                                             theTransform);
          this.setPreferredSize(new Dimension((int)(iWidth*zoomFactorX),
                                          (int)(iHeight*zoomFactorY)));
        }//paintComponent
      }// end class ImagePanel
       * Class to handle a zoom in event
       * @author Ross McCaughrain
       * @version 1.0
      class ZoomInAction extends AbstractAction
       * Default Constructor.
      public ZoomInAction()
        super(null, new ImageIcon(HCLSpectrumPlot.class.getResource("../"+
                  MVDAConstants.PATH_TO_IMAGES + "ZoomIn24.gif")));
        this.putValue(Action.SHORT_DESCRIPTION,"Zooms In on the Image");
        this.setEnabled(true);
      public void actionPerformed(ActionEvent e)
        zoomFactorX += 0.5;
        zoomFactorY += 0.5;
        theTransform = AffineTransform.getScaleInstance(zoomFactorX,
                                                    zoomFactorY);
        repaint();
      // ZoomOut to be implemented
    }// end class HCLSpectrumPlotAll/any help greatly appreciated! thanks for your time.
    RossMcC

    Small mistake, the revalidate must be called on the panel not on the jsp.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class UsaZ extends JFrame 
         IPanel      panel = new IPanel();
         JScrollPane jsp   = new JScrollPane(panel);
    public UsaZ() 
         addWindowListener(new WindowAdapter()
         addWindowListener(new WindowAdapter()
         {     public void windowClosing(WindowEvent ev)
              {     dispose();
                   System.exit(0);
         setBackground(Color.lightGray);
         getContentPane().add("Center",jsp);
         setBounds(1,1,400,320);
         setVisible(true);
    public class IPanel extends JComponent
         Image  map;
         double zoom = 1;
         double iw;
         double ih;
    public IPanel()
         map = getToolkit().createImage("us.gif");
         MediaTracker tracker = new MediaTracker(this);
         tracker.addImage(map,0);
         try {tracker.waitForID(0);}
         catch (InterruptedException e){}
         iw = map.getWidth(this);
         ih = map.getHeight(this);
         zoom(0);     
         addMouseListener(new MouseAdapter()     
         {     public void mouseReleased(MouseEvent m)
                   zoom(0.04);               
                   repaint();      
                   revalidate();
    public void zoom(double z)
         zoom = zoom + z;
         setPreferredSize(new Dimension((int)(iw*zoom)+2,(int)(ih*zoom)+2));
    public void paintComponent(Graphics g)
         super.paintComponent(g);
         Graphics2D g2 = (Graphics2D)g;
         g2.scale(zoom,zoom);
         g2.drawImage(map,1,1,null);
         g.drawRect(0,0,map.getWidth(this)+1,map.getHeight(this)+1);
    public static void main (String[] args) 
          new UsaZ();
    [/cdoe]
    Noah                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to use the Rectangle class to draw an image and center it in a JPanel

    I sent an earlier post on how to center an image in a JPanel using the Rectangle class. I was asked to send an executable code which will show the malfunction. The code below is an executable code and a small part of a very big project. To simplifiy things, it is just a JFrame and a JPanel with an open dialog. Once executed the JFrame and the FileDialog will open. You can then navigate to a .gif or a .jpg picture and open it. What I want is for the picture to be centered in the middle of the JPanel and not the upper left corner. It is also important to stress that, I am usinig the Rectangle class to draw the Image. The region of interest is where the rectangle is created. In the constructor of the CenterRect class, I initialize the Rectangle class. Then I use paintComponent in the CenterRect class to draw the Image. The other classes are just support classes. The MyImage class is an extended image class which also has a draw() method. Any assistance in getting the Rectangle to show at the center of the JPanel without affecting the size and shape of the image will be greatly appreciated.
    I have divided the code into three parts. They are all supposed to be on one file in order to execute.
    import java.awt.*;
    import java.awt.image.*;
    import javax.swing.*;
    public class CenterRect extends JPanel {
        public static Rectangle srcRect;
        Insets insets = null;
        Image image;
        MyImage imp;
        private double magnification;
        private int dstWidth, dstHeight;
        public CenterRect(MyImage imp){
            insets = getInsets();
            this.imp = imp;
            int width = imp.getWidth();
            int height = imp.getHeight();
            ImagePanel.init();
            srcRect = new Rectangle(0,0, width, height);
            srcRect.setLocation(0,0);
            setDrawingSize(width, height);
            magnification = 1.0;
        public void setDrawingSize(int width, int height) {
            dstWidth = width;
            dstHeight = height;
            setSize(dstWidth, dstHeight);
        public void paintComponent(Graphics g) {
            Image img = imp.getImage();
         try {
                if (img!=null)
                    g.drawImage(img,0,0, (int)(srcRect.width*magnification), (int)(srcRect.height*magnification),
              srcRect.x, srcRect.y, srcRect.x+srcRect.width, srcRect.y+srcRect.height, null);
            catch(OutOfMemoryError e) {e.printStackTrace();}
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new Opener().openImage();
    class Opener{
        private String dir;
        private String name;
        private static String defaultDirectory;
        JFrame parent;
        public Opener() {
            initComponents();
         public void initComponents(){
            parent = new JFrame();
            parent.setContentPane(ImagePanel.panel);
            parent.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
            parent.setExtendedState(JFrame.MAXIMIZED_BOTH);
            parent.setVisible(true);
        public void openDialog(String title, String path){
            if (path==null || path.equals("")) {
                FileDialog fd = new FileDialog(parent, title);
                defaultDirectory = "dir.image";
                if (defaultDirectory!=null)
                    fd.setDirectory(defaultDirectory);
                fd.setVisible(true);
                name = fd.getFile();
                if (name!=null) {
                    dir = fd.getDirectory();
                    defaultDirectory = dir;
                fd.dispose();
                if (parent==null)
                    return;
            } else {
                int i = path.lastIndexOf('/');
                if (i==-1)
                    i = path.lastIndexOf('\\');
                if (i>0) {
                    dir = path.substring(0, i+1);
                    name = path.substring(i+1);
                } else {
                    dir = "";
                    name = path;
        public MyImage openImage(String directory, String name) {
            MyImage imp = openJpegOrGif(dir, name);
            return imp;
        public void openImage() {
            openDialog("Open...", "");
            String directory = dir;
            String name = this.name;
            if (name==null)
                return;
            MyImage imp = openImage(directory, name);
            if (imp!=null) imp.show();
        MyImage openJpegOrGif(String dir, String name) {
                MyImage imp = null;
                Image img = Toolkit.getDefaultToolkit().getImage(dir+name);
                if (img!=null) {
                    imp = new MyImage(name, img);
                    FileInfo fi = new FileInfo();
                    fi.fileFormat = fi.GIF_OR_JPG;
                    fi.fileName = name;
                    fi.directory = dir;
                    imp.setFileInfo(fi);
                return imp;
    }

    This is the second part. It is a continuation of the first part. They are all supposed to be on one file.
    class MyImage implements ImageObserver{
        private int imageUpdateY, imageUpdateW,width,height;
        private boolean imageLoaded;
        private static int currentID = -1;
        private int ID;
        private static Component comp;
        protected ImageProcessor ip;
        private String title;
        protected Image img;
        private static int xbase = -1;
        private static int ybase,xloc,yloc;
        private static int count = 0;
        private static final int XINC = 8;
        private static final int YINC = 12;
        private int originalScale = 1;
        private FileInfo fileInfo;
        ImagePanel win;
        /** Constructs an ImagePlus from an AWT Image. The first argument
         * will be used as the title of the window that displays the image. */
        public MyImage(String title, Image img) {
            this.title = title;
             ID = --currentID;
            if (img!=null)
                setImage(img);
        public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h) {
             imageUpdateY = y;
             imageUpdateW = w;
             imageLoaded = (flags & (ALLBITS|FRAMEBITS|ABORT)) != 0;
         return !imageLoaded;
        public int getWidth() {
             return width;
        public int getHeight() {
             return height;
        /** Replaces the ImageProcessor, if any, with the one specified.
         * Set 'title' to null to leave the image title unchanged. */
        public void setProcessor(String title, ImageProcessor ip) {
            if (title!=null) this.title = title;
            this.ip = ip;
            img = ip.createImage();
            boolean newSize = width!=ip.getWidth() || height!=ip.getHeight();
         width = ip.getWidth();
         height = ip.getHeight();
         if (win!=null && newSize) {
                win = new ImagePanel(this);
        public void draw(){
            CenterRect ic = null;
            win = new ImagePanel(this);
            if (win!=null){
                win.addIC(this);
                win.getCanvas().repaint();
                ic = win .getCanvas();
                win.panel.add(ic);
                int width = win.imp.getWidth();
                int height = win.imp.getHeight();
                Point ijLoc = new Point(10,32);
                if (xbase==-1) {
                    xbase = 5;
                    ybase = ijLoc.y;
                    xloc = xbase;
                    yloc = ybase;
                if ((xloc+width)>ijLoc.x && yloc<(ybase+20))
                    yloc = ybase+20;
                    int x = xloc;
                    int y = yloc;
                    xloc += XINC;
                    yloc += YINC;
                    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
                    count++;
                    if (count%6==0) {
                        xloc = xbase;
                        yloc = ybase;
                    int scale = 1;
                    while (xbase+XINC*4+width/scale>screen.width || ybase+YINC*4+height/scale>screen.height)
                        if (scale>1) {
                   originalScale = scale;
                   ic.setDrawingSize(width/scale, height/scale);
        /** Returns the current AWT image. */
        public Image getImage() {
            if (img==null && ip!=null)
                img = ip.createImage();
            return img;
        /** Replaces the AWT image, if any, with the one specified. */
        public void setImage(Image img) {
            waitForImage(img);
            this.img = img;
            JPanel panel = ImagePanel.panel;
            width = img.getWidth(panel);
            height = img.getHeight(panel);
            ip = null;
        /** Opens a window to display this image and clears the status bar. */
        public void show() {
            show("");
        /** Opens a window to display this image and displays
         * 'statusMessage' in the status bar. */
        public void show(String statusMessage) {
            if (img==null && ip!=null){
                img = ip.createImage();
            if ((img!=null) && (width>=0) && (height>=0)) {
                win = new ImagePanel(this);
                draw();
        private void waitForImage(Image img) {
        if (comp==null) {
            comp = ImagePanel.panel;
            if (comp==null)
                comp = new JPanel();
        imageLoaded = false;
        if (!comp.prepareImage(img, this)) {
            double progress;
            while (!imageLoaded) {
                if (imageUpdateW>1) {
                    progress = (double)imageUpdateY/imageUpdateW;
                    if (!(progress<1.0)) {
                        progress = 1.0 - (progress-1.0);
                        if (progress<0.0) progress = 0.9;
    public void setFileInfo(FileInfo fi) {
        fi.pixels = null;
        fileInfo = fi;
    }

  • Online banking site now shows login page as text-only; on different computer it still shows page with images and clickables -- is there a fix?

    Previously when I logged in to my INGdirect online bank account, the login window came up showing images and clickable hotspots. Recently, the login window changed to a text-only version. On two different computers running Firefox, the login comes up in the previous version, with images and clickable hotspots. I'm unaware of having done anything to change my settings either in Firefox or on the banking website. Because it seems to be localized on this computer, I've tried downloading latest version of Firefox, but got no change, login still comes up in text-only format.

    Try clearing your browser cache.
    Tools > Clear Recent History... - hit Details and make sure only Cache is selected, then select Everything and hit the Clear Now button.

  • I have a Flash Sample to rotate images and text but I not find a way to display special characters

    Hello everyone.
    I bought a very nice Flash application that rotate images, and text of any color and size. It use an XML input file.
    I've posted here, a complete copy, so any of you can download, view and use it freely.
    I would appreciate if any of you know how to do, so that the text displayed, including the characters I use in my language (Spanish), such as á, é, í, ó, ú, ñ, and other special characters.
    In fact, I could not find a way to do it, because I'm not expert Flash, and less in ActionScript.
    If any of you would help me on that, I thank you implement the appropriate adjustments and compressed into a. zip file, and let me know where to download it, or if you prefer you can send it to my email: [email protected]
    After all compressed in .zip format is a very small file: 430K.
    Click here to download the complete sample.
    Thanks.
    =====================================
    Translated using http://translate.google.es
    =====================================

    Hello Rinus,
    If I understood your last post correctly, then problem 2 is resolved, right?
    Regarding problem 3:
    I'm not asking you to share exact VIs.
    I just want to see a very simple VI that explains the concept of what you're trying to do, what should happen (this can be in words that refer to the front panel elements) and what you've tried.
    The terminology you're using isn't clear to me without an extra explanation.
    This could even be only a Front Panel with a few buttons on where you just describe what should happen with specific controls/indicators.
    Based on the first post it is not clear to me what you mean with:
    - A "button element":
      Are you talking about a control, an indicator, a cluster that contains multiple control?
    - The structure:
      Is this an event structure, case structure, for loop, ...?
    Is it seems like you want to programmatically control Front Panel objects, which on itself is no problem at all independent of how many objects you want to control.
    Please share with me simple example of what goes wrong and explain which things should happen on that specific Front Panel.
    This will allow me to help you and also allow me to guide you along the right path.
    Kind Regards,
    Thierry C - Applications Engineering Specialist Northern European Region - National Instruments
    CLD, CTA
    If someone helped you, let them know. Mark as solved and/or give a kudo.

  • Content type, list definition and List instance - query

    Dear all,
    I created a list content type, list definition and list instance for a SessionsList.
    I did mistake when created a event receiver file where field name is RegistrationsInfo - did typo error as RegistrationInfo. This field I want to make it as false in the ShowInNewForm= false
    When I deploy it with event receiver file - I am getting stack trace error stating that the RegistrationsInfo field is missing.
    Without event receiver file - when I deploy the solution and checked the field name - it is showing rightly as RegistrationsInfo.
    Content Type:-
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Field ID="{7113CBE5-57E9-4082-A0A2-492B35B69C8D}" Type="Lookup" List="Lists/Courses-List" ShowField="Title" Name="CourseTitle" DisplayName="Courses - Title" Required="FALSE" Group="Training Site Columns"/>
    <Field ID="{920AE6A7-2AAE-4E43-8855-7CBD9978EC5E}" Type="Lookup" List="Lists/SessionTrainer" ShowField="FullName" Name="Trainer" DisplayName="Trainer" Required="FALSE" Group="Training Site Columns"/>
    <Field ID="{F73D9A96-3C86-4E33-96D5-31E30B08BF40}" Type="Choice" Name="TrainingVenue" DisplayName="Training Venue" Required="FALSE" Group="Training Site Columns">
    <CHOICES>
    <CHOICE>Kerala Meeting Room</CHOICE>
    <CHOICE>Orissa Meeting Room</CHOICE>
    <CHOICE>Bihar Meeting Room</CHOICE>
    </CHOICES>
    </Field>
    <Field ID="{B6E9C8F5-F1BD-4D98-BD30-194504859ACC}" Type="Number" Decimals="0" Min="0" Name="RegistrationsInfo" DisplayName="Registrations Info" Required="FALSE" Group="Training Site Columns"/>
    <Field ID="{03281B47-F1D1-477E-9793-3A19118720EE}" Type="Number" Decimals="0" Min="0" Name="TotalSeatsInfo" DisplayName="Total Seats Info" Required="FALSE" Group="Training Site Columns"/>
    <Field ID="{8A900663-6351-445B-ACB3-394F44D45C8D}" Type="Calculated" ResultType="Number" ReadOnly="TRUE" Name="OpenSeatsInfo" DisplayName="Open Seats Info" Required="FALSE" Group="Training Site Columns">
    <Formula>=TotalSeatsInfo-RegistrationsInfo</Formula>
    <FieldRefs>
    <FieldRef Name="TotalSeatsInfo" ID="{03281B47-F1D1-477E-9793-3A19118720EE}"/>
    <FieldRef Name="RegistrationsInfo" ID="{B6E9C8F5-F1BD-4D98-BD30-194504859ACC}"/>
    </FieldRefs>
    </Field>
    <!-- Parent ContentType: Item (0x01) -->
    <ContentType ID="0x0100a9dc01b7e78b45799fe59153d97e2b9e"
    Name="SessionList"
    Group="Session Content Types"
    Description="Session Content Type"
    Inherits="TRUE"
    Version="0">
    <FieldRefs>
    <FieldRef ID="{7113CBE5-57E9-4082-A0A2-492B35B69C8D}" Name="CourseTitle" DisplayName="Courses - Title" Required="TRUE"/>
    <FieldRef ID="{920AE6A7-2AAE-4E43-8855-7CBD9978EC5E}" Name="Trainer" DisplayName="Trainer" Required="FALSE" />
    <FieldRef ID="{F73D9A96-3C86-4E33-96D5-31E30B08BF40}" Name="TrainingVenue" DisplayName="Training Venue" Required="FALSE"/>
    <FieldRef ID="{B6E9C8F5-F1BD-4D98-BD30-194504859ACC}" Name="RegistrationsInfo" DisplayName="Registrations Info" Required="FALSE"/>
    <FieldRef ID="{03281B47-F1D1-477E-9793-3A19118720EE}" Name="TotalSeatsInfo" DisplayName="Total Seats Info" Required="FALSE"/>
    <FieldRef ID="{8A900663-6351-445B-ACB3-394F44D45C8D}" Name="OpenSeatsInfo" DisplayName="Open Seats Info" Required="FALSE"/>
    </FieldRefs>
    </ContentType>
    </Elements>
    Schema:-
    <?xml version="1.0" encoding="utf-8"?>
    <List xmlns:ows="Microsoft SharePoint" Title="SessionList" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/SessionList-LD-SessionList" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/">
    <MetaData>
    <ContentTypes>
    <ContentType ID="0x0100a9dc01b7e78b45799fe59153d97e2b9e" Name="SessionList" Group="Session Content Types" Description="Session Content Type" Inherits="TRUE" Version="0">
    <FieldRefs>
    <FieldRef ID="{7113CBE5-57E9-4082-A0A2-492B35B69C8D}" Name="CourseTitle" DisplayName="Courses - Title" Required="TRUE" />
    <FieldRef ID="{920AE6A7-2AAE-4E43-8855-7CBD9978EC5E}" Name="Trainer" DisplayName="Trainer" Required="FALSE" />
    <FieldRef ID="{F73D9A96-3C86-4E33-96D5-31E30B08BF40}" Name="TrainingVenue" DisplayName="Training Venue" Required="FALSE" />
    <FieldRef ID="{B6E9C8F5-F1BD-4D98-BD30-194504859ACC}" Name="RegistrationsInfo" DisplayName="Registrations Info" Required="FALSE" />
    <FieldRef ID="{03281B47-F1D1-477E-9793-3A19118720EE}" Name="TotalSeatsInfo" DisplayName="Total Seats Info" Required="FALSE" />
    <FieldRef ID="{8A900663-6351-445B-ACB3-394F44D45C8D}" Name="OpenSeatsInfo" DisplayName="Open Seats Info" Required="FALSE" />
    </FieldRefs>
    </ContentType>
    </ContentTypes>
    <Fields>
    <Field ID="{7113cbe5-57e9-4082-a0a2-492b35b69c8d}" Type="Lookup" List="Lists/Courses-List" ShowField="Title" Name="CourseTitle" DisplayName="Courses - Title" Required="FALSE" Group="Training Site Columns" />
    <Field ID="{920ae6a7-2aae-4e43-8855-7cbd9978ec5e}" Type="Lookup" List="Lists/SessionTrainer" ShowField="FullName" Name="Trainer" DisplayName="Trainer" Required="FALSE" Group="Training Site Columns" />
    <Field ID="{f73d9a96-3c86-4e33-96d5-31e30b08bf40}" Type="Choice" Name="TrainingVenue" DisplayName="Training Venue" Required="FALSE" Group="Training Site Columns">
    <CHOICES>
    <CHOICE>Kerala Meeting Room</CHOICE>
    <CHOICE>Orissa Meeting Room</CHOICE>
    <CHOICE>Bihar Meeting Room</CHOICE>
    </CHOICES>
    </Field>
    <Field ID="{b6e9c8f5-f1bd-4d98-bd30-194504859acc}" Type="Number" Decimals="0" Min="0" Name="RegistrationsInfo" DisplayName="Registrations Info" Required="FALSE" Group="Training Site Columns" />
    <Field ID="{03281b47-f1d1-477e-9793-3a19118720ee}" Type="Number" Decimals="0" Min="0" Name="TotalSeatsInfo" DisplayName="Total Seats Info" Required="FALSE" Group="Training Site Columns" />
    <Field ID="{8a900663-6351-445b-acb3-394f44d45c8d}" Type="Calculated" ResultType="Number" ReadOnly="TRUE" Name="OpenSeatsInfo" DisplayName="Open Seats Info" Required="FALSE" Group="Training Site Columns">
    <Formula>=TotalSeatsInfo-RegistrationsInfo</Formula>
    <FieldRefs>
    <FieldRef Name="TotalSeatsInfo" ID="{03281B47-F1D1-477E-9793-3A19118720EE}" />
    <FieldRef Name="RegistrationsInfo" ID="{B6E9C8F5-F1BD-4D98-BD30-194504859ACC}" />
    </FieldRefs>
    </Field>
    </Fields>
    <Views>
    <View BaseViewID="0" Type="HTML" MobileView="TRUE" TabularView="FALSE">
    <Toolbar Type="Standard" />
    <XslLink Default="TRUE">main.xsl</XslLink>
    <RowLimit Paged="TRUE">30</RowLimit>
    <ViewFields>
    <FieldRef Name="LinkTitleNoMenu">
    </FieldRef>
    <FieldRef Name="CourseTitle"></FieldRef>
    <FieldRef Name="Trainer"></FieldRef>
    <FieldRef Name="TrainingVenue"></FieldRef>
    <FieldRef Name="RegistrationsInfo"></FieldRef>
    <FieldRef Name="TotalSeatsInfo"></FieldRef>
    <FieldRef Name="OpenSeatsInfo"></FieldRef>
    </ViewFields>
    <Query>
    <OrderBy>
    <FieldRef Name="Modified" Ascending="FALSE">
    </FieldRef>
    </OrderBy>
    </Query>
    <ParameterBindings>
    <ParameterBinding Name="AddNewAnnouncement" Location="Resource(wss,addnewitem)" />
    <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
    <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_ONET_HOME)" />
    </ParameterBindings>
    </View>
    <View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx">
    <Toolbar Type="Standard" />
    <XslLink Default="TRUE">main.xsl</XslLink>
    <RowLimit Paged="TRUE">30</RowLimit>
    <ViewFields>
    <FieldRef Name="Attachments">
    </FieldRef>
    <FieldRef Name="LinkTitle">
    </FieldRef>
    <FieldRef Name="CourseTitle"></FieldRef>
    <FieldRef Name="Trainer"></FieldRef>
    <FieldRef Name="TrainingVenue"></FieldRef>
    <FieldRef Name="RegistrationsInfo"></FieldRef>
    <FieldRef Name="TotalSeatsInfo"></FieldRef>
    <FieldRef Name="OpenSeatsInfo"></FieldRef>
    </ViewFields>
    <Query>
    <OrderBy>
    <FieldRef Name="ID">
    </FieldRef>
    </OrderBy>
    </Query>
    <ParameterBindings>
    <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
    <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
    </ParameterBindings>
    </View>
    </Views>
    <Forms>
    <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
    <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
    <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
    </Forms>
    </MetaData>
    </List>
    Event Receiver file:-
    public override void FeatureActivated(SPFeatureReceiverProperties properties)
    //Reference the newly created session list and perform the following
    //1. Set the display name of the "Title" column to "SessID" and hide it from the New and Edit Forms
    //2. Make the "SessID" column not required
    //3. Set the default value of the RegistrationsInfo column to 0 and do not display it on the new form
    //4. Add the built-in "Start Date" and "End Date" columns
    //Reference the newly created session list
    SPWeb currentWeb = properties.Feature.Parent as SPWeb;
    //currentWeb.AllowUnsafeUpdates = true;
    SPList sessionList = currentWeb.Lists["SessionList"];
    //Title column update
    SPField titleField = sessionList.Fields["Title"];
    titleField.Required = false;
    titleField.ShowInNewForm = false;
    titleField.ShowInEditForm = false;
    titleField.Title = "SessID";
    titleField.Update();
    //RegistrationsInfo column updates
    SPField registrationField = sessionList.Fields["RegistrationsInfo"];
    registrationField.DefaultValue = "0";
    registrationField.ShowInNewForm = false;
    registrationField.Update();
    //Add the Start Date and End Date columns to the list, ensure they both display Date and Time, and add them to the default view of the list
    SPFieldDateTime startDate = currentWeb.Fields["Starting_Date"] as SPFieldDateTime;
    startDate.DisplayFormat = SPDateTimeFieldFormatType.DateTime;
    SPFieldDateTime endDate = currentWeb.Fields["Ending_Date"] as SPFieldDateTime;
    endDate.DisplayFormat = SPDateTimeFieldFormatType.DateTime;
    sessionList.Fields.Add(startDate);
    sessionList.Fields.Add(endDate);
    SPView defaultView = sessionList.DefaultView;
    defaultView.ViewFields.Add(startDate);
    defaultView.ViewFields.Add(endDate);
    defaultView.Update();
    sessionList.Update();
    //currentWeb.AllowUnsafeUpdates = false;
    Can somebody help me - how to overcome the RegistrationsInfo missing field - error(in the stack trace) when activating the feature in the training site?
    Thanks
    Sathya

    Hi Sathya,
    Seems the field “RegistrationsInfo” is not been found when deploying with Event Receiver, a possible reason is that it might be damaged.
    As a workaround, I suggest you retract the solution from your farm, make sure the “RegistrationsInfo” field is deleted using PowerShell, then create another project with the same
    content and perform the deployment again.
    About how to delete a field using PowerShell for your reference:
    https://peterheibrink.wordpress.com/2011/12/09/powershell-delete-field-and-all-references/
    http://www.sharepointfix.com/2011/04/powershell-script-to-delete-site.html
    Feel free to reply if there any progress.
    Thanks
    Patrick Liang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Thumbnail images, bigger images and some text PROBLEM

    Unclear title, with an unclear problem.
    What I'm wanting to do is, when I click on a thumbnail image, I want the content in the DIV on the right to change accordingly to display the image and information relating to the thumbnail you have just clicked. I'm using Dreamweaver CS5 on MAC:
    - I have a page split into 2 vertical columns. On the left I have 6 thumbnail images in their individual DIVs, wrapped all together in another DIV container
    - on the right of the page I have assigned a large DIV to display a big image with a description underneath of what the project was etc...
    I know you can attach a behaviour to the thumbnail to change the big image on the right, but I have a short paragraph of text below the big image too, and I don't particularly want to make the image and text one huge image. I want to keep the text, text.
    How do I do it? Is this a simple thing? or is there a lot of coding to do this with JQuery or Javascript or something? Is there something to do with Data record sets involved?
    Is there a way of doing it that when you click on the thumbnail that it can load the relevant image and text into the DIV on the right?
    Sorry if it's not clearly explained, not sure how to do it, therefore not sure if I'm describing it properly.
    As always, all help and advice very welcome.

    Hi Murray,
    Here is a screenshot of the page in question.
    - On the left are the thumbBox DIVS, (shown here, "thumbBox1")
    - On the right there is a main container, "galleryDisplay"
    - Within "galleryDisplay" there is a DIV for the large image, "galleryDisplayImage", and another DIV to display a paragraph of information on the project, "galleryDisplayInfo".
    Just to repeat, I want that when you click on the "thumbBox1", that the content of "galleryDisplayImage" and "galleryDisplayInfo" change in accordance to the thumbnail clicked.
    Murray *ACP* wrote:
    The easy way to do this is to have each click on the thumbnail change the display Property of a container (containing both the image and the caption) from "none" to "block".  In the column on the right, just line up a series of divs, each containing the desired image+caption, and use DW's Chage Property behavior on a null link surrounding the thumbnail.  For example, a thumbnail image:
    <a href="#" onClick="MM_changeProp('image-caption1','','display','block','DIV'); return false"><img src="path_to_thumb.jpg" width="165" height="50"></a>
    Each click on a thumb would also have to change the display Property of all other image-caption containers to "none".
    I don't understand what I have to do with the relevant large image and text. You say to "line up a series of divs"... I don't understand. Where do I "store" the image and text combinations for each project? I can understand how an image can be loaded into the image div, but how and from where do I load in the html text with css applied into the info div?
    Can I change the content of 2 separate divs from one click?
    Sorry for not being overly clear, but I can't get my head round this.
    Thanks for your help. I'm sure I'll get there in the end with your expertise.

  • Resized images and video seam blurred in motion 4...

    Hello,
    I don't know if my problem is a bug or a stupid mistake I did, or something basic I haven't understood about motion, but here it is:
    I had to edit today a project I created in september 2009 with motion 3. (I installed 2 weeks ago motion 4). The project is made of images and text. When I opened the old project the images looked ok but seamed blurred although the render settings are at best quality.
    I then made an experiment and created a new project in Motion 4 and imported one image, and when I put the quality at best, again this image look unfocused. I would probably not have noticed the problem and thought that the problem comes from the image or from the capabilities of motion, if I didn't have that old video done in motion 3 with the exact same images in the exact same size in perfect crisp quality...
    I did a research in forums, but haven't found any one with a similar problem. People usually have pixelated images because they didn't put the best render quality...
    I then tried to test this on a different computer with motion 4: same problem. I tried all the settings I could find in Motion, but still no result. I trash the preferences, I repaired the permission of my mac, I reinstalled motion 4, tried several images format and size but still no result.
    I noticed that the problem occurs when I resize an image or when I resize a video. At 100% I get perfect quality, but when I resize them, they look blurred. Anything that requires a render seam to be a little blurred when the render quality is set to best. It seams like the anti-aliasing is working so well that it blurs everything... If I put the quality at normal settings, the elements that have been resized look sharp but pixelated...
    I haven't tried to test all this again in motion 3 because I don't have access to any computer that still have that version installed. And I haven't phoned applecare yet because they are closed right now in my country, but I will phone them tomorrow morning and let you know if I get any result with them.
    I really hope I simply forgot something obvious, or maybe there is a new or old setting in motion 4 that I don't know about or haven't understood properly...
    please help me
    Louie
    ps: My version of Motion is French, so I might not use the right english words used in the english version of Motion.

    Thanks for responding.
    I'm of course sizing my picture down. The project I was working on yesterday that helped me notice the problem is 300x300 pixels and the images are around 500x1000 pixels, scaled down to around 20%.
    I haven't notice today that the problem occurs in other project as well. Before I was not looking in detail at the quality, and if no one tells you about it, you won't notice it. But right now all my old projects done in Motion 3, once opened in Motion 4 seam to have that blurry effect on any image or video that is scaled down.
    I understand that Motion might maybe not be very good at scale down things, and might do it less perfetly then Photoshop. But what is odd is that all my old video exported when I had Motion 3 have sharp perfect scaled down images comparred to what I get today in Motion 4.
    The blur I'm speaking about is very light. You won't notice it easily unless you have an old version of the same video to compare it with. But in the project I was working yesterday at 300x300 pixel, the difference was really very obvious, because at this size every detail counts.
    My idea to solve my problem temporarly was to change my Motion project settings to triple its original size (from 300x300 to 900x900) and blow up everthing 300%, export the video at 900x900 and then scale it down through Quicktime instead of Motion at 300x300. This worked and my images are as sharp as they should be. This project is short and light, so I didn't mind doing this conversion, but when I will work with projects that need more render time, it's not a productiv way to work!
    I noticed another odd thing about the problem, I hope I will explain this clearly by describing 3 situations:
    1. I create in Motion 4 a new project with any preset.
    2. I import an image or a video
    3. I scale it down, by pulling one corner (=> the image or video becomes blurred)
    4. In the properties inspector I type the word "100" to get it back to 100%
    => the image is still blurred, it is difficult to see, but when I import again the same image and put it next to it you can see a difference althought both image are at 100%!!!
    or
    1. I create in Motion 4 a new project with any preset.
    2. I import an image or a video
    3. I scale it down, by pulling one corner (=> the image or video becomes blurred)
    4. In the properties inspector I click on the arrow in the top right corner of that reverts to the original settings the image or video
    => the image is perfect
    or
    1. I create in Motion 4 a new project with any preset.
    2. I import an image or a video
    3. I scale it down, by typing any number in the properties inspector (=> the image or video becomes blurred)
    4. In the properties inspector I type the word "100" to get it back to 100%
    => the image is perfect
    So it seams that my problem occurs even at 100% but only if the image has first been modified in its size by pulling one corner and than put back to 100% through the properties inspector...
    hmmmm
    very odd.
    Louie
    Message was edited by: Louie13

  • After syncing Firefox with my Android phone, Google calendar is not functional. It hangs on "Loading" and will not allow updates or edits. Calendar works in IE, just not Firefox on any computer. Clearing cookies and cache no help.

    I synced Firefox with my Droid Razr Maxx Firefox. Now Google Calendar hangs on "Loading" and will not function. Clearing cache and cookies does not help. Works the same on any computer Firefox. But Gmail works fine and Calendar is okay under other browsers.

    Do a malware check with some malware scanning programs on the Windows computer.<br />
    You need to scan with all programs because each program detects different malware.<br />
    Make sure that you update each program to get the latest version of their databases before doing a scan.<br /><br />
    *http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    *http://www.superantispyware.com/ - SuperAntispyware
    *http://www.microsoft.com/security/scanner/en-us/default.aspx - Microsoft Safety Scanner
    *http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    *http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    *http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    See also:
    *"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked

  • Background images and color

    What instance would background image and background colors
    not show in a browser? (All other images are fine)

    Cosmic rays.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "Murray *ACE*" <[email protected]> wrote
    in message
    news:gbu845$7gd$[email protected]..
    >A color specification without the required octothorpe
    >
    > --
    > Murray --- ICQ 71997575
    > Adobe Community Expert
    > (If you *MUST* email me, don't LAUGH when you do so!)
    > ==================
    >
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    >
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    > ==================
    >
    >
    > "TC2112" <[email protected]> wrote in message
    > news:gbu7sb$782$[email protected]..
    >> Hello,
    >>
    >> Some examples would be incorrect CSS, an incorrect
    link to a CSS
    >> stylesheet, another element with a background color
    "on top" of the
    >> background blocking it, an incorrect path to the
    image....
    >>
    >> The answer is in the code.
    >> Do you have a link you could post?
    >>
    >> Take care,
    >> Tim
    >>
    >> "TaraLeigh" <[email protected]>
    wrote in message
    >> news:gbu7bj$6hs$[email protected]..
    >>> What instance would background image and
    background colors not show in a
    >>> browser? (All other images are fine)
    >>
    >>
    >

Maybe you are looking for

  • Mac Shuts Down Unexpectedly in Logic Pro

    I sure hope someone can help me with this. For the last few months my Mac Pro starting shutting down unexpectedly typically when running Logic but not limited to Logic. I have updated everything that I can find. I have taken the computer in the store

  • Paper Jam error message due to broken gear on Officejet Pro 8500 all-in-one printer

    3 year old HP Officejet Pro 8500 all-in-one printer (haven't used it much). Keeps telling "Paper Jam" although there is no paper jammed anywhere (searched meticulously with a flashlight after watching HP's tutorial videos on how to clear paper jams).

  • How to populate a dropdown box based on a selection in another Dropdown box.

    I am trying to find out a way to do the following: I am using coldfusion ....working on a form. The form has couple of dropdown boxes. Based on the selection on the first dropdown box another dropdown box needs to get populated with different options

  • Monitor displaying at 150%

    Not sure where to post this, but monitors seems like the right spot. I have a Samsung LCD monitor connected to my powermac G4. I was trying to adjust the view setting on a game I was playing and it reset the whole monitor settings. Don't recall just

  • Download error 3259

    My boss has an ipad, last week he downloaded the 2 entire seasons of 24, and a season of Rescue Me with no problems at all, now he's trying to download a movie and he keeps getting this error. If those shows downloaded just fine why won't the movie d