Advice/opinions on best way to use Flash for website

Hi
I am working on an animation in After Effects (dimensions 1000px x 350px) which will sit in the masthead area of a website. I intend to render from After Effects as a flv (or as uncompressed avi and then convert to flv) and then import this into a mc and export as a swf to be placed in the masthead. However, I would be grateful for some feedback/suggestions on a couple of points...
My guess is that the final swf of flv will be about 9mb, which is quite hefty. I need the quality to be good and crisp. If you look at the excellent CS5 trailer on the adobe.com home page you will get an idea as to the quality I need. I'm guessing this is a fairly large file yet it plays great with hardly any pre-load. Any ideas how they achieve this? Using Media Server or streaming video isn't an option for me, only bog-standard progressive download.
One thing I thought was to break the animation down into a number of swfs and load these one after another. It needs to be seamless. Would that work - any ideas?
Ok,  hope this post isn't too rambling. I'm excited about the project, but I could do with some ideas as how best to get a good looking video or swf to play in the masthead without long preloads etc.
Thanks in advance.

It will probably be easier to manage if you make each section a moiveclip by itself,  That way you aren't always manipulating the main timeline to fit in or adjust for changes in each section.  You can either spread them out along the timeline, using frame comands to navigate to the different sections, or you can have them all in one frame and control navigation by controlling the visibility of each section.
If the frame you mention is to be applied to each section, then having one on the main timeline to cover all would be easier to manage in most cases.

