Script information out of a particular layer from Indesign

I am trying to create a simple script which will point to an Indesign CS3 document and extract the information from a particular layer..... I am having a tough time. I know you can script pretty much anything :-)

You have to open a document to be able to script it. I would first start with an open document and if this works open documents of a particular folder for example.
Try something like this:
var myFormat = ExportFormat.textType;
var myExtension = ".txt";
var myFolder="~/Documents/Spot";
var mydoc=app.activeDocument;
var mylayer=mydoc.layers.itemByName("Spot");
for(i = 0; i < app.activeDocument.stories.length; i++)
myStory = app.activeDocument.stories.item(i);
var tc=myStory.textContainers[0];
if (tc.itemLayer==mylayer)
myID = myStory.id;
myFileName = "StoryID" + myID + myExtension;
myFilePath = myFolder + "/" + myFileName;
myFile = new File(myFilePath);
myStory.exportFile(myFormat, myFile);
This will save your stories into text files. If this is what you want.
Ralf

Similar Messages

  • HT1977 How would I find out why a particular app, In-A-Visit, was removed from app Store?

    How would I find out why a particular app, In-A-Visit, was removed from app Store?

    Ask the app developer. Maybe they will tell you why... Apple will not disclose the reason to you unless you are the developer. It's entirely possible that the developer removed it.

  • Please help me, I gave my information out to a person and he has changed all my information and now I can't get in.. I know the persons name

    Please help me, I gave my information out to a person and he has changed all my information and I can't log back in.
    Adrian Lee is the person I gave it to.
    He told me to email him my information so he can level me up in the game Clash of Clans so I did and he changed all my information and I told him to give it back via email and he refused but suggested to restore my iPod and it would go back to normal and I dis, I nearly lost everything since I haven't backed it up for a while and I'm a Music Producer, this password is my paycheck, my food, my rent, my everything, now I'm not sure if this is the right place to go to but please help me. i'm begging you to please restore my password.. I'm not asking for anything of what I lost back, just my password so I can change it, get my things back and move on with my life. I have really back anxiety attacks. Please. I'm begging you. You guys are my last chance..
    <Emails Edited By Host>

    If you can't contact the person and get the information back then:
    - Contact the police for help
    - Restore from backup.
    If you can't get it from the person or from a backup then it is lost.
    In the future be carrful about who you give your login information to.

  • IMac CPU3.06 GHz Intel Core 2 Duo, 8GB, Extremely slow and repeatedly "out of Memory" since migration from Mountain Lion to Mavericks

    Dear Apple Support Community.
    As mentioned by a number of users reporting the same problem, my 2009 iMac CPU3.06 GHz Intel Core 2 Duo, 8GB RAM, has become extremely slow and repeatedly "out of Memory" since it was migrated from Mountain Lion to Mavericks (OS 10.9 then OS 10.9.1).
    I have already run CleanMyMac, deleted 5GB of useless stuffs, which did not translate into any improvement. Following the advices collected in other Apple Support Community threads, I have applied EtreCheck the outcome of which is provided below.
    For information, I have also upgraded my 2011 MacBook CPU2.3 GHz Core i7, 8GB which became only a bit slower than before, sometimes freezing which it almost never did before. However, I am used to the fact that Mac get usually slower and more prompt fo freeze after upgrading to a more recent OS.
    Both my 2009 iMac and my 2011 MacBook have F-Secure installed. So the problem with the 2009 IMac is unlikly to be due to the presence of F-Secure. Interestingly, the few abnormalities found by Etrecheck were exacly identical before I ran CleanMyMac. There are two more findings (mentioned below) since I ran CleanMyMac on the 2009 iMac, which again didn't improve the problem.
    So please find below the details of the EtreCheck experience and some additional measurements made with iStat while running EtreCheck:
    Hardware Information:
    iMac (24-inch, Early 2009)
    iMac - model: iMac9,1
    1 3.06 GHz Intel Core 2 Duo CPU: 2 cores
    8 GB RAM
    Video Information:
    ATI Radeon HD 4850 - VRAM: 512 MB
    Audio Plug-ins:
    BluetoothAudioPlugIn: Version: 1.0 - SDK 10.9
    AirPlay: Version: 1.9 - SDK 10.9
    AppleAVBAudio: Version: 2.0.0 - SDK 10.9
    iSightAudio: Version: 7.7.3 - SDK 10.9
    System Software:
    OS X 10.9.1 (13B42) - Uptime: 0 days 2:40:57
    Disk Information:
    WDC WD1001FALS-40K1B0 disk0 : (1 TB)
    EFI (disk0s1) <not mounted>: 209.7 MB
    XooS5 HD (disk0s2) /: 999.35 GB (189.85 GB free)
    Recovery HD (disk0s3) <not mounted>: 650 MB
    OPTIARC DVD RW AD-5670S 
    USB Information:
    Apple Inc. Built-in iSight
    Canon CanoScan
    Apple Computer, Inc. IR Receiver
    Apple Inc. BRCM2046 Hub
    Apple Inc. Bluetooth USB Host Controller
    FireWire Information:
    WD My Passport 071D 800mbit - 800mbit max
    EFI (disk1s1) <not mounted>: 209.7 MB
    disk1s2 (disk1s2) <not mounted>: 2 TB
    Boot OS X (disk1s3) <not mounted>: 134.2 MB
    Thunderbolt Information:
    Kernel Extensions:
    com.f-secure.kext.fsauth          (1.0.0d1)
    Problem System Launch Daemons:
    [failed] com.apple.wdhelper.plist [REMARK: this abnormality appeared only after running CleanMyMac. It does not appear on my 2011 MacBook]
    Problem System Launch Agents:
    Launch Daemons:
    [loaded] com.adobe.fpsaud.plist
    [invalid] com.bjango.istatlocaldaemon.plist [REMARK: this abnormality pre-existed to running CleanMyMac. It appears also on my 2011 MacBook]
    [loaded] com.f-secure.fsavd.dbhelper.plist
    [loaded] com.f-secure.fsavd.plist
    [loaded] com.f-secure.fsmac.firewall.plist
    [loaded] com.f-secure.fsmac.fsupdated_guts2.plist
    [loaded] com.f-secure.fsmac.licensetool.plist
    [loaded] com.macpaw.CleanMyMac2.Agent.plist
    Launch Agents:
    [loaded] com.babylon.activation.plist
    [loaded] com.bjango.istatlocal.plist
    [loaded] com.f-secure.relauncher.plist
    [loaded] com.f-secure.trasher.plist
    User Launch Agents:
    [loaded] com.adobe.ARM.[...].plist
    [loaded] com.google.keystone.agent.plist
    [loaded] com.macpaw.CleanMyMac2Helper.diskSpaceWatcher.plist
    [loaded] com.macpaw.CleanMyMac2Helper.scheduledScan.plist
    [loaded] com.macpaw.CleanMyMac2Helper.trashWatcher.plist
    User Login Items:
    iTunesHelper
    Dropbox
    F-Secure Anti-Virus for MAC
    3rd Party Preference Panes:
    Flash Player
    Internet Plug-ins::
    FlashPlayer-10.6: Version: 11.9.900.170 - SDK 10.6
    Default Browser: Version: 537 - SDK 10.9
    AdobePDFViewerNPAPI: Version: 11.0.04 - SDK 10.6
    AdobePDFViewer: Version: 11.0.04 - SDK 10.6
    DivXBrowserPlugin: Version: 2.1
    Flash Player: Version: 11.9.900.170 - SDK 10.6
    OfficeLiveBrowserPlugin: Version: 12.2.8
    Google Earth Web Plug-in: Version: 6.1
    QuickTime Plugin: Version: 7.7.3
    iPhotoPhotocast: Version: 7.0
    User Internet Plug-ins::
    Picasa: Version: 1.0
    Bad Fonts:
    None
    Old applications:
    None
    Time Machine:
    Skip System Files: NO
    Mobile backups: OFF
    Auto backup: YES
    Volumes being backed up:
    XooS5 HD: Disk size: 930.71 GB Disk used: 753.90 GB
    Destinations:
    XooS5 TM [Local] (Last used)
    Total size: 2 
    Total number of backups: 32
    Oldest backup: 2013-09-15 01:11:39 +0000
    Last backup: 2013-12-07 12:48:45 +0000
    Size of backup disk: Too small. Backup size 2  < (Disk used 753.90 GB X 3)
    Time Machine details may not be accurate. All volumes being backed up may not be listed.
    REMARK: The above finding is unlikely to be accurate. In fact, my Time Machine is supported by a 2TB WD My Passport Studio external HD connected with a Firewire 800. As mentionned, only 754GB of the 2000GB are used.
    Top Processes by CPU:
    5%          backupd
    5%          Mail
    5%          WindowServer
    3%          Finder
    3%          Dropbox
    Top Processes by Memory:
    1.60 GB          mds_stores REMARK: this item was marked in red in the outcome of EtreCheck, so I assume there is something wrong there
    82 MB          Finder
    74 MB          Mail
    49 MB          softwareupdated
    49 MB          Dropbox
    Virtual Memory Statistics:
    97 MB          Free RAM
    1.21 GB          Active RAM
    1.19 GB          Inactive RAM
    1.21 GB          Wired RAM
    1.83 GB          Page-ins
    36 MB          Page-outs
    Please find now some additional measurements collected with iStat while running EtreCheck:
    Practically:
    The iMac can work slowly with only one software e.g. either Mail or Safari or Firefox, but still the below "out of Memory" message occurs about every 3 minutes.
    Aperture has becomre to slow to be useable
    If trying to write a mail (with Mail) while Safari or Firefox is open, then the "out of Memory" message occurs about every 20 seconds so I need to check on "Resume" several times per minute.
    Conclusions
    From the above, unless anyone in the Apple Support Community proves to be able to identify a specific problem leading to a way to find a cure, I tend to conclude that Mavericks is not suitable for computers operating with a Core 2 Duo CPU even with a 8GB of RAM.
    Unless I missed something, I did not see any warning from Apple Computer Inc. informing their customers they should refrain from upgrading Core 2 Duo Computers.
    The only solution I see so far is to downgrade from Mavericks to Mountain Lion. And the Apple Support Community would confirm that it is the only solution, I would appreciate to get your guidance on how to proceed.
    Intended action plan
    Migrate the above 2009 iMac to a 2014 Mac Mini Server operating on Mavericks to ensure that no data may be lost while downgrading to Montain Lion.
    Provided the above downgrading operation is successful, assign this 2009 iMac to partial retirement e.g. Mail, Skype, iTunes  and DVD player.
    In advance, I would like to thank the Apple Community for helping me either i) finding a cure to the problem, ii) or confirming that Mavericks cannot operate properly on Core 2 Duo computers, iii) and in such a case, guiding me on how to downgrade to Mountain Lion.
    Yours sincerely
    Core

    ... what anti-virus would you recommend using?
    Use what is already included with OS X. It already includes everything it needs to protect itself from viruses and malware. Keep it that way with software updates from Apple.
    A much better question is "how should I protect my Mac":
    Never install any product that claims to "speed up", "clean up", "optimize", or "accelerate" your Mac. Without exception, they will do the opposite.
    Never install pirated or "cracked" software, software obtained from dubious websites, or other questionable sources. Illegally obtained software is almost certain to contain malware.
    Don’t supply your password in response to a popup window requesting it, unless you know what it is and the reason your credentials are required.
    Don’t open email attachments from email addresses that you do not recognize, or click links contained in an email:
    Most of these are scams that direct you to fraudulent sites that attempt to convince you to disclose personal information.
    Such "phishing" attempts are the 21st century equivalent of a social exploit that has existed since the dawn of civilization. Don’t fall for it.
    Apple will never ask you to reveal personal information in an email. If you receive an unexpected email from Apple saying your account will be closed unless you take immediate action, just ignore it. If your iTunes or App Store account becomes disabled for valid reasons, you will know when you try to buy something or log in to this support site, and are unable to.
    Don’t install browser extensions unless you understand their purpose. Go to the Safari menu > Preferences > Extensions. If you see any extensions that you do not recognize or understand, simply click the Uninstall button and they will be gone.
    Don’t install Java unless you are certain that you need it:
    Java, a non-Apple product, is a potential vector for malware. If you are required to use Java, be mindful of that possibility.
    Disable Java in Safari > Preferences > Security.
    Despite its name JavaScript is unrelated to Java. No malware can infect your Mac through JavaScript. It’s OK to leave it enabled.
    Block browser popups: Safari menu > Preferences > Security > and check "Block popup windows":
    Popup windows are useful and required for some websites, but popups have devolved to become a common means to deliver targeted advertising that you probably do not want.
    Popups themselves cannot infect your Mac, but many contain resource-hungry code that will slow down Internet browsing.
    If you ever see a popup indicating it detected registry errors, that your Mac is infected with some ick, or that you won some prize, it is 100% fraudulent. Ignore it.
    Ignore hyperventilating popular media outlets that thrive by promoting fear and discord with entertainment products arrogantly presented as "news". Learn what real threats actually exist and how to arm yourself against them:
    The most serious threat to your data security is phishing. To date, most of these attempts have been pathetic and are easily recognized, but that is likely to change in the future as criminals become more clever.
    OS X viruses do not exist, but intentionally malicious or poorly written code, created by either nefarious or inept individuals, is nothing new.
    Never install something without first knowing what it is, what it does, how it works, and how to get rid of it when you don’t want it any more.
    If you elect to use "anti-virus" software, familiarize yourself with its limitations and potential to cause adverse effects, and apply the principle immediately preceding this one.
    Most such utilities will only slow down and destabilize your Mac while they look for viruses that do not exist, conveying no benefit whatsoever - other than to make you "feel good" about security, when you should actually be exercising sound judgment, derived from accurate knowledge, based on verifiable facts.
    Do install updates from Apple as they become available. No one knows more about Macs and how to protect them than the company that builds them.
    Summary: Use common sense and caution when you use your Mac, just like you would in any social context. There is no product, utility, or magic talisman that can protect you from all the evils of mankind.

  • How to make a layer from the ADF pivot table invisible , show-hide column-row-data

    Hello all ,
    I need to create a pivottable with ADF 12c for reporting purposes.
    I have a table or view with 10 items of type VARCHAR2 , C1,C2,C3,C4,C5,C6,C7,C8,C9,C10  and   10 items of type NUMBER N1,N2,N3,N4,N5,N6,N7,N8,N9,N10
    The items of type VARCHAR2 are for Column and Row areas and the items NUMBER are for Data Areas
    I want to create a jsf page with one empty pivottable and in code Show or Hide the items in the Column area , Row area , Data area
    Con you send me a small sample ?
    I test with this code that i find in oracle OTN but not work.
    <dvt:pivotTable id="pt2" value="#{bindings.WebPivotDataView1.pivotTableModel}" var="cellData"
    varStatus="cellStatus" splitMode="enabled"
    binding="#{backingBeanScope.CmfPivotBean.pivotTable}"
    >
    <dvt:headerCell>
    <af:switcher facetName="#{cellData.layerName}" defaultFacet="Default" id="s1">
    <f:facet name="DataLayer">
    <af:outputText value="#{cellData.label}" id="ot1"/>
    </f:facet>
    <f:facet name="C01">
    <af:outputText value="#{cellData.dataValue}" id="ot2"/>
    </f:facet>
    <f:facet name="Default">
    <af:outputText value="#{cellData.dataValue}" id="ot3"/>
    </f:facet>
    </af:switcher>
    </dvt:headerCell>
    <dvt:dataCell>
    <af:switcher facetName="#{cellStatus.members.DataLayer.value}" defaultFacet="Default" id="s2">
    <f:facet name="N01">
    <af:outputText value="#{cellData.dataValue}" id="ot4">
    <af:convertNumber groupingUsed="false"
    pattern="#{bindings.WebPivotDataView1.hints.N01.format}"/>
    </af:outputText>
    </f:facet>
    <f:facet name="Default">
    <af:outputText value="#{cellData.dataValue}" id="ot5"/>
    </f:facet>
    </af:switcher>
    </dvt:dataCell>
    </dvt:pivotTable>
    DCBindingContainer bindingContainer = (DCBindingContainer)ADFContext.getCurrent().getRequestScope().get("bindings");
    CubicBinding cubicBinding = (CubicBinding)bindingContainer.findCtrlBinding("WebPivotDataView1");
    CubicEditor cubicEditor = cubicBinding.getCubicEditor();
    cubicEditor.removeLayer(DataDirector.ROW_EDGE, 0); //remove 1st row edge
    cubicEditor.removeLayer(DataDirector.COLUMN_EDGE, 0); // remove 1st column edge
    cubicEditor.removeDataItem(0);
    CubicDefinition def;
    def = cubicBinding.getProjection();
    LayerDefinition layerDefinition = new LayerDefinition("C3");
    cubicEditor.addLayer(DataDirector.ROW_EDGE, 0, layerDefinition);    
    LayerDefinition layerDefinition2 = new LayerDefinition("C4");
    cubicEditor.addLayer(DataDirector.COLUMN_EDGE, 0, layerDefinition2);
    DataItemDefinition def3 = new DataItemDefinition("N1");
    cubicEditor.addDataItem(def3);
    AdfFacesContext.getCurrentInstance().addPartialTarget(pivotTable);
    Can you help me if is possible to create a pivottable binding to a one ViewObject and in code show/hide or compose the layout of the pivottable ??
    I search in google and OTN oracle and not find any code.
    Only find the code of the samples that is very complex for me , the code of the samples create the PivotTableModel from one Array , and i want to binding from one ADB BC ViewObject.
    Thanks in advance

    The solution I presented for your use case an DOAG 2013 was to create a pivot table binding out of user defined attributes from the table. For the defined attributes a VO is dynamically created as well as the pivot binding. The pivot binding is then exchanged at runtime together with the activation of the dynamic VO needed to only get the data needed for the particularly pivot table.
    Your solution using the CubicEditor is hard to implement due to the missing documentation. This was the reason I did not follow this approach, However it's not impossible (done it on a very small scale).
    None of the solution are what I call simple. They are complicated, complex and in part not supported solution (exchanging the pivot table binding at runtime need to use internal classes, which is not supported).
    I can't give you a working sample as it's too complex. I can make the slides available, however they are in German.
    Timo

  • TS4002 I'm trying to create a new apple-id but when typing the email adress I want to use I'm told that the particular email adress is not allowed but when searching I can't find same being used. How do I find out where that particular email adress is use

    I'm trying to create a new apple-id but when typing the email adress I want to use I'm told that the particular email adress is not allowed When searching I can't find same being used anywhere. How do I find out where that particular email adress is used so I can delete it there and use it for my new apple-id?

    Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
    iOS: Wrong passcode results in red disabled screen                         
    If recovery mode does not work try DFU mode.                        
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings        
    For how to restore:
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: How to back up     
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload most iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store        
    Also
    If you have Find My iPhone enabled, you can use Remote Wipe to erase the contents of your device. If you have been using iCloud to back up, you may be able to restore the most recent backup to reset the passcode after the device has been erased.

  • How can you find out an individual image size from multiple images on a canvas

    This is probably a really really simple question but I can't for the life of me find how I can find out an individual image size from multiple images on a canvas. eg I have 3 photos i want to arrange 1 large and the other two next to it half the size. How can I edit individual image size on the canvas as when I select the image on a sperate layer I want to resize it just resizes the entire canvas and not the individual image
    Thanks

    I want to know they exact dimensions though. You can get them by dragging to the 0,0 corner and then reading off of the ruler scale on the sides but its fiddily as you have to zoom right in and work it out. I know in photoshop there is a ruler but is there any other way in Elements?

  • Can't figure out where NullPointerException is coming from

    I will attach the code I have below. It is almost entirely done but i am getting a NullPointerException that is driving me nuts, and I can't figure out were it is coming from.
    Help is greatly appreciated.
    First code:
    import java.util.Scanner;
    import java.io.*;
    import java.util.Random;
    import java.util.Collection;
    public class DistributionPlagiarist
         public static void main(String[] args) throws IOException
              Scanner keyboard = new Scanner(System.in);
              int keyLength=0, phraseLength=0, numberOfPhrases=0;
              String inputFileName="", keepReadingFromFile="", theFile="";
              FrequencyLibrary text = new DenseFrequencyLibrary();
              if(args.length != 4)
                   System.out.println("The command line arguments you entered do not match what is needed.  Please try again.");
                   System.exit(0);
              for(int count=0; count<args.length; count++)
                   keyLength = Integer.parseInt(args[0]);
                   phraseLength = Integer.parseInt(args[1]);
                   numberOfPhrases = Integer.parseInt(args[2]);
                   inputFileName = args[3];
              if(keyLength < 0)
                   while(keyLength < 0)
                        System.out.print("The length of the key (" + keyLength + ")" + " you entered is less than zero.\nPlease enter another key length: ");
                        keyLength = keyboard.nextInt();
                        System.out.println();
              if(phraseLength < 0)
                   while(phraseLength < 0)
                        System.out.print("The desired length of the phrase (" + phraseLength + ")" + " you entered is less than zero.\nPlease enter another phrase length: ");
                        keyLength = keyboard.nextInt();
                        System.out.println();
              if(numberOfPhrases <= 0)
                   while(numberOfPhrases <= 0)
                        System.out.print("The desired number of phrases (" + keyLength + ")" + " you entered is not applicable.\nPlease choose another number: ");
                        keyLength = keyboard.nextInt();
                        System.out.println();
              File file=new File(inputFileName);
              boolean exists = file.exists();
              if (exists == false)
                   while(exists == false)
                        System.out.println("The file you are searching for does not exist.  Please place it in this programs directory.");
                        System.out.print("Please re-enter the file name: ");
                        inputFileName = keyboard.nextLine();
                        file=new File(inputFileName);
                        exists = file.exists();
              int count=keyLength, start=0, stop=0;
              FileReader freader = new FileReader(inputFileName);
              BufferedReader inputFile = new BufferedReader(freader);
              while(keepReadingFromFile != null)
                   keepReadingFromFile = inputFile.readLine();
                   if(keepReadingFromFile == null)
                        break;
                   else
                        theFile = theFile + keepReadingFromFile;
              while(count < theFile.length())
                   String name = theFile.substring(start, keyLength+stop);
                   char singleCharacter = theFile.charAt(count);
                   text.add(name, singleCharacter);
                   start++;
                   stop++;
                   count++;
              int countNumberOfPhrases=0;
              while(numberOfPhrases > 0)
                   countNumberOfPhrases++;
                   String phrase = randomphrase(text, phraseLength, keyLength);
                   System.out.println("Phrase " + countNumberOfPhrases + ":\n" + phrase);
                   numberOfPhrases--;
         private static String randomphrase(FrequencyLibrary textLibrary, int phraseLengthToMake, int startLength)
              String startString="";
              char characterToAdd=' ';
              startLength++;
              Random generator = new Random();
              int sizeOfLibrary=textLibrary.size()/2, randomInt = generator.nextInt(sizeOfLibrary+1), value=0;
              Collection<String> stringNames = textLibrary.makeStringCollection();
              for(String stringFromCollection : stringNames)
                   if(randomInt == value)
                        startString = stringFromCollection;
                   value++;
              String thePhrase = new String(startString);
              System.out.println("INITIAL START:" + startString + "TTTT");
              int substringStart=1;
              while(startLength < phraseLengthToMake)
                   characterToAdd = textLibrary.randomUniformChoose(startString);
                   thePhrase = thePhrase + characterToAdd;
                   System.out.println("CHARACTER:" + characterToAdd + "TTTT");
                   System.out.println("PHRASE:" + thePhrase + "TTTT");
                   startString = thePhrase.substring(substringStart, thePhrase.length());
                   boolean answer = textLibrary.contains(startString);
                   System.out.println(answer);
                   System.out.println("NEW STRING:" + startString + "TTTT");
                   startLength++;
                   substringStart++;
              return thePhrase;
    }Second code:
    import java.util.Collection;
    import java.util.HashMap;
    public class DenseFrequencyLibrary implements FrequencyLibrary
         private HashMap<String, MultiSetOfChar> bookTitleAndCharacterAndIntegerHashMap = new HashMap<String, MultiSetOfChar>();
         private MultiSetOfChar keyAndValuePairs = new DenseMultiSetOfChar();
          * Creates a new DenseFrequencyLibrary with all the essential things clear;
         DenseFrequencyLibrary()
              bookTitleAndCharacterAndIntegerHashMap.clear();
          * Input the value from the creation of the DensneMultiSetOfChar into a HashMap.  If the key
          * already exists then the value associated with it is updated by one.
          * @param character a char to be used in forming the HashMap
          * @return characterMap
         private HashMap<String, MultiSetOfChar> inputIntoMap(String name, char character)
              if(!bookTitleAndCharacterAndIntegerHashMap.containsKey(name))
                   keyAndValuePairs = new DenseMultiSetOfChar(character);
              else
                   keyAndValuePairs.add(character);
              this.bookTitleAndCharacterAndIntegerHashMap.put(name, keyAndValuePairs); //input character and value
              return bookTitleAndCharacterAndIntegerHashMap; //return the new HashMap
          * Returns the number of books in the library.
          * @return |b|, ie the number of books in b
        public int size()
             int numberOfBooks=bookTitleAndCharacterAndIntegerHashMap.size();
             return numberOfBooks;
         * Searches the library for an occurrence of a given book
         * @param target the name of a book to be searched for in the library
         * @return true if and only if the argument is already a book title in the library.
        public boolean contains(String target)
             boolean bookIsInLibrary=false;
             if(bookTitleAndCharacterAndIntegerHashMap.containsKey(target))
                  bookIsInLibrary = true;
             return bookIsInLibrary;
         * Returns the MultiSetOfChar that represents the occurrences of the individual characters
         * in the text of the book indicated by the argument.
         * @param target
         * @return MultiSetOfChar
        public MultiSetOfChar getFrequencies(String target)
             MultiSetOfChar frequencyMultiSetOfChar = bookTitleAndCharacterAndIntegerHashMap.get(target);
             return frequencyMultiSetOfChar;
         * Modifies the character occurrences associated with name to include one more occurrence of element.
         * @param name string of the name of the book
         * @param element character to add to the specified book
        public void add(String name, char element)
             bookTitleAndCharacterAndIntegerHashMap = inputIntoMap(name, element);
         * Modifies the character occurrences associated with name to include one less occurrence of element.
         * @param name string of the name of the book
         * @param element character to be removed from the specified book
         * @return true if and only if the book is modified.
        public boolean remove(String name, char element)
             boolean characterWasRemovedFromBook=false;
             //if the target character is in the map then remove it
              if(bookTitleAndCharacterAndIntegerHashMap.containsKey(name))
                   MultiSetOfChar keyAndValuePairs = bookTitleAndCharacterAndIntegerHashMap.get(name);
                   keyAndValuePairs.remove(element);
                   characterWasRemovedFromBook = true; //set answer to true because the HashMap was changed
              else //target does not exist in the HashMap
                   characterWasRemovedFromBook = false; //set answer to false because the HashMap was not changed
             return characterWasRemovedFromBook;
         * Returns a random character, chosen from the same distribution as the characters appear in the book.
         * For example, if 5% of the characters in "Alice in Wonderland" are an 'A', then this method should
         * return an 'A' about 5% of the time.
         * @param name string of the name of the book to search through and remove a character
         * @return true if and only if the argument is already a book title in the library.
         public char randomUniformChoose(String name)
            MultiSetOfChar keyAndValuePairs = bookTitleAndCharacterAndIntegerHashMap.get(name);
            char randomCharacter = keyAndValuePairs.randomUniformChoose();
              return randomCharacter; //return the random character pulled out
         public Collection<String> makeStringCollection()
              Collection<String> stringCollection = bookTitleAndCharacterAndIntegerHashMap.keySet();
              return stringCollection;
    }Third code:
    import java.util.HashMap;
    import java.util.Set;
    import java.util.Collection;
    import java.util.Random;
    * DenseMultiSetOfChar implements MultiSetOfChar.
    * @mathmodel b is a finite multiset
    * @mathdef
    *  |b| is the cardinality of b
    *  ||c,b|| is the number of occurrences of element c in b
    * @author Kyle Hiltner
    public class DenseMultiSetOfChar implements MultiSetOfChar
         private char characterInput=' ';
         private HashMap<Character, Integer> characterMap = new HashMap<Character, Integer>();
          * Create a new DenseMultiSetOfChar with zero argument
         DenseMultiSetOfChar()
              characterMap.clear(); //clear static HashMap
          * Create a new DenseMultiSetOfChar with the passed in value.
          * @param newChar character input to be added to the HashMap
         DenseMultiSetOfChar(char newChar)
              this.characterInput = newChar; //set characterInput to the value passed in
              characterMap = inputIntoMap(this.characterInput); //call private procedure to add characterInput to HashMap
          * Input the value from the creation of the DensneMultiSetOfChar into a HashMap.  If the key
          * already exists then the value associated with it is updated by one.
          * @param character a char to be used in forming the HashMap
          * @return characterMap
         private HashMap<Character, Integer> inputIntoMap(char character)
              //if the character is not in the HashMap then add it with the starting value of 1
              if(!characterMap.containsKey(character))
                   characterMap.put(character, 1); //input character and value
              else //character does exist
                   int value = characterMap.get(character); //get the value for the specified key
                   value++; //increase the value so as to show that another character was added
                   characterMap.put(character, value); //place the character and new value in the HashMap
              return characterMap; //return the new HashMap
          * Returns the number of elements in this multiset (ie its cardinality).
          * Note that since multisets can include duplicates, the cardinality may be
          * larger than the number of distinct elements. Also, the total number of
          * items in the multiset is bounded above by Integer.MAX_VALUE.
          * @return |b|, ie the cardinality of b
         public int getCardinality()
              int totalElementsInMap=0;
              Collection<Integer> integerCollection = characterMap.values(); //create a collection for easy iteration
              //iterate through each value in the HashMap and compute the total number of elements in the HashMap
              for(Integer valueFromCollection : integerCollection)
                   totalElementsInMap = totalElementsInMap + valueFromCollection; //compute new value of total values
              return totalElementsInMap; //return the final total value
          * Returns the number of occurrences of a given element in the multiset. A
          * simple identity relating getElementCount and getCardinality is that the
          * sum of getElementCount for each char is equal to the cardinality of the
          * set.
          * @param target
          *            char to be counted in the multiset
          * @return ||target,b||, ie the number of occurrences of target in b
         public int getElementCount(char target)
              int numberOfGivenCharacters=0; //set initial value
              //if the HashMap contains the target character then numberOfGivenCharacters is set to the value
              if(characterMap.containsKey(target))
                   numberOfGivenCharacters = characterMap.get(target); //set numberOfGivenCharacters to the value assigned to the target character
              return numberOfGivenCharacters; //return the value for the target character
          * Returns a set such that every element in the multiset is in the set (but
          * no duplicates). The cardinality of the returned set must be less than or
          * equal to |b|. The cardinality of the two are equal if and only if b
          * contains no duplicate elements.
          * @return a set of Character, s, such that: <br />
          *         (for all (Character)i in s : (char)i in b) and <br />
          *         (for all (char)i in b : (Character)i in s)
         public Set<Character> getElementSet()
              Set<Character> characterSet = characterMap.keySet(); //create a Set from the keys of characters in the HashMap     
              return characterSet; //return the character Set
          * Adds a single element to the multiset. This operation always increases
          * the cardinality of the multiset by 1, assuming that the maximum capacity
          * of Integer.MAX_VALUE has not been reached.
          * @param item
          *            the char to be added to b
          * @requires |b| < Integer.MAX_VALUE
          * @alters b
          * @ensures b = #b union {item}
         public void add(char item)
              characterMap = inputIntoMap(item); //call the private method to add new character (item) to the HashMap
          * Removes the target, if it is present in the multiset. The method returns
          * true if and only if it changes the multiset.
          * @param target
          *            the char to be removed
          * @alters b
          * @ensures (target not in #b) ==> (b = #b) <br />
          *          (target in #b) ==> (b union {target} = #b)
          * @return target in #b
         public boolean remove(char target)
              boolean answer=false; //set initial value to false
              //if the target character is in the map then remove it
              if(characterMap.containsKey(target))
                   int value = characterMap.get(target); //find the value associated with the target character
                   //if the value is 1 call remove from the HashMap and remove key and value
                   if(value == 1)
                        characterMap.remove(target); //remove key and value from the HashMap
                   else //value is greater than 1
                        value--; //decrease value to show removal
                        characterMap.put(target, value); //replace target character with new value back into the HashMap
                   answer = true; //set answer to true because the HashMap was changed
              else //target does not exist in the HashMap
                   answer = false; //set answer to false because the HashMap was not changed
              return answer; //return answer
          * Returns a char chosen randomly based on the contents of the multiset.
          * This operation does not remove the char from the multiset or change the
          * multiset in any way. In particular, the cardinality of the multiset is
          * the same before and after this method.
          * <p>
          * Characters should be returned with a random distribution equal to the
          * distribution of characters in the multiset. That is, for a character that
          * appears N times in a multiset of cardinality M, the probability of that
          * character being returned is N / M. For example, a multiset that contains
          * only the character 'a', possibly many times, would always result in an
          * 'a' being generated. On the other hand, a multiset with an equal number
          * of 'a' and 'b' elements would return an 'a' approximately half the time
          * and a 'b' the other half.
          * @requires |b| >= 1
          * @return char c with probability p, where: <br />
          *         p = ||c,b|| / |b|
         public char randomUniformChoose()
              char randomCharacter=' ';
              Random generator = new Random();
              int totalElementsInMap=0;
              Collection<Integer> integerCollection = characterMap.values(); //create a collection for easy iteration
              //iterate through each value in the HashMap and compute the total number of elements in the HashMap. 
              //Do this in case a remove call was made
              for(Integer valueFromCollection : integerCollection)
                   totalElementsInMap = totalElementsInMap + valueFromCollection; //compute new value of total values
              int randomInt = generator.nextInt(totalElementsInMap+1), lowerValue=0, upperValue=0;
              Collection<Character> keyCollection = characterMap.keySet();
              //iterate through each value in the HashMap and compute the total number of elements in the HashMap
              for(Character keyFromCollection : keyCollection)
                 upperValue = upperValue + characterMap.get(keyFromCollection);
                 if(randomInt == upperValue)
                      randomCharacter = keyFromCollection;
                 if(randomInt >= lowerValue && randomInt <= upperValue)
                      randomCharacter = keyFromCollection;
                 lowerValue = upperValue + 1;
              return randomCharacter; //return the random character pulled out
    }The Error:
    Exception in thread "main" java.lang.NullPointerException
         at DenseFrequencyLibrary.randomUniformChoose(DenseFrequencyLibrary.java:137)
         at DistributionPlagiarist.randomphrase(DistributionPlagiarist.java:146)
         at DistributionPlagiarist.main(DistributionPlagiarist.java:112)I will attempt to explain what this does in as few words as possible. For a breakdown of the lab go urlhttp://www.cse.ohio-state.edu/~paolo/teaching/494MJ/labs/lab8.shtml{url}. If you don't feel like reading that: THe program reads in some command line arguments. From there it reads from the file provided in the command line and creates "keys" from the specified length. From there I need to create a phrase of the specified length. If i am supposed to create more then one then i do. That is pretty much it. I can't figure out where (really why) the NullPointerException error is coming from.
    Help is appreciated!!

    Post the actual error text (copy and paste, don't "interpret" it) here.
    It should include a stack trace which references a line number of the program -
    unless you suppressed the trace, in which case change your error handling
    so that the trace is produced.
    Identify which program line in your post the error is pointing to so that we can match
    the error with your program, since your post doesn't have line numbers..
    Edited by: ChuckBing on Nov 16, 2007 7:19 PM
    Also - posting large amounts of code (as you did) will reduce the chance of anyone helping

  • IDCS5-win. Error while running a script from indesign(not via estk)

    Hi all,
    After running the script from indesign, I get following error
    ASSERT '(engine->getDebugFlags() & ScScript::kExtendedErrors) == ScScript::kExtendedErrors' in ..\..\..\source\components\script\javascript\JavaScriptRunner.cpp at line 412 failed.
    ..\..\..\source\components\script\javascript\JavaScriptRunner.cpp (412)
    any idea about this?
    The script runs fine when run from ES tool kit.
    Thanks

    Hi,
    My colleague found the problem. We were using extendables library and we still haven't figured out what was actually happening, but removing it solved the problem.

  • How to find out who's texting you from an iCloud email address?

    how to find out who's texting you from an icloud email address?

    OK after a bit of research I found a way to achieve this.
    I simply looked up the email address in ADUC, then did a search in SP with the display name. I could locate the list and manually confirm it was configured with the incoming email address I was looking for.
    I also found the below script on Stackoverflow, but got "The 'using' keyword is not supported in this version of the language." when I tried to run it. Any idea how to fix that? I'd like to have a script to link a library to an email address istead of the
    manual approach described above.
    http://stackoverflow.com/questions/4974110/sharepoint-how-do-i-find-a-mail-enabled-list-if-i-only-have-the-email
    $SiteCollection = ""
    $EmailAddress = "" # only the part before the @
    # Load SharePoint module if not done yet
    if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) {Add-PSSnapin Microsoft.SharePoint.PowerShell;}
    cls
    using System;
    using Microsoft.SharePoint;
    namespace FindListByEmail
    class Program
    {a
    static void Main(string[] args)
    string siteUrl = $SiteCollection;
    string email = $EmailAddress;
    using (SPSite site = new SPSite(siteUrl))
    foreach (SPWeb web in site.AllWebs)
    try
    foreach (SPList list in web.Lists)
    if (list.CanReceiveEmail)
    if (list.EmailAlias != null && list.EmailAlias.Equals(email, StringComparison.InvariantCultureIgnoreCase))
    Console.WriteLine("The email belongs to list {0} in web {1}", list.Title, web.Url);
    Console.ReadLine();
    return;
    finally
    if (web != null)
    web.Dispose();

  • I can not take out the DVD RW disc from the drive PIONEER DVD-RW DVRTS09

    I have a iMac 2010.
    I can not take out the DVD RW disc from the drive PIONEER DVD-RWDVRTS09
    Disk inside the computer. But there is no information about it on the desktop and server tools "Disk Utility"
    What should I do?
    Restart Computer literacy is already done
       Firmware revision: Q90B
       Connection: ATAPI
       Supports recording: Yes (drive supplied Apple)
       Cache: 2000 KB

    Restart computer while holding down continuously on the left click button of the mouse. Continue to hold until the disk is ejected.

  • I need to know how to get a particular photo from my iPhoto library that is backed up on Time Machine.

    I just backed up my whole computer on an external drive with Time Machine.  I wanted to clean off my old files from my computer, but I didn't want to erase them until I knew I could go back and get particular items from the back-up.  For example if I clean out my iPhoto libraries, how would I go get the libraries once they are on the external drive.
    I want to clean out my photos without having to put them all on CD's.  Can I use an external drive as my drive I save everything to not just for a system back-up.  Or is there a better way to store my photos rather than CD's so I can clean-up some memory space on my internal drive.

    ttown wrote:
    I just backed up my whole computer on an external drive with Time Machine.  I wanted to clean off my old files from my computer, but I didn't want to erase them until I knew I could go back and get particular items from the back-up.
    No, No, No, a thousand times, no!
    Pardon the dramatics, but don't do that.  Time Machine will, sooner or later, delete the backup copies of anything that's no longer on your Mac. 
    Plus, of course, if you delete the originals, you no longer really have backups (backup = an extra copy in case something happens to the original). 
    Your best bet might be to get a larger internal HD for your Mac.  Second best would be to get another external HD, format it for a Mac, and move some stuff (perhaps your entire iPhoto library) to it, and let Time Machine back up both your internal HD and the new external.

  • I want to find the image tag name from Image layer name InDesign JavaScript?

    I want to find the image tag name from Image layer name InDesign JavaScript?

    Hi,
    You can use following script to fetch image tag name and the layer name on which it lie:
    var imgBox = app.activeDocument.rectangles // fetch all rectangular frames from the active document
    for(var i = 0; i< imgBox.length; i++)
      if(null != imgBox[i].associatedXMLElement )
                var b = imgBox[i]
               alert("Image tag name "+imgBox[i].associatedXMLElement.markupTag.name + "\n exist on layer " + imgBox[i].itemLayer.name)
    Hope this would help you to resolve your problem.

  • How do I determine the size of an object on a particular layer?

    Whether it's a rectangle, circle, line, etc. how do I determine what the size of an object is on a particular layer?

    Right click on the rulers and set the scale to pixels in the dialog
    Go to View>new guide and select the position of the guide lines along horizontal and vertial axes
    Window>info brings up the Info Palette. The information in the right lower corner provides a readout of any selection that you make, e.g. with the marquee tool
    View>grid allows one to bring up a non-printable grid which is useful for orientation. The grid can be set up with subdivisions to suit via Edit>preferences>guides and grid
    You can open a duplicate layer at the top of the stack, then using the brush tool create a straight line for visual projection. The layer can be deleted at any time. To create a straight line, click on the begin point, hold down the shift key, and click on the end point
    Hope that one of these options is useful for your purpose. Please post your progress.

  • Create Smart Object /Frame Layer from open file in PSE8?

    I'm loving the trial version of PSE 8.  Several features that I don't want to live without!
    One thing that I find more difficult is creating a Smart Object or a Frame Layer (did those get replaced?) from an open file.  Because I digital scrapbook in different aspect ratios (12x12 for print and 15x9 for my photo frame) I want to maintain independent resolution of my pictures so I can change the crop, size etc.  My regular process (pse6) is to open a bunch of pictures and elements (papers, embellishments, etc), adjust the pictures as I desire (usually Smart Fix, plus a little midtone contrast), drop the elements into a blank file or template from the layers palette so they will not be frame layers, but drop the photos in from the Open Files bin as Frame Layers.  Then I simply resize the frame itself to match what I want on the page, and adjust the picture inside the frame.
    With PSE 8 I found I can drop a file from "Show Files from Organizer" and they will become Smart Objects (File: Place works too).  However, they have to be saved first, and I often don't save all my changes.   I would like to be able to create a Smart object or Frame Layer from an open file.
    Also, is there any way to change the size/zoo of the picture within a Smart Object?    Or crop it?  If not, does this really mean I have to crop my file, save it, and then add it as a Smart Object?  Ugh.  (Or create a rectangle for each SO and group them to form a clipping mask, I suppose. Either is a pain).
    Any recommendations for a better workflow that maintains independence?
    Thanks,
    Lisa

    Thank you!  This is very timely as I've been playing around with digital scrapbooking a lot more.  I've been having luck with using a grouped layer to "crop" the photo.  This way I can actually crop out what I know I'll never use, but use the layer mask to keep some edges that I might want around.
    Do you have any opinion on whether it's better to use a smart object or not?  I'll try both, I guess, and see what it does to my file size.
    Lisa

Maybe you are looking for

  • Audiobook chapters by same author messed up in the Finder?

    When I "show in finder" on a music track the track will show up in iTunes Media/ Music/ Artist/ Album - all very neat and as it should be! However with an audiobook, where I have many audiobooks by the same author, then "show in finder" takes you onl

  • Creation of index putting to_char in

    Hi Trying to create inxde on concatentated columns and it is putting to_char on by default trying to make index numeric column but even to_number in front not putting to_number on Using 11.2.03 Tried create index MEDIA_PLIS_HANDLED_IDX on MEDIA TO_NU

  • Word Wrapping JLabel

    I'm having trouble getting JLabel's to word wrap. I've tried using html tags. Is there any way I ca do this? What I'm trying to do is read in from a file, get Questions and Answers, and display quesitons and answers to a JLabel using setText(). The d

  • How can I get help to fix I messaging on my I pod touch

    Hi this is Kaitlyn now if I sign in to messaging will it work or not let me sign in

  • Service entry sheet reversal

    Hi to All How to reverse a service entry sheet in MM module?