Must be a better way...

Hello Flash Community!
Thanks in advance for any help/advice.
So, what I'm looking for here is some high level advice as far as a better way to do things. I feel like so often with programming I'm just breaking my neck to get things working when I know there is a better way (presumably based in OOP) to go about things. I just need someone to look at what I've done and point it out to me.
So, here's what I've done so far: http://www.catherinemix.com
And it works pretty well as far as I'm concerned! The app dynamically loads as many images as my client (my mom ) puts on the server, resizes them dynamically, adds L/R arrow buttons dynamically based on how many images are involved, etc... But the downside to all that dynamic flexibility is that I haven't found a way to load the thumbnail images (and their respective full size images) one by one. Instead, I have to load them all together and keeping the user waiting that long is unacceptable to my mom. What I would love is for each thumbnail/full size combo to get its own preloader bar in the location it will eventually be embedded, but I haven't found a way to do that and account for an unknown number of images (as it is determined dynamically.)
Any ideas here? I would specifically like to know which functions y'all use when you need to load multiple files simultaenously (AttachMovie?)
I have posted the kluge-y code which handles all of the image gallery functions below.
Thanks! and Be Well
Graham
import fl.transitions.Tween;
import fl.transitions.easing.*;
var wait:PleaseWait = new PleaseWait();
wait.x = 400;
wait.y = 50;
addChild(wait);
var waitFadeIn:Tween = new Tween(wait, "alpha", Regular.easeOut, 0, 1, 1, true);
var titleText:TextField;
var textSprite:Sprite;
//thumbH is the ideal height for our thumbnails, and thumbW the ideal width
var thumbH = 120;
var thumbW = 170;
//loadH is the ideal height for our fullsize images, and loadW the ideal width
var loadH = 500;
var loadW = 600;
//some counter numbers
var thumbNum = 1;
var loadNum = 1;
//some Sprites which need to be accessed by more than one function
var darkStage:Sprite;
var loadSprite:Sprite;
//Let's instantiate some Arrays that we can load the images into.
//Since Arrays of Loaders can't be copied, we have to go through the process twice.
var thumbArray:Array = new Array();
var loadArray:Array = new Array();
firstLoad();
firstThumb();
function firstLoad():void {
    trace("firstLoad");
    var loadski = new Loader();
    loadski.load(new URLRequest("images/fulls/0.png"));
    loadski.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
    loadArray.push(loadski);
//Starting with the above Loader, this function will execute every time the Loader completes
function loadComplete(e:Event):void {
    trace("loadComplete");
    var loadski = new Loader();
    loadski.load(new URLRequest("images/fulls/" + loadNum + ".png"));
    loadArray.push(loadski);
    loadski.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
    loadski.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
    loadNum++;
//Once the Loader goes too far by attempting to load an image that doesn't exist on the computer,
//it will thorw an IOError Event at which point the following function will execute.
function loadError(e:IOErrorEvent):void {
    trace("loadError");
    loadArray.pop();
    loadNum = 0;
    loadResize();
    //We use the pop function to remove the most recently added Loader instance, since we know it
    //contains a null reference (beacuse the IOError Event is asynchronous.)
    thumbArray.pop();
    //We reset the counter variable.
    thumbNum = 0;
    //Add the little arrows that allow the user to click to see more thumbnails (if there are more
    //than 8 images on the server.)
    removeChild(wait);
    addArrows();
    //Let's resize the images to thumbnail size and add them to the display list.
    thumbResize();
    addClickOnThumb();
function loadResize():void {
    trace("loadResize");
    for (var ex = 0; ex < loadArray.length; ex++) {
        //If the width of the image is greater than the ideal width, OR the height is greater than the ideal height...
        if ( loadArray[loadNum].content.width > loadW || loadArray[loadNum].content.height > loadH) {
            //And if the width of the image is greater than the height, apply Scaler 1...
            if ( loadArray[loadNum].content.width > loadArray[loadNum].content.height ) {
                //Scaler 1 is the ratio of the ideal width to the image width
                var scaler1 = loadW / loadArray[loadNum].content.width;
                trace(loadNum + " load scaler 1: " + scaler1);
                //Apply Scaler 1 to both the width and height of the image
                loadArray[loadNum].content.scaleX = loadArray[loadNum].content.scaleY = scaler1;
                //Otherwise, apply Scaler 2
            } else {
                //Scaler 2 is the ratio of the ideal width to the image height
                var scaler2 = loadH / loadArray[loadNum].content.height;
                trace(loadNum + " load scaler 2: " + scaler2);
                //Apply Scaler 2 to both the width and height of the image
                loadArray[loadNum].content.scaleX = loadArray[loadNum].content.scaleY = scaler2;
                trace("loadArray[loadNum].content.height = " + loadArray[loadNum].content.height);
                trace("loadArray[loadNum].content.width = " + loadArray[loadNum].content.width);
            //Otherwise... (that is, the image width and height are in both cases less than the ideal)
        } else {
            //And if the width of the image is greater than the heigh, apply Scaler 3
            if ( loadArray[loadNum].content.width > loadArray[loadNum].content.height ) {
                //Scaler 3 is the ratio of the ideal width to the image width
                var scaler3 = loadW / loadArray[loadNum].content.width;
                trace(loadNum + " load scaler 3: " + scaler3);
                //Apply Scaler 3 to both the width and height of the image
                loadArray[loadNum].content.scaleX = loadArray[loadNum].content.scaleY = scaler3;
            } else {
                //Scaler 4 is the ratio of the ideal width to the image height
                var scaler4 = loadH / loadArray[loadNum].content.height;
                trace(loadNum + " load scaler 4: " + scaler4);
                //Apply Scaler 4 to both the width and height of the image
                loadArray[loadNum].content.scaleX = loadArray[loadNum].content.scaleY = scaler4;
        loadArray[loadNum].content.x = - (loadArray[loadNum].content.width / 2);
        loadArray[loadNum].content.y = - (loadArray[loadNum].content.height / 2);
        loadNum++;
function firstThumb():void {
    trace("firstThumb");
    //Let's populate the first Array with Loaders that load the images Mom has put on the server.
    //We have to do this first Loader object by hand to get the Event.COMPLETE-based-loop going.
    var thumbski = new Loader();
    thumbski.load(new URLRequest("images/thumbs/0.png"));
    thumbski.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbComplete);
    //We add the MouseEvent.CLICK listener to the actual Loader instance so that, later on, in the
    //function enLarge, we can make use of the currentTarget parameter to correlate the Array index of
    //the thumbnail that the user is clicking on with that of the loadArray.
    thumbski.addEventListener(MouseEvent.CLICK, enLarge);
    thumbArray.push(thumbski);
//Starting with the above Loader, this function will execute every time the Loader completes
function thumbComplete(event:Event):void {
    trace("thumbComplete");
    var thumbski = new Loader();
    thumbski.load(new URLRequest("images/thumbs/" + thumbNum + ".png"));
    thumbski.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbComplete);
    //We add the IOErrorEvent listener so that as soon as this error is thrown, we will exit this loop
    //and proceed to the next logical step in the program can be taken.
    thumbski.addEventListener(MouseEvent.CLICK, enLarge);
    thumbArray.push(thumbski);
    thumbNum++;
function addArrows():void {
    //Let's determine how many batches there are. A batch is the minimum amount of thumbnail images
    //mom wants to show up onscreen at a time. In this case, she has decided on 8.
    var batches =  Math.ceil(thumbArray.length / 8);
    //The variable m is part of a kluge fix related to the calculation of startX (explained below.)
    var m = 0;
    //Pseudocode for this loop: If there are at least two batches, then...
    //We do this because less than 2 batches doesn't warrant arrows
    if (batches > 1) {
        for (var k = 1; k < batches; k++) {
            //triW is the desired width of our arrows
            var triW = 20;
            //startX is the x position of the start of our rightward facing triangle(s)
            //The formula says: Our x starting position should be a triangle width shy of the
            //far edge of the stage (multiplying it by k ensures it happens as many times
            //as there are batches, which is why we intialize k = 1.) Every subsequent iteration
            //of the formula has to add a triangle's width worth of distance, except for the
            //very first one, which is why it is multiplied by m, which is initially set to 0.
            var startX = (((stage.stageWidth - triW) * k) + (triW * m));
            //We want the arrows to sit perfectly between the two rows of thumbnails. Since the
            //max height of every thumbnail is thumbW, that would seem to be the natural choice
            //for the starting y position of the arrows. But, we actually have to use thumbW/2
            //because the thumbnails have already been offset by half of thumbW due to being
            //aligned vertically with each other.
            var startY = (thumbW / 2);
            //This is the rightward facing triangle
            var tri:Sprite = new Sprite();
            tri.graphics.beginFill(0xFFFFFF);
            tri.graphics.moveTo(startX, startY);
            tri.graphics.lineTo(startX, (startY + triW));
            tri.graphics.lineTo((startX + triW), (startY + (triW/2)));
            tri.graphics.lineTo(startX, startY);
            tri.graphics.endFill();
            tri.buttonMode = true;
            tri.useHandCursor = true;
            tri.addEventListener(MouseEvent.CLICK, moveLeft);
            addChild(tri);
            //This is the leftward facing triangle
            var tri2:Sprite = new Sprite();
            var startX2 = (startX + (triW * 2));
            tri2.graphics.beginFill(0xFFFFFF);
            tri2.graphics.moveTo(startX2, startY);
            tri2.graphics.lineTo(startX2, (startY + triW));
            tri2.graphics.lineTo((startX2 - triW), (startY + (triW / 2)));
            tri2.graphics.lineTo(startX2, startY);
            tri2.graphics.endFill();
            tri2.buttonMode = true;
            tri2.useHandCursor = true;
            tri2.addEventListener(MouseEvent.CLICK, moveRight);
            addChild(tri2);
            //Increase m (see above)
            m++;
//This function moves the entire Gallery MovieClip to the left 800 pixels.
function moveLeft(event:MouseEvent):void {
    var leftTween:Tween = new Tween(this, "x", Regular.easeOut, this.x, (this.x - 800), .5, true);
//This function moves the entire Gallery MovieClip to the right 800 pixels.
function moveRight(event:MouseEvent):void {
    var rightTween:Tween = new Tween(this, "x", Regular.easeOut, this.x, (this.x + 800), .5, true);
//This function resizes the loaded images to the desired thumbnail dimensions and adds them
//to the display list.
function thumbResize():void {
    //The highest level of organization of thumbnails is the batch. There are only as many batches
    //as the length of the thumbArray divided by 8 (the max amount of thumbnails in a batch, as determined
    //by mom.)
    for (var batch = 0; batch < Math.ceil(thumbArray.length / 8); batch++) {
        trace("batch " + batch);
        //This Sprite serves as the container that we use to position entire batches
        var batchSprite: Sprite = new Sprite();
        //The logic behind setting the x position of the batchSprite to 800 x batch should be self-evident --
        //we want each new batch to be 800 pixels to the right of the former one -- but the addition of (thumbW
        //divided by 1.5) is a kluge fix for how much space to give the batches on left margin.
        batchSprite.x = (thumbW / 1.5) + (batch * 800);
        addChild(batchSprite);
        //The second highest level of organization for our thumbnails is the row. Our grid of thumbnails is
        //two rows deep.
        for (var row = 0; row < 2; row++) {
            trace("     row " + row);
            //The third highest level of organization for our thumbnails is the column. Our grid of thumbnails is
            //four columns deep.
            for (var col = 0; col < 4; col++) {
                trace("          col " + col);
                trace("               thumb " + thumbNum);
                if (thumbNum < thumbArray.length) {
                    //The following is the logic structure for handling the resizing of images. The goal was to develop
                    //a system robust enough to allow my mom to put whatever size images she wanted on the server and the
                    //app would use them. The logic is explained at each step...
                    //If the width of the image is greater than the ideal width, OR the height is greater than the ideal height...
                    if ( thumbArray[thumbNum].content.width > thumbW || thumbArray[thumbNum].content.height > thumbH) {
                        //And if the width of the image is greater than the height, apply Scaler 1...
                        if ( thumbArray[thumbNum].content.width > thumbArray[thumbNum].content.height ) {
                            //Scaler 1 is the ratio of the ideal width to the image width
                            var scaler1 = thumbW / thumbArray[thumbNum].content.width;
                            trace("               scaler1 = " + scaler1);
                            //Apply Scaler 1 to both the width and height of the image
                            thumbArray[thumbNum].content.scaleX = thumbArray[thumbNum].content.scaleY = scaler1;
                            trace("               image width:" + thumbArray[thumbNum].content.width);
                            trace("               image height:" + thumbArray[thumbNum].content.height);
                            //Otherwise, apply Scaler 2
                        } else {
                            //Scaler 2 is the ratio of the ideal width to the image height
                            var scaler2 = thumbW / thumbArray[thumbNum].content.height;
                            trace("               scaler2 = " + scaler2);
                            //Apply Scaler 2 to both the width and height of the image
                            thumbArray[thumbNum].content.scaleX = thumbArray[thumbNum].content.scaleY = scaler2;
                            trace("               image width:" + thumbArray[thumbNum].content.width);
                            trace("               image height:" + thumbArray[thumbNum].content.height);
                        //Otherwise... (that is, the image width and height are in both cases less than the ideal)
                    } else {
                        //And if the width of the image is greater than the heigh, apply Scaler 3
                        if ( thumbArray[thumbNum].content.width > thumbArray[thumbNum].content.height ) {
                            //Scaler 3 is the ratio of the ideal width to the image width
                            var scaler3 = thumbW / thumbArray[thumbNum].content.width;
                            trace("               scaler3 = " + scaler3);
                            //Apply Scaler 3 to both the width and height of the image
                            thumbArray[thumbNum].content.scaleX = thumbArray[thumbNum].content.scaleY = scaler3;
                            trace("               image width:" + thumbArray[thumbNum].content.width);
                            trace("               image height:" + thumbArray[thumbNum].content.height);
                        } else {
                            //Scaler 4 is the ratio of the ideal width to the image height
                            var scaler4 = thumbW / thumbArray[thumbNum].content.height;
                            trace("               scaler4 = " + scaler4);
                            //Apply Scaler 4 to both the width and height of the image
                            thumbArray[thumbNum].content.scaleX = thumbArray[thumbNum].content.scaleY = scaler4;
                            trace("               image width:" + thumbArray[thumbNum].content.width);
                            trace("               image height:" + thumbArray[thumbNum].content.height);
                    //Here is where we center the images vertically...
                    thumbArray[thumbNum].content.x = - (thumbArray[thumbNum].content.width / 2);
                    //Here is where we center the images horizontally...
                    thumbArray[thumbNum].content.y = - (thumbArray[thumbNum].content.height / 2);
                    //Before placing them in their own container Sprite, so that their relative positions can be
                    //determined accurately (a task that would've been otherwise impossible after the
                    //adjustments to position made above.)
                    var thumby = new MovieClip();
                    thumby.addChild(thumbArray[thumbNum]);
                    //thumbW being the max possible length or width of any one thumbnail (this was done for visual
                    //consistency and codified in the logic tree above), placing two thumbnails thumbW
                    //apart (measuring from center point in either case) will put them edge to edge at best. This is why
                    //we add (thumbW / 8) as additional spacing.
                    thumby.y = (row * (thumbW + (thumbW / 8)));
                    thumby.x = (col * (thumbW + (thumbW / 8)));
                    thumby.buttonMode = true;
                    thumby.useHandCursor = true;
                    var fA:Array = new Array();
                    var dS:DropShadowFilter = new DropShadowFilter(5, 45, 0x000000, 0.33, 5, 5, 1, 1);
                    fA.push(dS);
                    thumby.filters = fA;
                    trace("thumby.width = " + thumby.width);
                    trace("thumby.height = " + thumby.height);
                    batchSprite.addChild(thumby);
                    thumbNum++;
function enLarge(event:MouseEvent):void {
    var indexNum:Number = new Number();
    indexNum = thumbArray.indexOf(event.currentTarget);
    trace("indexNum = " + indexNum);
    darkStage = new Sprite();
    darkStage.graphics.beginFill(0x333333, .9);
    darkStage.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
    darkStage.addEventListener(MouseEvent.CLICK, reMove);
    darkStage.buttonMode = true;
    darkStage.useHandCursor = true;
    (parent  as  MovieClip).addChild(darkStage);
    loadSprite = new Sprite();
    loadSprite.addChild(loadArray[indexNum]);
    loadSprite.x = (stage.stageWidth / 2);
    loadSprite.y = (stage.stageHeight / 2);
    loadSprite.addEventListener(MouseEvent.CLICK, reMove);
    loadSprite.buttonMode = true;
    loadSprite.useHandCursor = true;
    loadSprite.mouseEnabled = false;
    (parent  as  MovieClip).addChild(loadSprite);
    var urlRequest:URLRequest = new URLRequest("xmls/" + indexNum + ".xml");
    var titleURL:URLLoader = new URLLoader();
    titleURL.addEventListener(Event.COMPLETE, completeListener);
    titleURL.load(urlRequest);
    function completeListener(event:Event):void {
        titleText = new TextField();
        titleText.autoSize = TextFieldAutoSize.LEFT;
        var myFont:Font = new BOF();
        var ttFormat:TextFormat = new TextFormat();
        ttFormat.color = 0xFFFFFF;
        ttFormat.size = 18;
        ttFormat.font = myFont.fontName;
        textSprite = new Sprite();
        textSprite.addChild(titleText);
        (parent  as  MovieClip).addChild(textSprite);
        var titleXML:XML = new XML(titleURL.data);
        titleText.text = titleXML.toXMLString();
        titleText.setTextFormat(ttFormat);
        titleText.embedFonts = true;
        textSprite.y = 570;
        textSprite.x = ((stage.stageWidth / 2) - (titleText.textWidth / 2));
        textSprite.mouseEnabled = false;
        titleText.mouseEnabled = false;
function reMove(event:MouseEvent):void {
    (parent  as  MovieClip).removeChild(textSprite);
    (parent  as  MovieClip).removeChild(loadSprite);
    (parent  as  MovieClip).removeChild(darkStage);
function addClickOnThumb():void {
    var cot:ClickOnThumbnail = new ClickOnThumbnail();
    cot.x = 400;
    cot.y = 583;
    (parent  as  MovieClip).addChild(cot);

Hey Jim
Wow, that's great; thanks! Can I ask what settings you used to get the files so small?
Yes, I am familiar with Photoshop and image optimization issues, but I didn't realize that PNG was so much bigger than JPG and that I had so much file size I could shed before I would notice a degradation in image quality. Your advice will certainly help greatly, and I will certainly apply it to the thumbs as well. I think my mom will be very pleased.  : )
I look forward to hearing what collection of settings you used.
Thanks and Be Well
Graham

Similar Messages

  • Adobe support is hopeless, there must be a better way, if not it might be better to get a different movie program. is anyone having the same problem?

    adobe support is hopeless, there must be a better way, if not it might be better to get a different movie program. is anyone having the same problem? 

    This is like buying a GM car and being told to talk to otherGM customers on how to fix your car yourself.  It it the blind leading the blind.   I have wasted many days and weeks because I cannot find solutions.  I have rarely gotten a solution from any similar forum, and more often been told by other members that I should buy what they have or that I should not want to make this or that type a disc, etc., and rarely a suggestion that is useful.

  • Callouts and anchored objects - there must be a better way to do this

    I've spent a lot of time in the last six months rebuilding PDF files in InDesign. It's part of my ordinary responsibilities, but I'm doing a lot more of it for some reason. Because I'm sending the text of these rebuild documents out for translation, I like to keep all of the text in a single story. It really helps to have the text in "logical order," I think; when I'm prepping a trifold brochure, I try pretty hard to make sure that the order in which the readers will read the text is duplicated in the flow of the story throughout the ID document.
    So, I'm rebuilding a manual that has a 3-column format on lettersize paper, and it's full of callouts. Chock full of 'em. They're not pull quotes, either; each of these things has unique text. Keeping in mind that I'd like the text in these callouts to remain in the same position in the text once I've linked all the stories and exported an RTF for translation, what's the best way to handle them? What I've been doing is inserting an emptly stroked frame as an anchored object, sized and positioned to sit above the text that is supposed to be called out. When my translations come back, they're always longer than the source document, so as I crawl through the text, I resize the anchored frames to match the size and position of the newly expanded translated text, and then nudge them into place with the keyboard.
    There Has To Be a Better Way.
    There is a better way, right? I'm not actually too sure. If I want to actually fill those anchored frames with text, I can't thread them into the story. I suppose that I could just thread the callout frames and assign two RTFs for translation instead of one, but then the "logical order" of my text is thrown out the window. So, I'm down to asking myself "what's more important? reduction of formatting time or maintenance of the flow of the story?" If there's something I'm missing that would let me dodge this decision, I'd love to hear about it. The only thing I can think of would work like this:
    1) Duplicate callout text in the story with a custom swatch "Invisible"
    2) Create "CalloutText" parastyle with "Invisible" swatch and apply it to callout text
    3) Insert anchor for anchored frame immediately before the CalloutText content
    4) Send it out for translation
    5) While I'm waiting for it to come back, write a script that would (dunno if this is possible):
       a) Step through the main story looking for any instance of CalloutText
       b) Copy one continguous instance of that style to the clipboard
       c) Look back in the story for the first anchor preceeding the instance of CalloutText
       d) Fill the anchored object with the text from the clipboard (this is where I'm really clueless)
       e) Apply a new parastyle to the text in the callout
       f) Continue stepping through the story looking for further instances of CalloutText
    If this really is the only decent solution, I'll just head over to the Scripting forum for some help with d). Can any of you make other suggestions?

    In-Tools.com wrote:
    The use of Side Heads saves weeks of manual labor.
    Yup, Harbs, that is exactly what I was describing. If I use the Side Heads plugin to set up a job, will my clients get a missing plug-in warning when they open up the INDD? Will roundtripping through INX strip the plugin but leave the text in the callout? (My clients don't care if the logical flow of the story is broken; it's just me.)
    I'm just curious; seems like a pretty obvious purchase to me. I'll probably try to script a solution anyways, after I buy the plugin; that way I get to learn about handling anchored objects in scripts AND deliver the job on time!

  • RESTORE to free up fragmented iPod disc space? There must be a better way!

    I've owned iPods since day one and yet I continue to (barely) tolerate an annoying circumstance, as follows: manually deleting songs and videos (mind you, I'm not referring to playlists) will free up some space on [put your iPod iteration here] but NEVER results in freeing up space equal to the size of the songs or videos deleted. As a result, the remaining "fragmented" space builds up over time and creates a serious loss of available "free" space — unless one performs a Restore and starts loading from scratch. Happily, Restore will double — or triple! — the amount of available (re: writable) space on iPods — but serious cost in personal time and trouble
    For those of us with high capacity iPods — I can hear you yelling, "Me! Me!" — why, alas, does Restore continue to be the only way for us to manually rebuild the iPod library (thereby resulting in much more writable (rer: available) disk space)?
    There must be an easier way? Countless searches of Apple Discussions produces nothing more than endless refrains of "Restore, Restore, Restore!"
    Me, I'm tired of manually restoring 25 GBs of songs/videos in order to free up that extra 50 percent of writable space.
    How about you?
    5G 30GB ipod   Mac OS X (10.4.4)  

    Welcome to Apple Discussions.
    Me, I'm tired of manually restoring 25 GBs of songs/videos in order to free up that extra 50 percent of writable space.
    Buy a larger-capacity iPod, then.
    If you really feel like Apple will hear you with your complaints, then do it here. Unless you have something that I can help you with, then please ask.
    rjl

  • Bloody sick of Itunes Restrictive Schemes, there must be a better way!

    Don't get me wrong, I love my macs and itunes and ipods and iphones and all the rest but I am sick of being told how to manage media by Apple. I've read this:
    http://support.apple.com/kb/HT1495
    but I want this:
    1) a single media library on a home server/external drive
    2) access to that media from any ipod that I own (3) from any machine that I happen to be near at the moment.
    3) without having separate iTunes accounts, all should be shared with the same ratings and playlists and whatnot.
    Is there anyway yet to do this? thx for helping us break out of this NWO media management!

    1) a single media library on a home server/external drive
    OK. You can do that now - lots of people do. There are several ways to accomplish that depending on how you want things to work, and they've all been described here and on many other web site. What's preventing you from doing the same?
    2) access to that media from any ipod that I own (3) from any machine that I happen to be near at the moment.
    OK. Set your iPods for manual management and you can load them from any computer with iTunes.
    3) without having separate iTunes accounts, all should be shared with the same ratings and playlists and whatnot.
    OK. Keep the entire iTunes library, including the library files, on the external drive. Then using the Option-key launch of iTunes, point all your copies of iTunes to that library folder. Then every system will have the exact same edition of iTunes, including all the same playlists, ratings, and whatnot.
    Alternatively, one of the synchronization utilities such as TuneRanger might work for you, if you don't want each system to have the same playlists, etc. but want to transfer ratings, etc.
    Message was edited by: Dave Sawyer

  • Dates and forms with JDBC - there must be a better way...

    Hi,
    I have a backing bean (CustomerBean) extended from class Customer that talks to a DOA for access to a JDBC pooled resource.
    I am having trouble getting an elegant solution for getting dates in and out of the DB using JSF forms.
    My Customer class defines the date as java.sql.Date - passing that through to the form gives errors during validation. The work around I managed to get working is for the CustomerBean to have a method that converts a java.util.Date to a java.sql.Date.
    public void setStartDate(java.util.Date startDate) {
    if (startDate == null)
    super.setStart(null);
    else
    super.setStart(new java.sql.Date(startDate.getYear(),startDate.getMonth(),startDate.getDate()));
    and
    public java.util.Date getStartDate() {
    return super.getStart();
    using:
    <h:outputLabel value="Start"/>
    <h:inputText id="startDate" value="#{customerBean.startDate}" required="false">
    <f:convertDateTime pattern="dd/MM/yyyy"/>
    </h:inputText>
    <h:message for="startDate" styleClass="message"/>
    the super property 'start' is a java.sql.Date. The line that bothers me is:
    super.setStart(new java.sql.Date(startDate.getYear(),startDate.getMonth(),startDate.getDate()));
    it uses deprecated constructor. (java.sql.Date(int year, int month, int day);
    Where should I be looking for a more elegant solution? (GregorianCalendar? Anything else?)
    Thanks in advance,
    - David

    Thanks...
    I did it this way:
    Customer.java has...
    private java.sql.Date start;
    and getters and setters...
    CustomerBean.java extends Customer, has no field but the getters and setters...
    public java.util.Date getStartDate() {
    return super.getStart();
    public void setStartDate(java.util.Date startDate) {
    if (startDate == null)
    super.setStart(null);
    else
    super.setStart(new java.sql.Date(startDate.getTime()));
    seems to work and my customer has it's dates as sql dates (that way I only convert dates when I actually need them updateable on screen rather than each read of a customer record from the DB.)
    To display the date I use
    <h:outputText value="#{customerBean.startDate}">
    <f:convertDateTime dateStyle="full"/>
    </h:outputText>
    To edit it, I use
    <h:inputText id="startDate" value="#{customerBean.startDate}" required="false">
    <f:convertDateTime dateStyle="short"/>
    </h:inputText>
    Is this a valid or recommended way?
    - David

  • Upgrading to Lion, There Must be a Better Way Than Migration Assistant!

    I finally got around to updating to Lion and it's turned out to be a little frustrating.
    First Attempt: simply updating over the top of my existing Snow Leopard installation. I had a variety of annoyances mostly surrounding the amazing amount of cruft laying around from years of installing,  then removing apps and just upgrading new versions of Mac OS on top of the existing ones.
    Second Attempt: Partition the drive, did a clean installation, used Migration Assistant and moved my old account to the new installation. This resulted in most of the cruft coming over, many of the annoyances remaining, and some settings and daemons mysteriously disappearing.
    Third Attempt: Deleted the second attempt, did another clean installation, created a new account with the same name as the old account, and then copied only the data I really wanted (Documents, iTunes Library, Mail Data, &tc...). This resulted in dozens of annoyances stemming from permission problems.
    So... how do I jettison all the artifacts from the past while only keeping the data I really want? How do developers deal with having more than one working installation on a Mac? Do they never move stuff between them?

    I pretty much agree with baltwo on this. The only way to weed out the 'cruft' is to reinstall each program manually, copy data from your Pictures, Documents, Music, and Movies folders. Then to be very careful about what you move from the old Library into the new one. Invariably this process leads to missing templates and other issues that take several days - and longer - to resolve. The end result? Your computer doesn't run noticeably faster and you gain perhaps a whopping couple GB or less of drive space.
    I speak from experience. I have performed this painful task twice (and was very thankful to have complete backups that I didn't erase because I didn't realize I was missing some templates for several months). My two work desktops and notebook go all the way back to Jaguar and they are no faster than my home computers of the same vintage.

  • Fios availabili​ty - There must be a better way

    I have truly worked hard to try to be a Fios customer!  6 phone calls for 4 hours and 3 weeks later I still can't give Verizon my money. For whatever reason my address is not listed in the "Fios available" directory and no one seems to be able to figure out why. Neighbors on both sides and across the street are all listed as available. I was solicited for Fios when they installed it on my street years ago. So here I am with money in hand, Fios in front of my house and I can't become a customer ... go figure! I feel that the main problem is that because I am not a current customer, there is no record of me calling or anything. Each time I have called I have had to go through the same speech, same information, different person. I have talked to everyone from sales, customer service, tech support and engineering. No solution!
    I am the best customer possible ... no advertising required, no sales team required. I will even place my order online, so no people are required but here I sit with my money in my hand!
    THIS SHOULD NOT BE THIS HARD!

    Please check your Private Message Inbox. It should look like this -->> 
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer that solved your issue as the accepted solution.

  • Rotating photo box-these must be a better way

    I am spending far too much time finding the so called CROSS-HAIRS in order to rotate my photo boxes in a book I am producing, any shortcuts please. PS I have the latest version 1.5.3

    I see what you mean now. When editing the book, make sure you press on the buttom at the top that has a square on each corner of the box and a cross inside that box. It's called 'edit layout'.
    Then press on the photo you need to rotate and the crosshairs show when the mouse it's over one of the squares on the corners and you move it a bit away from the photo. Hope this makes sense.

  • A better way to poll

    When my Start button is clicked it changes a member variable from false to true.
    Here is a simplified version of my code:
    public class gdvdhomevideo
       private boolean blnBegin;
       public static void main(String[] args)
          while(blnBegin == false){}
          //perform operations
       public void actionPerformed(ActionEvent e)
          String command = e.getActionCommand();
          if(command.equals("Start"))
             blnBegin = true;
    }So when the user clicks start it exits the while loop and the program starts performing other functions. The problem is that this approach is 100% CPU intensive and I know that there must be a better way?

    1) Code executed in the main() is NOT running on the event thread. Don't do any GUI code from the main thread... You know, stuff like showing windows, attaching event listeners etc.. You need to wrap all that stuff in a Runnable and pass that Runnable to SwingUtilities.invokeLater().
    2) Assuming the stuff you're doing in the main() is actually thread safe and doesn't touch the GUI, you can simply startup a new Thread and put your code in there. (see below)
    3) You class name is named badly. Please check out sun's java coding conventions. It is very nice to have coding conventions. Use them! ;-)
    4) if you want to setup your program as a loop rather than simply relying on user actions to fire events, then I'd suggest you use a timer that notifies on the event thread every X where X is a non-zero polling interval. I think there's a class is called SwingTimer that does this sort of thing for you.
    What you're attempting to do is non-trivial.. so.. ummm.. have fun..
    public class gdvdhomevideo
       private boolean blnBegin;
       public static void main(String[] args) throws Exception
            SwingUtilities.invokeLater( new Runnable() {
                  public void run() {
                       //setup stuff in here.
       public void actionPerformed(ActionEvent e)
          String command = e.getActionCommand();
          if(command.equals("Start"))
             new Thread(new Runnable() {
                public void run() {
                     //perform operations but don't touch the GUI.
              }.start();
    }

  • A better way to Double Click

    I have been wondering if there is a better way to detect single clicks Vs double clikcs than the model currently implemented. I am sure all of you have run into the problem of even though an event listener detects a double click eventually, it detects the single click first, so often you have to compromise the quality of your software to account for that. I have considered writing my own custom handler using threads and such, but it seems to me there must be a better way out there that I just have not been able to find. I need a way to detect double clicks, and fool the machine into believing no single click has occured. Must I re-invent the wheel?
    AC

    I agree that GUIs should have some uniformity to
    them..especially as we enter an age where computers
    are ubiquitous. But there are some situations where
    customized behavior is preferrable. If you have ever
    worked with movie special effects software, some art
    software, music software, especially, you know that to
    make a GUI intuitive, sometimes liberties must be
    taken with the 'standard' gui design.The application determines the standard not the OS nor the GUI.
    And to say 'Your code is not standard, therefore the
    fact that java cannont accurately distinguish between
    single and double clicks is your problem' smacks of
    nonsense to me.
    We all know that Java is a great
    language.Java is not just a language it is a platform and a philosophy.
    It is quicker and easier to program in,
    than c++, but it is not at full maturity. Every c++
    development environment I have ever used had the
    ability built in to distinguish between a true single
    click and a double click.As does Swing..
    I love Java, but most
    programmers could fill a page with the enhancements
    that it needs. Not all enhancements are practical.
    Like many I balked when I first started with Java at
    the fact that it did not have true multiple
    inheritence. I now realize that
    I never really needed it anyway. But some things, eg
    templates, I definitely could still use. That being,
    said, thanks for the dialog. Templates are a complicated horror, unless you really need your software to be truly adaptable you will never use them. Even MS, Sun and IBM disposed of that need a long time ago.

  • Multi-plot Graphs, is there a better way?

    I am still not good at graphs in LabView but I think I am making some programs and I can usually get a graph to show with I want it to show with only a few hours of dinking around with it...
    Anyway using graphs certainly makes for messy code unless there is a better way to wire this. Basically this graph shows four temperature probes and is updated every minute. Every 15 minutes a check for stabilization is run. Seemingly the only way I have been able to get multiple plots with Time as the X-Axis is to use an X-Y chart, but I have to index my readings out individually and put each in it's own shift register, and add it to the graph separately.
    There must be a better way?
    Solved!
    Go to Solution.
    Attachments:
    G2.jpg ‏258 KB

    I think part of your problem is you are not aware of the "concatenate inputs" option for build array. You don't need multiple build arrays for the array of clusters you are wiring into the graph (pink wire). Just expand the build array, wire in all your clusters, then right click the build array and choose "concatenate inputs". Next, you can use a cluster to store all your graph arrays (orange wires) which will greatly clean up your diagram.
    CLA, LabVIEW Versions 2010-2013

  • Array cycling - a better way?

    Is there a better way of doing this? I use this a lot, and feel there must be a better way, but don't know what. gridSize is an array that contains x and y dimensions. Some code needs to be executed for each square on the grid. I was once told that avoiding refering to arrays explicitly (i.e. ar[2]) is a good way to go, but I can't figure out how to do that in this instance!
    for (int i = 0; i < gridSize[0]; i++) {
    for (int j = 0; j < gridSize[1]; j++) {
    //...code...
    }

    Yeah, I don't think you mean to use gridSize[0], but length. Still, you shouldn't need to specify it like ar[2], keep it a variable. This is how you could loop through every square:for(int i = 0; i < gridSize.length; i++)
        for(int j = 0; j < gridSize.length; j++)
    //...code...
    }Just note that the <i> is really [i] because of a forum software bug.

  • I've lost iWeb and thus my web design.  I must start from scratch.  Should I reinstall iWeb 09 and use that, or is there a better way?

    I've lost iWeb and thus my web design.  I must start from scratch.  Should I reinstall iWeb 09 and use that, or is there a better way?

    The file you really need is named Domain.sites2 which resides in your   Home/Library/Application Support/iWeb foldler.  It's independent from the iWeb application. If it's not in there do you have a backup of your hard drive from an earlier time? 
    Resinatll iWeb 3 from the iLife 09 disk or wherever you got it from originally and then try what's described below:
    In Lion and Mountain Lion the Home/Library folder is now invisible. To make it permanently visible enter the following in the Terminal application window: chflags nohidden ~/Library and press the Return key - 10.7: Un-hide the User Library folder.
    To open your domain file in Lion or Mountain Lion or to switch between multiple domain files Cyclosaurus has provided us with the following script that you can make into an Applescript application with Script Editor. Open Script Editor, copy and paste the script below into Script Editor's window and save as an application.
    do shell script "/usr/bin/defaults write com.apple.iWeb iWebDefaultsDocumentPath -boolean no"delay 1
    tell application "iWeb" to activate
    You can download an already compiled version with this link: iWeb Switch Domain.
    Just launch the application, find and select the domain file in your Home/Library/Application Support/iWeb folder that you want to open and it will open with iWeb. It modifies the iWeb preference file each time it's launched so one can switch between domain files.
    WARNING: iWeb Switch Domain will overwrite an existing Domain.sites2 file if you select to create a new domain in the same folder.  So rename your domain files once they've been created to something other than the default name.
    OT

  • A better way to manage Notes?

    We are a small team in collaboration on a book-length manuscript.My editors are inserting hundred of Notes into the document that I must cycle through and resolve each one. But I find the Note icon soooo tiny. When I'm at full page I can barely see those little guys. Is there any way to make the Note indicators bigger or something? In general. I don't see this Notes tool as very robust compared to change tracking type features found in word processors.
    I just want a better way to manage the Notes flow.

    Eugene Tyson wrote:
    I find using Notes in Story Editor to be way better.
    CTRL Y or CMD Y
    Then you can Expand/Collapse notes in Story Editor.
    Far easier to read and implement there, or if you need to switch back to layout just hit the shortcut again.
    It's also useful to tile a Story Editor window and the corresponding document's window, to have both views of the content.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

Maybe you are looking for

  • ITunes installed, but won't fully open

    after downloading and installing iTunes 7.0.2 I try to open the program without much luck. It takes me to the user agreement page, but then and error comes up. The error says, "The folder "iTunes" cannot be found or created, and is required. The defa

  • Photo Gallery Disappears with ICS

    Trying to use the Photo Gallery after my ICS upgrade today.  It will appear for a second or two, but if I try to create a slideshow or access Gallery Home, it reverts back to camera.  Anyone have an idea how to fix this?

  • How to include built in classes..?

    hi friends i am having the doubt in mind,I need to use linked list in my program can i import the linked list class before i use (or) shall i directly include in the code.It means... import java.util.LinkedList; class A or class A java.util.LinkedLis

  • How to edit stroke width after line is drawn?

    In Flash CS4, I'm trying to change the stroke width of my line or shape, with it selected, but the stroke width slider is greyed out (thus, unadjustable). Is it possible to edit a stroke width after something has been created? If so, how can this be

  • Budgeting for Cost center in KPZ2 tcode

    Hi Friends, I have a requirement stating to create the cost center and do the budgeting for that cost center. This has to be done using BAPI / FM. Can anyone help me out in finding out the BAPI / FM .