Similar Messages

  • Is this the best way to use flash?

    Our new corporate video at [] 
    was built using flash.  Do you think the interactive piece of it works?  Interactive part starts about 1 minute in or click the "SKIP" button.
    Thanks in advance for your help and feedback!

    Flash can work quite well for presentations like this, but... I have no intention to offend with this... I didn't dare tread beyond the first step of the interactive part.
    The opening presentation has too much of a Sham-wow flavor to it--a carny sales pitch, and it makes me skeptical of what clicking anything might end up leading to.  I wouldn't create this style of presentation (the atmosphere, not the content) for a corporation, but that's just me, and I may not qualify as being young/savvy enough to know what a good corporate image is these days.

  • What is the best way to update flash for my ipad?

    J

    No Flash for iPads, iPhones, or iPods
    Here's why there's is no Flash available for iDevices or other mobile devices. Adobe was unable to provide a product that was suitable to the needs of battery powered mobile devices used for Internet browsing. Existing Flash technology used too much memory, ate battery life, and was buggy. Simply put Flash did not work well on mobile devices.
    Apple's Steve Jobs led the escape from Flash dependency when Apple introduced the iPhone, and later introduced the iPad. There was a hue and cry over the omission. Time proved Jobs was right on target.
    So this is why there is no Flash for your iPhone or iPad or iPod nor for most SmartPhones. Flash has been abandoned by many sites in favor of supported technologies such as HTML5 or by providing their own custom app.
    Here is Steve Jobs official comment on his momentous decision to omit Flash from iDevices: Steve Jobs on Flash.
    Here is Adobe's later announcement to cease development of Flash for mobile devices: Adobe on Mobile Flash. Adobe is not providing Flash for Apple iOS devices, and they no longer provide Flash for any other cellular phones. Flash is officially gone.
    Now, you are not necessarily out on a limb. There are some apps that can display some Flash, but don't count on there ability to display anything using Flash.
    A sample of Apps that can display some Flash content:
      1. Puffin
      2. SkyFire
      3. Photon Flash
      4. Browse2Go
      5. Swifter
    Also, note that many sites that use Flash provide their own app for accessing their material. So check with your favorite sites and find out if "there's an app for that."

  • Best Way to Use iPhoto for Lectures?

    The old utility "iphotowebshare" turns itself off frequently under Mavericks, so I'm forced to look for a better way to do what once worked perfectly.
    Here's my situation:
    I've got a few hundred images in an iPhoto library that I have been using for class lectures.  These images are sorted into nice, discrete albums, each of which is named for a specific day's lecture.  Everything's so well organized in iPhoto, that the thought of moving everything somewhere else makes me cranky.
    Here's what used to work:
    Running in the background (accessed via System Preferences), "iphotowebshare" makes all these albums available via web interface.  I don't have to export the images.  I don't have to remember to click the right buttons to sync different applications.  I don't have multiple versions of my images floating around in different places.
    The only thing I've had to worry about is iPhoto.  I can reorganize, retitle, re-order, annotate, and otherwise mess with my iPhoto images right up to the second that I'm supposed to be in class.  Then I can walk away from my office and expect to find my images available in my classroom, just as I've most recently assembled them in iPhoto.
    "iphotowebshare" seems simply to make my iPhoto Library—as it is, and as it changes—available to a simple web page (that "iphotowebshare" itself builds and makes available on port 8080).
    Only problem, now, as I've mentioned, is that the "iphotowebshare" System Preference keeps turning itself off.
    So, reluctantly, I have to adopt a new method, and a couple of hours with Google has not turned up an alternative that does what "iphotowebshare" has been doing so nicely for years.
    I spent thirty minutes or so messing with the iPhoto-Flickr sync, but found that iPhoto is creating new, duplicate "synced" albums beside the albums I've already created.  Syncing between iPhoto and Flickr requires deliberate button clicking (I know: First World Problems. But I'm confident that I will forget to click the sync and then will find myself in class with an obsolete arrangement of images).
    Any advice?  Simpler the better.

    I'm aware that iphotowebshare is problematic and un-updated.  That is, in fact, the problem.  Because with iphotowebshare, iPhoto works perfectly well as a presentation tool in my circumstances.
    Because my circumstances haven't changed, even if software has, what I'm trying to find is something that does what iphotowebshare does (without intermittently shutting off) or that duplicates the same functionality (which is, basically, to put my iPhoto library on the web, live, without bothering me).
    A secondary app will require deliberate second and third steps, not to mention some extra care about how these images get made available online.
    Besides iPhoto is a "presentation tool" to the extent that it's designed to "present" one's images (via slide shows [with a soundtrack, no less] and printed books, if nothing else).  So, I'm pretty sure I'm not asking for an apple to be an orange, so to speak.  Especially since iphotowebshare has demonstrated iPhoto's functionality in this respect.

  • Question: Best way to use MR for BOS - PIT flight

    Hi all, In august I'm flying to pittsburg from Boston and wanted some advice on making the most of my MR (or whether I should just save my MR for some other use). I've got ~57K MR to play with. Since The flight distance is <650 miles I was thinking avios would be the way to go if I could get a direct US airways flight. I know these exist from the US airways page, but when I search for it on the BA website nothing comes up...does this mean they can't be booked with avios? Do I have any other good options? Jetblue does the flight too, but for more around 16k points each way (and the MR:trueblue ratio is not even 1:1), and delta can do it with layovers for 10k each way. Am I missing anything? Thanks!

    njharlen wrote:
    Hi all, In august I'm flying to pittsburg from Boston and wanted some advice on making the most of my MR (or whether I should just save my MR for some other use). I've got ~57K MR to play with. Since The flight distance is <650 miles I was thinking avios would be the way to go if I could get a direct US airways flight. I know these exist from the US airways page, but when I search for it on the BA website nothing comes up...does this mean they can't be booked with avios? Do I have any other good options? Jetblue does the flight too, but for more around 16k points each way (and the MR:trueblue ratio is not even 1:1), and delta can do it with layovers for 10k each way. Am I missing anything? Thanks!One way?

  • Best way to use `checkupdates' for status line

    Hey there,
    I want to have the number of packages for which there exist updates to be indicated in the status bar of dwm. (At the moment I create my status bar via a shell script, not via a C program. Most importantly the script displays at the moment the number of new emails and the date/time.)
    This was my first attempt (other functions and custom colors stripped):
    #!/bin/bash
    pkg(){
    nbr="$(checkupdates | wc -l)"
    echo -en "$nbr"
    xsetroot -name "... $(pkg) | $(date "+%d. %b %H:%M")"
    After the script has been executed it will be launched again after a sleep of two seconds. Now I wonder if it is considered good practice to execute `checkupdates' every few seconds. I guess it is not. What could be the downsides? Problems when invoking pacman in order to update?
    The other way I thought of was to check for updates only every hour via cron and redirecting the number of package updates into a temporary file and reading that file in the status script. But this has a major downside: After updating with pacman, the number of packages to be updated doesn't change until next invocation of the cronjob...
    How would you handle such a notification?
    Edit: Sorry wrong forum. Please move the topic. :-(
    Last edited by ball (2013-08-08 17:48:55)

    #!/bin/bash
    let loops=0
    while true; do
    [[ $(($loops % 150)) -eq 0 ]] && pkg=$(checkupdates | wc -l)
    [[ $(($loops % 30)) -eq 0 ]] && email=...
    xsetroot -name "$pkg | $email"
    loops++
    sleep 2
    done
    This will run checkupdates every 150 times through the loop (every 5 minutes) and do the mail check every 30 (every minute), but print out the latest result from each every time through the loop.  Obviously, the mail part has to be filled in with whatever you use.  This is just to show how to only update at certain intervals rather than wasting processing on something that may not be that dynamic.
    EDIT: for regular use I suppose their should be a check on "loops" to avoid overflow.  At the last line of the loop, for example, add
    [[ $loops -eq 4500 ]] && let loops=0
    Last edited by Trilby (2013-08-08 18:24:58)

  • Best way to use JAXB for this problem?

    I have an input XML which is very large and complicated. It comes with it's own schema
    I only need to extract a few parts of the data contained in that XML, scattered throughout the document. I care not about most of the XML file but I do care about performance and overhead so would like to perform a Special Ops mission where I go in without anyone noticing, grab the data I need, and get out before the thing becomes a mess.
    Can I do this simply with JAXB?
    If so, what is the best approach, from a high level perspective?
    I am totally new to JAXB.

    I agree with gimbal2 because, as far as I can see, jaxb is intended for "mapping" a xml tree to a very similar structure of classes.
    When you say that your xml is complex I assume that it has many nesting levels. This means many jaxb classes (say about one-per-level) ... in order to retrieve few elements.
    An Xpath approach requires only one line of code per element.
    I usually use the library dom4j for this kind of job.
    bye

  • HT3819 I have 2 Ipod touch's, one a 64gb and one an 8gb.  Whats the best way to use them both on the same itunes account?

    I have 2 Ipod touch's, one a 64gb and one an 8gb.  Whats the best way to use them both on the same itunes account?

    Click here for options.
    (64410)

  • What's is the best way to use iPhoto? I need to understand.

    What's is the best way to use iPhoto? I need to understand.
    I guess the iPhoto is only for people with 5,000 of personal photos.
    Or even 200,000, but they can't use this app everyday.
    I'm not talk about working as a photographer. They use Aperture.
    They may use iPhoto like a family album that you take a look sometimes.
    And don't care about putting photos from the camera or from internet everyday.
    I have tons of music and I love iTunes 8, works great. So I tried but I can't stand iPhoto anymore.
    I have over 173,000 photos. My goal is organize, have total control, crop in Preview and delete them fast as I can.
    The iPhoto is too slow. And is not only about performance, more RAM... but the whole concept.
    Finder is much better/richer/flexible to organize than iPhoto.
    I'm not talking about the photographer workflow.
    And I'm not talking about editing and all these great photo features, the search, and all the iLife environment. They are amazing.
    When I'm iPhoto, I feel like a prisioner.
    I can't open an album/folder/event alone just to take a look, without do lanch the iPhoto app with the all thousand photos together. And it's slow.
    I can't use Quick Look there.
    So, I'll use Finder for manage/crop/etc. But what's the best way to use iPhoto in my case? Put the best/key ones there to use in iLife/MobileMe? To do a more serious editing? I like the features: keywords/ratings/hidden photos/events... It would be cool this features in Finder.
    For example:
    iMovie: Manage movies? NO. It's editng only.
    iTunes: Manage music/small video/podcast...? OK. Editing the song? OK for tags/convert/artwork/equalizer... For music there's a GarageBand of course.
    iPhoto: Manage photos? Yes and No.
    I think Finder would kill iPhoto incoporating all the editing features in Preview and the rich manage in Finder.
    Jobs said that no one care about iDVD anymore. They care about the web.
    Using iMovie to export to MobileMe.
    Maybe iPhoto become less important in a near future. With a better Finder+Preview Right?
    Sorry for this long text with a short question.
    Thanks.

    Your post demonstrates exactly why I keep saying that iPhoto is not the application for you.
    It would be better an iPhoto organizing photos by words like when iTunes browse his music.
    Why on earth would anyone want to organise photos by words? A list mode is entirely pointless in a Photo application. That's like having an old photo album organised with the photos facing inwards so you can read the back of the picture.
    Again, this is a characteristic of a File browser. You don't want a Photo organiser, you want a file organiser.
    And, in iPhoto, you can search by tags, effortlessly in either the search box or by using a Smart Album.
    iPhoto always loads all that events and all the thumbs library to scroll, and I think it's overkill.
    So, how is iPhoto to know which ones you want to work with today? Open a library, get the Library.
    Would be better a Cover Flow option to browsing in Events.
    You've obviously never tried scrubbing along the Event icon.
    Imagine iTunes using Cover Flow mode all the time. It won't be too useful.
    Many, many people do, including myself on a library of 20k tracks totalling more that 100 gigs, and find it very useful. Same with the Finder.
    And if when iTunes Store starts to sell photos?
    Why on earth would the iTunes store start to sell photos?
    My photos are not junk,
    I didn't say there were. Read my post again.
    When I said Finder to crop photos I mean Preview. But I feel in Finder. Because what's in Preview? A photo opened with a Preview's menubar and some cocoa APIs like adjustments. Not?
    Oh, so you don't count Preview as an application. Fine. It is an application but you don't feel it. As you wish.
    My point to you is very simple: Because of the way you want to organise your pics - using lists views and so on - iPhoto is not the application for you. Don't use it. But you keep writing things about the application that are untrue, and I'm aware that other folks search these forums and I don't want them to have inaccurate information about iPhoto.
    Regards
    TD

  • The best way to use 2 iphones with 1 Mac

    Can someone explain whats the best way to use 2 iphones on 1 Mac.
    2 different Calendars, 2 different adressbooks, etc., 1 iTunes Library, 1 Photo Library
    But it would be great to see each others Calendars
    Until now one mobileme Account.
    Thanks in advance
    Jan

    I'm hoonesstly not sure about the second mobile me account. My guess would be that you will need another one though. The only way to see her calendar is to log into her user account. Not a problem if you have her password.

  • Best way to use an external drive

    Hello all,
    I have several photos.
    I also have three computers that I regularly use: my Windows PC, my Macbook Pro, and a very new iMac.
    Rather than place all my photos on each computer... I thought I could place them on a Western Digital Passport portable ext. drive. Then somehow use the drive from computer to computer to edit/play with my photos.
    How do I best use iPhoto 08 to do that? I'm not sure... do the photos have to be on the computer in order to make albums, libraries, folders, etc? Or are those things more of thumbnails that POINT to certain files?
    Please help a newbie understand the best way to use his external drive.
    Thanks for any and all help!

    Hello, and welcome, Theodore!
    I must first say that I don't yet have iPhoto 8.
    I do, however, have a lot of experience with external drives (I have two). I have a huge amount of music in iTunes, so I keep a copy of it on each external drive. Then, when I need to access my music , I turn on either external drive, up comes the External Drive symbol on my display, then I go over to my dock, and select iTunes. I must remember to first open up the External Drive BEFORE I open iTunes (or iPhoto). I then add or subtract music (or photos), edit, and work on my collection. When I'm finished, I just close the application, then select the Hard Drive symbol, and choose File/ Exit Hard Drive. Reach over and turn off my Hard Drive, and it's all good. I just always remember to open the Hard Drive FIRST, before opening the application.
    The same would work for iPhoto. If you place iPhoto onto your external drive, you could probably use any of your computers to connect to it. I would suggest you think about backing up your external drive's contents with either another external drive (which was my choice), or other alternate storage methods.
    I only have one PowerBook, not multiple computers, but, other than that, the situation's the same. You want to keep your iPhoto collection off your computers, and onto one external drive. I hope this information can be of some help to you.
    All best wishes... Cea

  • Does Adobe Reader for iOS have the ability to open inbedded links to additional PDF docs?  If not, then what would be the best way to use these already created PDF's?

    Does Adobe Reader for iOS have the ability to open inbedded links created with Acrobat Standard to additional PDF docs?  If not, then what would be the best way to use these already created PDF's on an I Pad?

    driddy61,
    As of June 2014, none of the Adobe Reader mobile products support the hyperlink action for opening a separate PDF document.
    Adobe Reader for iOS
    Adobe Reader for Android
    Adobe Reader Touch for Windows 8
    In addition, the Reader mobile products do not open multiple windows/documents simultaneously, which would make the navigation between PDF documents nearly impossible. (Once a hyperlink takes you to a different PDF document, you have no way to go back to the original PDF document.)
    The only Adobe Reader product that fulfills your department's requirements is Adobe Reader XI (mostly for Windows/Mac desktop/laptop computers).  Acrobat Pro and Standard are paid products.
    Because you are in search of a less expensive device for your department, you could get a Windows tablet instead of a Windows desktop/laptop computer. Microsoft Surface Pro (that you've mentioned in your previous reply) is just one example.  You can also find other less expensive Windows tablets.
    Tablets
    However, please keep in mind that there are two different types of Windows tablets running two different operating systems.
    (a) A Windows tablet with an Intel-based processor running Windows 8.1 Pro
    Example: Surface Pro 3
    You can install and run traditional desktop apps (e.g. Adobe Reader XI) and new Windows Store apps ("Modern" or "Metro-style" apps).
    (b) A Windows tablet with an ARM-based processor running Windows RT 8.1
    Example: Surface 2
    You can only install and run Windows Store apps (e.g. Adobe Reader Touch) but not traditional desktop apps like Adobe Reader XI.
    In general, type (b) tablets are more affordable than type (a) tablets.  However, if you want to run Adobe Reader XI, you do need to check the technical specification of each tablet and make sure the following conditions are met.
    Processor: Intel
    Operating system:  Windows 8/8.1 or Windows 8/8.1 Pro, not RT
    Hope this helps you choose the right device for your department.  Please let us know if you have any questions about system requirements or supported features in the Adobe Reader products.

  • What is the best way to use a cellular enabled iPad in France?

    What is the best way to use a cellular enabled iPad in France?

    Frankly, I expect a bit more courtesy and details from someone wanting help from fellow users.
    Don't use your AT&T SIM/plan out of the country for the iPad.
    Just purchase a SIM in France for about 15 euros and use that.
    -> http://www.tripadvisor.com/ShowTopic-g187070-i12-k4781004-o30-Prepaid_French_3G_ micro_SIM_for_iPad_it_s_not_a_problem-France.html

  • What's the best way to use your iPad instead of textbooks?

    What's the best way to use your iPad instead of textbooks? I'm about to start a BSN program and have heard of using your iPad for textbooks instead of buying and carrying around 8 different books. Is there an app for that? Or do you buy or rent the books? What's the best solution?

    Or, if you're like me and you want to do a lot of heavy reading, use the iPad because the low contrast on a Kindle is extremely fatiguing.  
    Seriously, though "screen glare will cause eye strain" is often taken as an article of faith, there's not a lot of good scientific evidence for it. "Eye strain" can be caused by concentrating on any close work for long periods of time. Looking up and focusing on something distant periodically is very helpful. Older CRT screens that flicker also can be aggravting. I'm not denying that some people find reading backlit screens uncomfortable. However, it's not dangerous. And, then, there are other people who find the higher contrast a backlit screen affords to be much less wearying over long periods of time.

  • Repost-Best way of using connection pooling

    I am reposting this, seems best suitable in this category.
    I am using Eclipse 3.1 along with Tomcat 5.0, MySQL 4.1, J2EE1.4. I could set up the JNDI Dataresource connection pooling and tested with small test servlet. Now thinking of having common methods for getting connection / closing / commiting ....etc.
    I wrote following. [Please let me know whether it is correct way of doing it - as i am not very sure]
    package common;
    import java.sql.*;
    import javax.sql.*;
    import javax.naming.*;
    import org.apache.log4j.Logger;
    public final class connectionManager {
         private static Logger logger = Logger.getLogger(common.connectionManager.class);
         public connectionManager() {}
         public static Connection getConn () throws NamingException, SQLException
    //JNDI DataSource connection pooling
              Connection conn = null;
              try{
                   Context initContext = new InitialContext();
                   Context envContext  = (Context)initContext.lookup("java:/comp/env");
                   DataSource ds = (DataSource)envContext.lookup("jdbc/TQ3DB");
                   conn = ds.getConnection();
              }catch (NamingException ne) {
                  new GlobalExceptionHandler(logger, ne);
                   conn = null;
                   throw new NamingException();
              }catch (SQLException e){
                   new GlobalExceptionHandler(logger, e);
                   conn = null;
                   throw new SQLException();
              return conn;
           }//getConnection
         public static void commit(Connection conn) throws SQLException
              conn.commit();
         public static void rollback(Connection conn) throws SQLException
              conn.rollback();
           public static void setAutoCommit(Connection conn, boolean autoCommit)
                                        throws SQLException
                conn.setAutoCommit(autoCommit );
         public static void closeConnection(Connection conn) throws SQLException{
              if (conn != null) {
                   conn.close();
                   conn = null;
         }//closeConnection
         public static void closeResources(ResultSet oRS, PreparedStatement pstmt) throws SQLException
              if (oRS != null) {
                   oRS.close();
                   oRS = null;
              if (pstmt != null) {
                        pstmt.close();
                        pstmt = null;
         } // closeResources
    }//ConnectionManager
    I am having a login form which submits user name and password. I am checking this against the database. Following is the servlet to do that.
    package login;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import common.*;
    public class loginServlet extends HttpServlet {
         public void doGet(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {          
              doPost(request, response);
         }//doGet
         public void doPost(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException,IOException{
              String userId = request.getParameter("userId");
              String password = request.getParameter("password");
              ** call a method to validate the password which will return the
              ** User Name for authorized users and null string for un-authorised.
              String uName = validateUser(userId, password);
              //if uName is null .. user is not authorized.
              if (uName == null){
                   //redirect to jsp page with error message
                  RequestDispatcher rd =
                       getServletContext().getRequestDispatcher("/jsps/mainmenu.jsp");
                  if (rd != null){
                       rd.forward(request,response);
              else{
                   // the user is valid - create a seesion for this user.
                   HttpSession userSession = request.getSession(true);
                   // put the user name session variable.
                   userSession.setAttribute("userName", uName);
                   //redirect to Main menu page
                   RequestDispatcher rd =
                        getServletContext().getRequestDispatcher("/jsps/mainmenu.jsp");
                   if (rd != null){
                        rd.forward(request,response);
         }// end of doPost
         private String validateUser(String userId, String password)
                   throws SQLException{
              String returnVal = null;
              connectionManager cm = new connectionManager();
              Connection conn = null;
              PreparedStatement pstmt = null;
              ResultSet oRS = null;
              try{
                   //get the connection
                   conn = cm.getConn ();
                   //get records from user table for this user id and password
                   String sQry = "SELECT  user_login FROM user "
                             + "where user_login = ? AND user_pwd = ? ";
                   pstmt = conn.prepareStatement(sQry);
                   pstmt.setString(1, userId);
                   pstmt.setString(2, password);
                   oRS = pstmt.executeQuery();
                   //check for record
                   if (oRS.next()) {
                        returnVal = oRS.getString("user_login");
                   }else {returnVal = null;}
                 }catch (Exception e){            
                      returnVal = null;
              }finally{
                   cm.closeResources(oRS, pstmt);
                   cm.closeConnection(conn);
              return returnVal;
    }// end of servlet class
    But i am unable to compile it and i am also getting lots of warnings.
    I am getting error at line
    1)String uName = validateUser(userId, password);
    Unhandled exception type SQLException loginServlet.java TQ3/WEB-INF/src/login line
    Following warnings:
    2)For loginServlet Declaration
    The serializable class DBTest does not declare a static final serialVersionUID field of type long loginServlet.java
    3)The static method getConn() from the type connectionManager should be accessed in a static way
    4)The static method closeResources(ResultSet, PreparedStatement) from the type connectionManager should be accessed in a static way
    5)The static method closeConnection(Connection) from the type connectionManager should be accessed in a static way
    Definitely I am doing it wrong but exactly where? I am having very strong doubt the way i am using connections is not the correct way. Pls help me.
    regards
    Manisha

    I am in a search of best way to use connection pooling. Initially was using simple JDBC call, then modified to JNDI, afterwards tried to have common class. Later came accross the idea of Singleton/Static. I wanted to have a common class which will handle all connection related issues and at the same time give good performance.
    With due respect to all Java Gurus: i got all from web articles/tutorials/java forum etc. There is a long discussion regarding Singlet vs static in this forum. But finally got confused and could not figure out in my case which method shall i make use of, so tried both.
    What I want is somebody pointing out flwas inside my 2 code snippets and guide me about which method shall i adopt in future.
    Static way:
    package common;
    import java.sql.Connection;
    import javax.sql.DataSource;
    import java.sql.SQLException;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    public final class ConnectionManager_Static {
         private static InitialContext ctx = null;
         private static DataSource ds = null;
         public ConnectionManager_Static(){     }
         //as the staic method is updating static var i am synchonizing it
         private static synchronized void getDatasource () throws NamingException, SQLException
              if (ds == null){
                   ctx = new InitialContext();
                   ds = (DataSource)ctx.lookup("java:comp/env/jdbc/MySql");
         //making getConnection() also static as it is not instance specific     
         public static Connection getConnection () throws NamingException, SQLException, Exception
              Connection conn = null;
              try{     
                   if (ds == null) {getDatasource ();}
                   if (ds != null) {
                        conn = ds.getConnection();                 
              }catch (Exception e){
                   throw new Exception("From ConnectionManager_Static",e);
              return conn;
           }//getConnection
    }Singleton:
    package common;
    import java.sql.*;
    import javax.sql.*;
    import javax.naming.*;
    public final class ConnectionManager_Singleton {
             private static ConnectionManager_Singleton INSTANCE = null;
              private DataSource datasource = null;
              // Private constructor for singleton pattern
             private ConnectionManager_Singleton() throws NamingException{
                   Context ctx = new InitialContext();
                   datasource = (DataSource)ctx.lookup("java:comp/env/jdbc/MySql");
             //synchronized creator for  multi-threading issues
             //another if check to avoid multiple instantiation
             private synchronized static void createInstance() throws NamingException{
                 if (INSTANCE == null) {
                     INSTANCE = new ConnectionManager_Singleton();
             public static ConnectionManager_Singleton getInstance() throws NamingException {
                 if (INSTANCE == null) createInstance();
                 return INSTANCE;
              public Connection getConnection() throws Exception
                   Connection con = null;
                   try{
                        con = datasource.getConnection();
                   }catch(Exception e){
                        throw new Exception("From connection manager singleton ", e);
                   return con;
    }Sorry, It's becoming long.
    Thanaks in advance,
    Manisha

Maybe you are looking for