A better way to auto set category to bank transactions

I have a table with bank transactions, the third cell have "Memo", some kind of description, I want to classify the transaction based on words found in the "Memo" based in another table with first column with classification and the second column with words (can be more than one word) to find.
Example:
Table Transaction:
Value
Balance
Memo
Category
-100,00
1900,00
Company Phone - electronic bill
Communication
-200,00
1700,00
School payment
Education
1000,00
2700,00
Deposit trough machine
-20,00
2680,00
Bob's Diner
Food
-40,00
2640,00
Star Gas Station
Fuel
Table Category:
Category
Key
Communication
Phone, Cell
Education
School
Fuel
Gas, Ethanol
Food
Diner, Restaurant
So far I found 3 possible solutions but I'm looking for a elegant and easy way to do it, it need be easy to manage and add words as criterions.
Found Solutions:
1 - nested "IF" (Complicated to manager and to add new keys for new categories)
2 - Add columns to the first table, one column for each key to test, then use "Lookup" to get Category in the column header (Not elegant)
3 - Trough AppleScript (very slow).
I make a research to find a way to make some like a "Loop" or a "Repeat until" with only Numbers formulas but I don't found nothing.
Any help will be appreciated.
Thanks.
Ps: this is my AppleScript (my real table is a little different than that in this message, my table have a subcategory too).
on know_category from array to memo
          set found to {"?", "?"}
          repeat with description in array
                    repeat with |key| in item 3 of description
                              if |key| is in memo then
                                        set found to description
                                        exit repeat
                              end if
                    end repeat
                    if not found is {"?", "?"} then
                              exit repeat
                    end if
          end repeat
          return found
end know_category
on categories_as_array from table
          set |result| to {}
          tell application "Numbers"
                    repeat with |row| in rows of |table|
                              set values to value of cells of |row|
                              set AppleScript's text item delimiters to ", "
                              set Category to first item of values
                              set subcategory to second item of values
                              set keys to text items of (third item of values)
                              set AppleScript's text item delimiters to " "
                              set end of |result| to {Category, subcategory, keys}
                    end repeat
          end tell
          return |result|
end categories_as_array
tell application "Numbers"
          set categories to categories_as_array of me from table "Category" of sheet "Config" of first document
          set names to {}
          repeat with |sheet| in sheets of first document
                    set end of names to name of |sheet|
          end repeat
          set |name| to {choose from list names} as text
          repeat with |row| in rows of table "Transactions" of sheet |name| of first document
                    if not (value of item 7 of cells of |row|) is "Category" then
                              set memo to value of item 5 of cells of |row|
                              set found to know_category of me from categories to memo
                              set value of item 7 of cells of |row| to first item of found
                              set value of item 8 of cells of |row| to second item of found
                    end if
          end repeat
end tell

I apologizes but your handler categories_as_array seems to be wrong.
When I run the script it fails because it doesn't find a third item in values
I edited it this way :
on categories_as_array from table
          set |result| to {}
          tell application "Numbers"
                    repeat with |row| in rows of |table|
                              set values to value of cells of |row|
                              set AppleScript's text item delimiters to ", "
                              set Category to first item of values
                              set subcategory to second item of values
                              try
                                        set keys to text items of (third item of values)
                              on error
                                        set keys to ""
                              end try
                              set AppleScript's text item delimiters to " "
                              set end of |result| to {Category, subcategory, keys}
                    end repeat
          end tell
          return |result|
end categories_as_array
but the returned list which is :
{{"Category", "Key", ""}, {"Communication", "Phone, Cell", ""}, {"Education", "School", ""}, {"Fuel", "Gas, Ethanol", ""}, {"Food", "Diner, Restaurant", ""}}
is not the expected one.
My proposal would be :
on categories_as_array from table
          set |result| to {}
          tell application "Numbers"
                    repeat with |row| in rows of |table|
                              set {Category, values} to value of cells of |row|
                              set AppleScript's text item delimiters to ", "
                              set subcategory to first text item of values
                              try
                                        set keys to text items 2 thru -1 of values
                              on error
                                        set keys to {}
                              end try
                              set AppleScript's text item delimiters to " "
                              set end of |result| to {Category, subcategory, keys}
                    end repeat
          end tell
          return |result|
end categories_as_array
which returns :
{{"Category", "Key", {}}, {"Communication", "Phone", {"Cell"}}, {"Education", "School", {}}, {"Fuel", "Gas", {"Ethanol"}}, {"Food", "Diner", {"Restaurant"}}, {"fake", "sub1", {"key1", "key2", "key3"}}}
As you see, for tests I added a row to your table.
It contains :
fake
sub1, key1, key2, key3
Yvan KOENIG (VALLAURIS, France) mercredi 27 avril 2011 11:38:31

Similar Messages

  • Auto-set Conditional Build Tags Based On Style?

    Is there a way to auto-set conditional build tags based on style?
    I want to be able to import a Word document into RoboHelp and have it recognize certain styles as requiring certain conditional tags. For example, an imported Word document might have a style called WD_Internal and any text with that style would automatically have a conditional build tag assigned to it. The idea is to allow my SMEs to indicate which text is intended for internal audiences and which text is OK for customer consumption in a single central Word document using styles. When the content is correct, I'd import it into RoboHelp, have RoboHelp assign conditional build tags, then generate multiple printed versions of the document (an internal version and a public consumption version).
    Setting conditional build tags is pretty easy, but it will still be a lot of work to manually set them. Is there a way to do this automatically?
    I am using RoboHelp HTML RH9.

    Hi,
    There's no way to do this through the interface. You can however create a script to do this for you. Cycle through the content of the topics and insert the code for the CBT.
    Greet,
    Willam

  • Is there a better way to stop a Method than Thread.stop()?

    First my basic problem. In one of my programs I am using constraint solver. I call the constraint solver with a set of constraints and it returns a Map with a satisfying assignment. In most cases this works in acceptable time ( less than 1 second). But in some cases it may take hours. Currently I am running the function in a Thread and using Thread.stop(). This look like that:
         public Map<String, Object> getConcreteModel(
                   Collection<Constraint> constraints) {
              WorkingThread t=new WorkingThread(constraints);
              t.setName("WorkingThread");
              t.start();
              try {
                   t.join(Configuration.MAX_TIME);
              } catch (InterruptedException e) {
              if(t.isAlive()){
                   t.stop();
              return t.getSolution();
         }where t.getSolution(); returns null if the Thread was interrupted.
    Unfortunately this sometimes crashes the JVM with:
    # A fatal error has been detected by the Java Runtime Environment:
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006dbeb527, pid=5788, tid=4188
    # JRE version: 6.0_18-b07
    # Java VM: Java HotSpot(TM) 64-Bit Server VM (16.0-b13 mixed mode windows-amd64 )
    # Problematic frame:
    # V  [jvm.dll+0x3fb527]
    # An error report file with more information is saved as:
    # F:\Eigene Dateien\Masterarbeit\workspace\JPF-Listener-Test\hs_err_pid5788.log
    # If you would like to submit a bug report, please visit:
    #   http://java.sun.com/webapps/bugreport/crash.jsp
    #Does anyone knows a better way to do it?
    Thank you in advance.
    Note 1: the Constraint solver is a Third Party tool and changing it is unfeasible. (I have tried it already)
    Note 2: Using Thread.stop(Throwable t) only chances the error message.

    In case somebody have the same problem here my code which solves the problem. Note it requires to parameters and the result to be serializable.
    The Class which starts to Process:
    public class Solver{
         public Map<String, Object> getConcreteModel(
                   Collection<Constraint> constraints) {
                   try
                        Process p=Runtime.getRuntime().exec(...); //do not forget the classpath
                        new TimeOut(Configuration.MAX_TIME, p).start();
                        ObjectOutputStream out=new ObjectOutputStream(p.getOutputStream());
                        new ErrReader(p.getErrorStream()).start();//not that std.err fills up the pipe
                        out.writeObject(constraints);
                        out.flush();
                        ObjectInputStream in=new ObjectInputStream(p.getInputStream());
                        return (Map<String, Object>) in.readObject();
                   catch(IOException e)
                        return null;
                   } catch (ClassNotFoundException e) {
                        //should not happen
                        return null;
         // For running in a own process
         static private class TimeOut extends Thread
              private int time;
              private Process p;
              public TimeOut(int time, Process p)
                   this.time=time;
                   this.p=p;
              @Override
              public void run() {
                   synchronized (this) {
                        try {
                             this.wait(time);
                        } catch (InterruptedException e) {
                   p.destroy();
         static class ErrReader extends Thread
             InputStream is;
             ErrReader(InputStream is)
                 this.is = is;
                 this.setDaemon(true);
             public void run()
                 try
                     InputStreamReader isr = new InputStreamReader(is);
                     BufferedReader br = new BufferedReader(isr);
                     String line=null;
                     while ( (line = br.readLine()) != null)
                         System.err.println(line);   
                     } catch (IOException ioe)
                         ioe.printStackTrace(); 
    }And the class which executet the Program
    public class SolverProcess {
          * @param args ignored
         public static void main(String[] args){
              try {
                   ObjectInputStream in =new ObjectInputStream(System.in);
                   SolverProcess p=new SolverProcess();
                   p.constraints=(Collection<Constraint>) in.readObject();
                   p.compute();
                   ObjectOutputStream out=new ObjectOutputStream(System.out);
                   out.writeObject(p.solution);
                   out.flush();
              } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              //System.err.println("solved");
              System.exit(0);
         private Map<String, Object> solution=null;
         private Collection<Constraint> constraints;
           private void compute()
    }

  • Masking out images. Is there a better way

    Could someone help me out and maybe point me towards a better way to mask. png file is way too big. I have been using the mask layer option to create my own mask around a jpg image by drawing around it on the mask layer. There has to be a fetter and faster way to do this. Is it possible to maybe have a specific color range have an alpha value of 0.  Similar to green screening whereas If I put the item I want to clip on a green background flash will auto take out the green for me. and by auto I mean action script maybe. I think this can be done but im not finding it.
    how are these guys clipping these images http://www.cr8tiverecreation.com/home.swf
    they have the movie clips set up where the black background on the 3 layers of shoes is getting masked out. When I go into the shoe movie clips I see there is a black background but it just disappears when I go back to main timeline. Im not seeing any code for this or anything Please anyone help me out here. Thanks!

    you could but that would be more cumbersome than simply assigning the background color to be transparent using the bitmapdata class.  and even that may be problematic if the background color is used in the foreground and you don't want it to be transparent.

  • Can some one tell me a better way...

    Hi All..
    I work on a web application. I create user ids for people logging into my application. here I have a small problem.. This is what I am currently doing...
    When I create a new user, I assign a new user id to the user and store all hi info.
    All our user ids are stored in User_ID table and user info in User_Info table.
    First I get the max user id from the User_Id table.
    int iuserid = select max(User_ID) from User_ID;
    Then I add ' 1 ' to this and assign it to new user.
    iuserid = iuserid+1;
    insert into User_id values(iuserid, <ssn> );
    Then I store all user info in User_info table..
    insert into User_info(iuserid, <first_name>, <last_name>,...);
    Both these SQLs are executed as a transaction.
    The problem that I have...
    It works fine in a normal environment and in my testing.
    But when the load inceases, before I insert into the User_info, another user tries to get the max User_id from User_ID table, then it conflicts..
    I have seen occurences of User_Info storing the info of a different user against the User_id when many people are accessing the app at the same time.
    Can some one tell me a better way to handle this scenario..
    Appreciate all you help..
    TIA..
    CK

    Hi,
    assuming that the requirement for user_id is only for uniqueness (primary key requirement) not continuosly.
    perhaps can try this,
    1) create a table to keep the max id for each table's key.
    e.g.
    create table key_id_lookup
    key_name char(n),
    current_value number(m)
    where n & m is the size of the field
    2) for each creation of entry in the user_id table, lookup the value in the key_id_table and increment it after retrieval.
    e.g. current_id = select current_value from key_id_lookup where key_name = 'user_id_key';
    current_id+=1;
    update key_id_lookup set current_value = current_id where key_name = 'user_id_key';
    something similar to use of sequence if your database support it.
    3) continue with the creation of record in other tables. now obtain the time stamp of creation and append with the current_id obtained. e.g. timestamp = 132456872; size of m is 5, user_id = 132456872 x 100000 + current_id;
    this should give you a unique key at creation time.
    There should be other better ways of resolving this(like locking the table for the update operation but affect performance, etc), depending on the feature supported by the database in use.
    Hope this can help as last resort if other options not available.

  • A better way to run a 7 day report?

    Using Crystal Reports 11
    I am hoping there is a better way of running a seven day report that i have to run weekly
    In the report i have it set when refreshing the document, the "Prompt for new parameter values" comes up and there is a date field for start and end
    This is how i did it
    I made a formula called "Date" this comes from the closed date of our accounts
    I made a Parameter Field "Start Date" with the TYPE field is "Date"
    I made a Parameter Field "End Date" with the TYPE field is "Date"
    I made a Select Expert Using data from the "ClosedDate" in the first drop down I picked "Formula" and used this as the formula
    {WH_ACCTCOMMON.CLOSEDATE} in {?Start Date} to {?End Date}
    Two things
    1. Is there a way to have "Prompt for new parameters values" as the default checked off box when clicking "Refresh"?
    2. Is there a way to only enter a start date and the refresh would just run 7 days without entering a end date?

    Hi,
    Here's a suggestion for question 1:
    When you preview the report for 1st time there is no prompt window that asks you to select whether you wish to 'Use current values' or 'Prompt for new values'.
    If the Preview window is open and you hit refresh again, this is when you get the pop-up with the above options. If you close the Preview window and refresh again, you would not get a pop-up and it will show the Prompt window instead.
    For question 1, you can follow Alun's sugestions.
    -Abhilash

  • A better way to deal with lost hyperlinks when converting Robohelp to Printed doc?

    I have inherited a 750-page manual that is
    "single-sourced" in RoboHelp X5. When I generate printed
    documentation, all of my hyperlinks and converted to plain text.
    Everytime we release a new version of the manual with any changes,
    we have to re-generate, and then manually go into the MS-Word
    converted document and re-create some 350 hyperlinks and page
    number references. Somebody please tell me that there is a better
    way to do this, or a better tool to manage single-source
    documentation.

    Another post has been raised relating to this problem. See
    http://tinyurl.com/yvpaut
    I am replying here is this is where most of the relevant
    information is.
    You found that using the Style Mapping template solved the
    images problem but the document stopped generating at 450 pages.
    That was sort of what I hoped for. Rather than go to the step I
    will suggest in a moment, I suggested you try something else but
    you never came back to the forum to indicate you had tried it, so
    the assumption is you did and it worked. Patently it did not so
    let's try what I would have suggested next.
    On my website there is a topic on Print Issues and one of the
    them covers Malformed Topics. Try looking for <p
    style="mso-bookmark: as suggested in my earlier reply in this
    thread. You can try RH's Multi file find and replace but FAR from
    http://www.helpware.net/FAR
    may get better results. I think with this error you usually get a
    message. Do you have the Output pane opened and have you read right
    through it for clues? View | Output on the menu. Whether or not the
    Output pane mentions this error, I would search for it anyway.
    Other Points:
    A] It could still be a resource problem. The document is very
    large so, as Harvey mentioned, resources come into it. I know the
    PCs that won't play nicely have good resources but whilst I am no
    expert in this area, don't foget XP is using more of them leaving
    less available to you. It could be an issue but I am inclined
    towards it being something else.
    B] I also suggested a hunt for a rogue topic.
    "What I would try is copying your layout so that you have
    three versions of it. Then delete two thirds from each one. If all
    three work fine, it sort of confirms that size is a problem. If one
    fails, your on the track of the rogue topic."
    Did you try that? Like I said, if all three work fine, then
    we are back with the resource problem but we will have ruled out
    other issues. It should take less than fifteen minutes to set that
    up. Longer to run it but you can be doing something else at that
    point.
    C] On FrameMaker, no real answer but you will soon see
    evidence that Adobe are continuing to better integrate all the
    products we are using. I don't think you will see what you want in
    the upcoming version though.
    NEXT:
    1] Please search for <p style="mso-bookmark:
    2] If that fails, try creating the three layouts.
    3] Then post back how it went. If unsuccessful, tell us if
    the Output pane gave any information about things the process did
    not like.
    Let us know either way as if one succeeds and you post that,
    it helps the next person with the same problem.

  • A better way to arrange icons?

    Is there a better way to arrange icons? iTunes just **ed up all of my sorted icons and they are now however iTunes determined them to be. I've got 7 pages that I really don't want to 'click & drag'. It'd be nice if I could arrange them in iTunes.

    Happened to me once. I did a restore and it set them back in the proper spots I had them in before. Other than doing that you have to do them on the phone.

  • Is there a way to auto sync playlists while manually managing your music?

    I used to use WMP11 before I bought an iPod and used iTunes, and in that I was able to auto sync playlists to my Samsung dap, as well as being able to manually drag tracks/albums to it.
    Since using iTunes, I have found it is not as accessible in this regard. Of course, you can opt to manually manage your music, but if you do this, it does not auto sync any info. This means that if I drag a playlist to my iPod and alter it at a later stage by adding more tracks, it won't alter it on the iPod unless I manually replace it with the amended one. It also means that any ratings that I set on my iPod do NOT get transfered to the tracks in iTunes when connected.
    What I have done is set a playlist called 'iPod Tracks' in iTunes, and have dragged any extra albums to my iPod using that, as well as the smart playlist 'Top Tracks'. But the disadvantage of this is, if I drag a few songs from an album into my 'iPod Tracks' playlist, then later decide I want the whole album and drag that over, I end up with two of the same tracks in the playlist, which makes it look very untidy (although I am aware only one of each track will be on the iPod) so it is not ideal.
    Surely there must be a way to auto sync playlists so that when you amend them in iTunes it does so on the iPod too, as well as manually drag over any extra tracks/albums you want without having a messy playlist work-around like I have done.
    Any help/ideas?
    Thanks in advance.

    There is no way to sync content back to itunes. As you are aware there are a couple of unsupported ways to recover your content, you will need to decide if your content is valuable enough to go down this route.
    If so and you are not comfortable with the procedures, I suggest taking the unit to a data recovery specialist with mac experience.

  • 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

  • Is there a way to auto disable out of stock variations or add Out of Stock to the dropdown

    Hi,
    I have read this article regarding the variation options - (Updated) Product inventory control for attributes (beta)
    While it is great that you can auto remove disabled options from the dropdown menu, it seems pointless to be able to do this if a variation with a stock level of 0 is not auto set to disabled.
    Is there a work around for this that does not involve the client manually changing to disabled or adding Out of Stock to the variation name?
    And when will this be fixed?
    Thanks
    Madeleine

    When you save them just make sure you save them to your Mac and not iCloud. For those that already exist, you can move them from iCloud by dragging and dropping them to somewhere else on your Mac. To see all the files in iCloud choose file > open in either pages or numbers.

  • Is There a Better Way to Work in the Marker List Window?

    Is there a better way to sequentially listen to phrases one-by-one in the Marker List window? What I'm doing is Auto-Marking one single long file to break out 271 bits and save each as their own file. It's WAY faster than copying and pasting bits into new files and "saving as" 217 times.
    BUT, after Auto-Marking, I have 300-400 phrases to listen to, deleting the non-keepers as I go, until I'm left with my "keeper" 271 marked phrases. But it's so tedious to move from phrase-to-phase. I have to double-click each one before I can hear it (you can move the cursor with the down-arrow, but it won't actually select the audio). So I have to use the mouse (unless I'm missing something) and double-click each of the hundreds of phrases. Then whenever I delete one (which I'll have to do about a hundred times or more to get rid of bad takes, alternates, etc.), inexplicably the cursor jumps way up the list so you have to scroll back down dozens of files to get to where you were. It took me 35 minutes to do it this last time.
    Contrast that with Reaper's audition/preview functionality (which, ironically, AA has also, but only for files already saved into a folder). Once I had all the files saved into a folder, I QC'd all 217 files in Reaper and MAN what a difference! All I had to do was use the "down" arrow to advance to the next file AND have it play automatically (Audition can do the same thing with the "Open File" feature). It literally took me 5 minutes to check all 217 files that way. If AA could add that kind of functionality to the Marker List window, or if I'm just completely missing something (very possible) I would REALLY be happy.
    Any ideas?
    Thanks again! Happy New Years again!
    Ken

    Wild Duck,
    That doesn't quite do what I need. My end-product is 271 (used to be 116) separate files created from one large file. That large one is made up of WAY more than 271 (the VO actor records different versions of some commands, makes mistakes, etc.).
    So I need the ability to listen to each marker, and then be able to delete it if need be.
    The Playlist makes this impossible in two ways. It only has 2 options for hearing each marker, and neither option allows me to delete that marker after I've heard it. It either plays them all back-to-back without stopping, or it plays each as you click the "Move Down" button. That last one would be great if showed me which marker was playing! But it doesn't, so there is no way for me to know which marker number I just heard, nor can I delete that marker after I hear it.
    Sigh.
    Thanks for the tip though:).
    Ken

  • 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!

  • Better Way to do this loop.

    I know there is better ways to do this so that I can merely have it loop infinitely until it hits the max password. I would also like to keep the spot where it has the print Statements because I tend to set some other code in front of it.
    If anyone also has some Ideas so I can have it stop and start in particular positions.
    Like lets say ?!!!!? to ?~~~~?
    Thanks a ton. Below is the code.
       char[] password = new char[20];
       int current_last_letter = 0;
       int max_password = 3;
       while(current_last_letter < max_password)
       for(int counter_gamma = 32; counter_gamma <= 126; counter_gamma++)
           for(int counter_beta = 32; counter_beta <= 126; counter_beta++)
                for(int counter_alpha = 32; counter_alpha <= 126; counter_alpha++) //alpha = increase last character by one
                    password[current_last_letter] = (char)counter_alpha;
                    System.out.print(password);
                    System.out.println("::null");
                if(current_last_letter > 0)
                    password[current_last_letter-1] = (char)counter_beta;
                else
                    counter_beta = 127;
            if(current_last_letter > 1)
                password[current_last_letter-2] = (char)counter_gamma;
            else
                counter_gamma = 127;
       current_last_letter++;
                   

    If I interpreted your code right, you simply want to count in radix '~'-' '+1 (read this carefully).
    Given a password, and a lo/hi value for the character range, the following method returns the
    lexicographically next password. The method returns null if no such password exists --    char[] nextPassword(char[] pw, char lo, char hi) {
          for (int i= pw.lenght; --i >= 0;)
             if (pw[i] < hi) { // next character possible here?
                pw[i]++;
                return pw;
             else // * no, reset to first value and continue;
                pw= lo;
    return null; // all pw-chars reached their hi value
    So, if you initialize a password char array as follows --    char[] pw= new char[20];
       Arrays.fill(pw, ' '); the following fragment handles every possible password --    do {
          handlePassword(pw); // do something with pw
          pw= nextPassword(pw, ' ', '~');
       } while (pw != null); kind regards,
    Jos

  • Is there a better way to do this Update?

    Can you do the following in a better way, maybe by using some sort of join between table_a and table_b
    update
    table_a a
    set
    (column_1, column_2)
    =
    (select
    column_3, column_4
    from
    table_b b
    where
    b.column_5 = a.column_6)
    where
    a.column_7 = whatever

    First of all, i would like to ask "if all the rows presnet in table_a are also present in table_b (w.r.t some relation like b.column_5 = a.column_6 in your example ???" If your answer is no, then your query is WRONG...it will update all records of table_a (that have a.column_7 = whatever) irrespective of whether they exist in table_b or not. There are two ways to do that
    (1)
    update table_a a
    set (column_1,column_2)=(select column_3,column_4 from table_b b where a.column_5=b.column_6)
    where exists (select null from table_b c where a.column_5=c.column_6)
    and a.column_7 = whatever
    (2)
    update
    (select column_1,column_2,column_3,column_4
    from table_a a, table_b b
    where a.column_5=b.column_6
    and a.column_7=whatever
    set column_1=column_3, column_2=column_4
    the second method wouldn't run untill you have a P.K on table_b(column_6)

Maybe you are looking for

  • My iPod Touch and iPhone 3G do not get recognized as a device by iTunes

    Both, iPod Touch and iPhone 3G don't show up on my macbook and do not get recognized as a device by iTunes. I switched cables, restarted macbook (and the other devices) and did an iTunes update. Still nada, niente, rien, nichts and nothing... any gui

  • Satellite L775 goes into BSOD after upgrade to Win 8.1

    hello First, I have win7 on this device, then I purchased a mictosoft windows 8 pro for it. When I upgraded it went fine for a few months and then it started to crash on its own. I tried so much to rebuild the PC using Toshiba's software to no avail.

  • Document Compatability with Windows

    If you type a document using an apple program and send it to someone with a normal computer running windows, will they be able to read the document or do you have to type it in a windows program. And conversely if I type something in WORD and send it

  • Time Capsule/Machine or Yosemite Issues

    Hi, I am really struggling with my system, 10.2.  Not sure whether it is OS X or time capsule, although both have been reset, reformatted, OS X reinstalled as backup and as fresh install with only putting back applications and documents.  But my syst

  • Cannot remove duplicate songs

    I'm trying to remove duplicate songs in my Library. Instructions say to select song, "shift" and select "view". "Shift" shows plus sign but when hit, no "view" is listed. I just updated itunes. Help, please! Thanks.