Most efficient way to open a new TextEdit doc at a specific place

Suppose I've navigated in the Finder to some deep dark location in the folder hierarchy...   I want a new text file titled "notes" in this folder, i.e. to this path.
Assuming TextEdit is already open, what is the most efficient way of creating and begin adding text to a new TextEdit file in that location?
Tried this:  Maybe the usual Save dialog is aware of the current folder, so I can choose "New Document" in TextEdit's Dock icon pulldown, and then choose that path when I do File --> Save, choose the Save dialog's expanded view, and pull down the Where: selection.  Nope.  The current path is not there.
Tried this:  Keeping an empty TextEdit document named untitled on my desktop.  Drag-copying that to the current folder.  Rename the file to "notes", open it, and start editing  That works, except it is clumsy.
Is there a better way?
Please forgive me if I'm missing something incredibly obvious.

The problem with that is a new file has nothing in it.
If you save a dummy file on the desktop someplace or use a real file in each of your locations, you could right click and duplicate it, then doubleclick to open it in the program of choice.
Another option would to be to create a AppleScript that took the current open windows pathname and create and save a Textfile there.
You save the app in the Dock and only have to click on it once, it automatically quits when mission accomplished.

Similar Messages

  • Just got girlfriend a new iPad2. Her iMac is a PowerPC G5 (Tiger version 10.4.11) with 512 mb RAM. What's the simplest, most efficient way to get her iPad2 up and running and synced to her Mac?

    Just got girlfriend a new iPad2. Her iMac is a PowerPC G5 (Tiger version 10.4.11) with 512 mb RAM. What's the simplest, most efficient way to get her iPad2 up and running and synced to her Mac?

    Most of the Apple store sales people and some of the genius bar people are only knowledgable on Apple's more recent offerings. They are not very knowledgable, I found, on older PowerPC based Apple computers, I'm afraid.
    Here's the real scoop.
    Your girlfriend's G5 can only install up to OS X 10.5 Leopard. This is the last compatible OS X version for PowerPC users.
    OS X 10.6 Snow Leopard and OS X10.7 Lion are for newer Intel CPU Apple computers.
    Early iMac G5's can only have up to 2 GBs of RAM.
    Later iMac G5's (2005-2006) could take up to 2.5 GBs of RAM
    2 GBs of RAM will run OS X 10.5 Leopard just fine.
    The very latest iTunes (10.5.2) can be installed and runs on both PowerPC and Intel CPU Macs.
    However, there are certain new iTunes feature that won't work without an Intel Mac.
    One of iOS and iTunes feature is sync'g wirelessly over WiFi.
    This will not work unless you have an iDevice running iOS 5 and Intel Mac running 10.6 Snow Leopard or better.
    Although, I was disappointed I would not be able to do this with my G4 Mac, it's not a biggie problem for me.
    So, your girlfriend's computer should be fine for what she intends to use it for.
    The Apple people either just plain didn't know or we're trying to get you to think about buying a new Mac.
    At least, as of now, not truly necessary.
    If Apple, at some later point, drops support for PowerPC users running 10.5, then would be the time to consider a new or "newer" Intel CPU Mac.
    My planned Mac computer upgrade is seeking out a " newer" last version G5 for my "new" Mac.
    I can't afford, right now, to replace all of my core PowerPC software with Intel versions, so I need to stick with the older PowerPC Macs for the time being. The last of the G5's is what I seek.

  • Most efficient way to delete "removed" photos from hard disk?

    Hello everyone! Glad to have this great community to come to for help. I searched for this question but came up with no hits. If it's already been discussed, I apologize and would love to be directed to the link.
    My wife and I have been using LR for a long time. We're currently on version 4. Unfortunately, she's not as tech-savvy or meticulous as I am, and she has been unknowingly "Removing" photos from the LR catalogues when she really meant to delete them from the hard disk. That means we have hundreds of unwanted raw photo files floating around in our computer and no way to pick them out from the ones we want! As a very organized and space-conscious person, I can't stand the thought. So my question is, what is the most efficient way to permanently delete these unwanted photos from the hard disk
    I did fine one suggestion that said to synchronize the parent folder with their respective catalogues, select all the photos in "Previous Import," and delete those, since they will be all of the photos that were previously removed from the catalogue.
    This is a great suggestion, but it probably wouldn't work for all of my catalogues since my file structure is organized by date (the default setting for LR). So, two catalogues will share the same "parent folder" in the sense that they both have photos from May 2013, but if I synchronize May 2013 with one, then it will get all the duds PLUS the photos that belong in the other catalogue.
    Does anyone have any suggestions? I know there's probably not an easy fix, and I'm willing to put in some time. I just want to know if there is a solution and make sure I'm working as efficiently as possible.
    Thank you!
    Kenneth

    I have to agree with the comment about multiple catalogs referring to images that are mixed in together... and the added difficulty that may have brought here.
    My suggestions (assuming you are prepared to combine the current catalogs into one)
    in each catalog, put a distinctive keyword onto all the images so that you can later discriminate these images as to which particular catalog they were formerly in (just in case this is useful information later)
    as John suggests, use File / "Import from Catalog" to bring all LR images together into one catalog.
    then in order to separate out the image files that ARE imported to LR, from those which either never were / have been removed, I would duplicate just the imported ones, to an entirely separate and dedicated disk location. This may require the temporary use of an external drive, with enough space for everything.
    to do this, highlight all the images in the whole catalog, then use File / "Export as Catalog" selecting the option "include negatives". Provide a filename and location for the catalog inside your chosen new saving location. All the image files that are imported to the catalog will be selectively copied into this same location alongside the new catalog. The same relative arrangement of subfolders will be created there, for them all to live inside, as is seen currently. But image files that do not feature in LR currently, will be left behind by this operation.
    your new catalog is now functional, referring to the copied image files. Making sure you have a full backup first, you can start deleting image files from the original location, that you believe to be unwanted. You can do this safe in the knowledge that anything LR is actively relying on, has already been duplicated elsewhere. So you can be quite aggressive at this, only watching out for image files that are required for other purposes (than as master data for Lightroom) - e.g., the exported JPG files you may have made.
    IMO it is a good idea to practice a full separation of image files used in your LR image library, from all other image files. This separation means you know where it is safe to manage images freely using the OS, vs where (what I think of as the LR-managed storage area) you need to bear LR's requirements constantly in mind. Better for discrete backup, too.
    In due course, as required, the copied image files plus catalog can be moved bodily to another drive (for example, if they have been temporarily put on an external drive, and you want to store them on your main internal one again). This then just requires a single re-browsing of their parent folder's location, in order to correct LR's records inside this catalog, as to the image files' changed addresses.
    If you don't want to combine the catalogs into one, a similar set of operations as above, can be carried out for each separate catalog you have now. This will create a separate folder structure in each case, containing just those duplicated image files. Once this has been done for all catalogs, you can start to clean up the present image files location. IMO this is very much the laborious and inflexible option, so far as future management of the total body of images is concerned... though there may still be some overriding reason for working that way.
    RP

  • Is there a way to open a new window with one site when the home setting on Firefox has multiple websites?

    While working in Firefox is there a way to open a new window with one site when the home setting on Firefox has multiple websites?

    I guess I'm not explaining myself fully. I have a home page designation in firefox preferences that starts firefox up with 5 sites. that pretty fills up my screen with tabs.
    At some point I want to initiate another WINDOW in firefox (NOT a tab). I would like to be able to open up a window that ONLY has ONE tab, or as if there were only one site designated as the home page. This gives me a workspace that has my most useful sites available in tabs in one window, and also another WINDOW that I can move around in and even create more tabs without messing up my primary set of TABS (in my primary window). I see how this might not be doable without doing what I do now, which is open up a new window, and then close tabs until the new window just has one tab for me to work from.

  • What is the best, most efficient way to read a .xls File and create a pipe-delimited .csv File?

    What is the best and most efficient way to read a .xls File and create a pipe-delimited .csv File?
    Thanks in advance for your review and am hopeful for a reply.
    ITBobbyP85

    You should have no trouble doing this in SSIS. Simply add a data flow with connection managers to an existing .xls file (excel connection manager) and a new .csv file (flat file). Add a source to the xls and destination to the csv, and set the destination
    csv parameter "delay validation" to true. Use an expression to define the name of the new .csv file.
    In the flat file connection manager, set the column delimiter to the pipe character.

  • Most efficient way to do some string manipulation

    Greetings,
    I need to cleanse some data in a string by replacing unsafe characters with encoded equivalents. (FYI, this is for the purpose of transforming "unsafe" characters into encoded values as data inside an XML document).
    The following code accomplishes the task:
    Note that a string "currentValue" contains the data to be cleansed.
    A string, "encodedValue" contains the result.
      for (counter = 0; counter < currentValue.length(); counter++)
        addChar = (currentValue.substring(counter,counter+1));
        if (addChar.equals("<"))
          addChar = "#60;";
        if (addChar.equals(">"))
          addChar = "#62;";
        if (addChar.equals("="))
          addChar = "#61;";
        if (addChar.equals("\""))
          addChar = "#34;";
        if (addChar.equals("'"))
          addChar = "#39;";
        if (addChar.equals("'"))
          addChar = "#39;";
        if (addChar.equals("/"))
          addChar = "#47;";
        if (addChar.equals("\\"))
          addChar = "#92;";
        encodedValue += addChar;
      } // forI'm sure there is a way to make this more efficient. I'm not exactly "new" to java, but I am learning on my own with no formal training and often take a "brute force" approach with my initial effort.
    What would be the most efficient way to re-do the above?
    TIA,
    --Paul Galvin
    Integrated Systems & Services Group

    im a c++ programmer so im not totally up on these java classes either but...from a c++ stand point you might want to consider using the if else statment.
    by using if else, you only test the character until you find the actual "violating" character and skip the rest of the tests.
    also, you might trying using something to check for alphaNumeric cases first and use the continue keyword when you find one. since more of your characters are probably safe than unsafe you can skip all the ifs/if else statement and only do one test on the good characters. (i just looked for a way to test that and i didnt find one. c++ has a function that does that by checking the ascii number range. dont think that works in java. but maybe you can find one, it would reduce the number of tests probably.)
    happy hunting,
    txjump :)

  • Most efficient way to apply Paragraph Style A to Paragraph style B?

    I'm looking for the most efficient way to all
    all aspects of an existing named paragraph style "A" to another named paragraph style "B". I'd especially like to find a keyboard-only way to do this.
    To my surprise,
    Copy Special >
    Paste doesn't seem to copy tab settings...(?) This leads me to suppose that other aspects of the source p'style may not be crossing the Great Paste Divide.
    Over the years I've used a variety of more or less clumsy multi-step, multi-tool "tricks" (including third-party plug-ins) to apply one named paragraph style to another, but knowing FrameMaker as I do I suspect there may be a truly efficient way to do what I want.
    Is there?
    Cheers & thanks,
    Riley

    Arnis:
    8.0p277.
    The Font family and style got Pasted -- that was immediately apparent. And based on all I know about F'Maker, I would've thought the tabs would go over.
    But when I opened the target p'style the Tabs area was completely blank.
    I'm not sure if anything else wasn't making it 'cross the Paste Divide: Once the Tabs weren't Pasted, I fell back to a different, brute-force strategy simply to get around the problem and return to work...
    Moreover, since the structured templates I inherited for this project are full of idiosyncrasies, I'll just file this one away under "The Templates Did It" and hope for better luck the next time I try the Copy Special thing...
    Cheers & thanks for your help,
    Riley

  • Most efficient way to make an ordered list?

    Hi all,
    I have a simulation where I have agents running around in an environment. These agents need to get the closest agent near them, and they have to do this a whole bunch of times each cycle -- closest predator to them, closest prey, closest mate, next-closest mate if that one isn't interested, etc. etc.
    I realized that it would be faster if I just got all the agents in the vicinity ONCE, kept them in a sorted list, and then everytime you want the closest agent of a certain type, just search from the bottom of the list up until you find the first one of that type.
    So here's the question: to make that list, I ask the environment for all the agents in the vicinity, and then go through them one-by-one. I find out the distance between myself and that agent. I then.... what?
    I could put them all into an ArrayList, and then apply some sorting algorithm to that ArrayList. Or I can try to insert them in the right order WHILE I'm making the ArrayList. Or maybe there's some better Collection object that would be even more efficient -- somehow pushing them in and out of stacks, or whatever else smart programmers think up.
    Can anyone suggest the most efficient way to do this? This is something that every agent has to do every step, so efficiency is key.
    Thanks!
    Edit: As a note, calculating the distance between two agents isn't free, and if I either sort or insert as I'm making it, the naive implementation (i.e. the way I would do it...) would require re-checking this distance for every agent in the list every single time a new agent was added. So maybe I could make some use of a HashMap, so that I can store these distances?
    Edited by: TimQuinn on Oct 15, 2009 9:35 AM

    TimQuinn wrote:
    Ok, thanks for all the great suggestions. I think that caching the distance in a wrapper object is a big plus, and then I can run some tests and see if using a built-in collections sorting algorithm or using a treeset is faster in my specific case. Thanks!
    Any thoughts as to the idea of creating one giant map of the distance from each agent to every other agent just once, rather than having each agent work out their own distances to each other agent? I feel like this would be faster (at the expense of memory), but don't know how I'd start approaching it.Well, your idea of the Map would probably work. You would have to make some object that pairs up two agents, something like this:
    public class AgentPair {
       private final Agent a1, a2;
       public AgentPair(Agent a1, Agent a2) { //...
       public boolean equals(Object other) {
          //if distance is a symmetric operation (a.distanceTo(b) == b.distanceTo(a)) then the reverse pair should also be equal
       public int hashCode() {
          return 37*a1.hashCode() + a2.hashCode();
    }This assumes either that you don't override equals or hashCode in Agent, or that you properly override both.
    Then you would have a map that you can populate, given an array of all agents:
    Map<AgentPair, Double> distMap;
    Agent[] agents;
    for ( int i = 0; i < agents.length-1; i++ ) {
       for ( int j = i; j < agents.length; j++ ) {
          distMap.put(new AgentPair(agents, agents[j]), agents[i].distanceTo(agents[j]));
    }Alternatively, if you're not sure you'll definitely use all of the computations, you could alternatively test to see if the computation result is in the map, and if not, perform it; otherwise, use the cached result.
    Any thoughts? Should I make a new post? Abandon the idea?As always, try it and see.  Essentially, it will be faster assuming these two conditions:
    1) You would have to do more than n ^2^ (well actually n choose 2) distance calculations otherwise, and
    2) Computing the distance costs more than retrieving from distMap (this +isn't+ a given!).  If each Agent had a sequential ID, you could do a two-dimensional array of doubles which would speed up lookups.
    Edited by: endasil on 15-Oct-2009 3:39 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Most efficient way to consume log files

    Hello everyone,
    I've been absent from the forums for awhile but I'm back at it now... 
    I have a question about the most efficient way to consume log files.  I read in Powershell in action, by Bruce Payette that using a switch statement with a regex worked pretty well, that being said I haven't tried it yet. Select-string is working pretty
    well for me but I have about 10 different entry types that I need to search logs for every 5 minutes and I'm scanning about 15 GB of logs at every interval.  Anyway, if anyone has information about how to do something like that as quickly as possible
    I'd appreciate it.
    1.  piping log files that meet my criteria to select-string
       - This seems to work well but I don't like searching the same files over and over again
    2. running logs through get-content and then building a filter statement
      - This is ok but it seems to use up a fair bit of memory
    3. Some other approach that I haven't thought of yet.
    Anyway, I know this is a relatively nebulous question, sorry about that.  I'm hoping that someone on here knows a really good way to find strings in logs files quickly.
    Hope that helps! Jason

    You can sometimes squeeze out more speed at the expense of memory usage, but filters are pretty fast. I don't see a benefit to holding the whole file in memory, in this case.
    As I mentioned earlier, though, C# code will usually blow PowerShell away in terms of execution time.  Here's a rewrite of what I just did (just for the INI Section pattern, to keep the post size down):
    $string = @'
    #Comment Line
    [Ini-Style Section Line]
    Key = Value Line
    192.168.0.1 localhost
    Some line that doesn't match anything.
    Set-Content -Path .\test.txt -Value $string
    Add-Type -TypeDefinition @'
    using System;
    using System.Text.RegularExpressions;
    using System.Collections;
    using System.IO;
    public interface ILineParser
    object ParseLine(string line);
    public class IniSection
    public string Section;
    public class IniSectionParser : ILineParser
    public object ParseLine(string line)
    object o = null;
    Match match = Regex.Match(line, @"^\s*\[([^\]]+)\]\s*$");
    if (match.Success)
    o = new IniSection() { Section = match.Groups[1].Value };
    return o;
    public class LogParser
    public static IEnumerable ParseFile(string fileName, ILineParser[] lineParsers)
    using (StreamReader sr = File.OpenText(fileName))
    string line;
    while ((line = sr.ReadLine()) != null)
    foreach (ILineParser parser in lineParsers)
    object result = parser.ParseLine(line);
    if (result != null)
    yield return result;
    $parsers = @(
    New-Object IniSectionParser
    $results = [LogParser]::ParseFile("$pwd\test.txt", $parsers)
    $results
    Instead of defining separate classes for each type of line and output object, you could probably do something more generic with delegates (similar to how I used ScriptBlock.Invoke() in the PowerShell example), but it might sacrifice some speed to do so.

  • Most efficient way to get a  connection from a defined connection -pool [whole message]

    Having recently load-tested the application we are developing I noticed that
    one of the most expensive (time-wise) calls was my fetch of a db-connection
    from the defined db-pool. At present I fetch my connections using :
    private Connection getConnection() throws SQLException {
    try {
    Context jndiCntx = new InitialContext();
    DataSource ds =
    (DataSource)
    jndiCntx.lookup("java:comp/env/jdbc/txDatasource");
    return ds.getConnection();
    } catch (NamingException ne) {
    myLog.error(this.makeSQLInsertable("getConnection - could not
    find connection"));
    throw new EJBException(ne);
    In other parts of the code, not developed by the same team, I've seen the
    same task accomplished by :
    private Connection getConnection() throws SQLException {
    return DriverManager.getConnection("jdbc:weblogic:jts:FTPool");
    From the performance-measurements I made the latter seems to be much more
    efficient (time-wise). To give you some metrics:
    The first version took a total of 75724ms for a total of 7224 calls which
    gives ~ 11ms/call
    The second version took a total of 8127ms for 11662 calls which gives
    ~0,7ms/call
    I'm no JDBC guru som i'm probably missing something vital here. One
    suspicion I have is that the second call first find the jdbc-pool and after
    that makes the very same (DataSource)
    jndiCntx.lookup("java:comp/env/jdbc/txDatasource") in order to fetch the
    actual connection anyway. If that is true then my comparison is plain wrong
    since one call is part of the second. If not, then the second version sure
    seems a lot faster.
    Apart from the obvious performance-differences in the two above approaches,
    is there any other difference one should be aware of (transaction-context
    for instance) between the two ? Basically I'm working in an EJB-environment
    on weblogic 7.0 and looking for the most efficient way to get hold of a
    db-connection in code. Comments anyone ?
    //Linus Nikander - [email protected]

    Linus Nikander wrote:
    Thank you for both your replies. As per your suggestions I've improved my
    connectionhandling (I ended up implementing the Service Locator pattern as a
    matter of fact).
    One thing still puzzles me though. Which (and why) is the "proper" way to
    fetch the actual dataSource. As I stated before in the code I've seen two
    approaches within the code I've got.
    1. myDs = myServiceLocator.getDataSource("jdbc:weblogic:jts:FTPool");
    2. myDs = myServiceLocator.getDataSource("java:comp/env/jdbc/tgsDB");
    where getDataSource does a dataSource = (DataSource)
    initialContext.lookup(dataSourceName); dataSourceName being the input-string
    obviously.
    tgsDB is defined as
    <reference-descriptor>
    <resource-description>
    <res-ref-name>jdbc/tgsDB</res-ref-name>
    <jndi-name>tgs-dataSource</jndi-name>
    </resource-description>
    </reference-descriptor>
    in weblogic-ejb-jar.xml
    From what I can understand by your answer, you don't recommend using the
    JNDI-lookup way of getting the connection at all ?Correct.
    The service locator that
    I implemented will still perform a JNDI lookup, but only once. Will the fact
    that I'm talking to an RMI-object anyway significantly impact performance
    (when compared to you non-jndi-method) ?In some cases, for earlier 7.0s, maybe yes. For the very latest, it shouldn't
    hurt.
    >
    >
    In my two examples above. If i use version 1. How will the server know
    whether to give me a TX-bound connection and when not to ? In version 1
    FTPool maps to a pool with both TX and non-TX datasources. In version 2.
    tgsDB maps directly to a TX-dataSource.
    I might be asking a lot of strange questions, probably because I'm just
    getting the hang of all the resource-reference issues that EJBs are
    associated with.Bear with me ;)
    //Linus
    "Joseph Weinstein" <[email protected]> wrote in message
    news:[email protected]...
    Hi. As Jon said, the lookups are redundant. Because you showed that otherway,
    I will infer that this code is always being run in serverside code. Good.I will give you
    a third way which is much better than either of the ones you showed. Thefirst method
    you showed has a problem for all but the latest sps, your jdbc objectswill all be
    going through an unnecessary level of indirection because you are gettingan rmi jdbc
    object which talks to the jts driver object.
    The second, faster method you showed also has a serious problem! Oneshould
    never call DriverManager methods in multithreaded JDBC programs becauseall
    DriverManager calls are class-synchronized, including some small internalones like
    DriverManager.println(), which all JDBC drivers and even the constructorfor
    SQLException call, so one slow getConnection() call can inadvertantly haltall other
    JDBC being done in the whole JVM! Also, for JVMs that have lots of jdbcdrivers
    registered, DriverManager is inefficient because it simply sends your URLand
    properties to every driver it has registered until it finds one thatdoesn't throw an
    exception and returns a connection.
    Here's the fastest way:
    // do once and reuse driver object everywhere. Can be used by multiplethreads
    Driver d =(Driver)Class.forName("weblogic.jdbc.jts.Driver").newInstance();
    Then, whenever you want a connection:
    public myJDBCMethod()
    Connection c = null; // always a method level object
    try {
    c = d.connect("jdbc:weblogic:jts:FTPool", null);
    ... do all the jdbc for the method...
    c.close();
    c = null;
    catch (Exception e) {
    ... do whatever, if needed...
    finally {
    // close connection regardless of failure or exit path
    if (c != null) try {c.close();}catch (Exception ignore){}
    Joe
    Linus Nikander wrote:
    Having recently load-tested the application we are developing I noticed
    that
    one of the most expensive (time-wise) calls was my fetch of adb-connection
    from the defined db-pool. At present I fetch my connections using :
    private Connection getConnection() throws SQLException {
    try {
    Context jndiCntx = new InitialContext();
    DataSource ds =
    (DataSource)
    jndiCntx.lookup("java:comp/env/jdbc/txDatasource");
    return ds.getConnection();
    } catch (NamingException ne) {
    myLog.error(this.makeSQLInsertable("getConnection - couldnot
    find connection"));
    throw new EJBException(ne);
    In other parts of the code, not developed by the same team, I've seenthe
    same task accomplished by :
    private Connection getConnection() throws SQLException {
    return DriverManager.getConnection("jdbc:weblogic:jts:FTPool");
    From the performance-measurements I made the latter seems to be muchmore
    efficient (time-wise). To give you some metrics:
    The first version took a total of 75724ms for a total of 7224 callswhich
    gives ~ 11ms/call
    The second version took a total of 8127ms for 11662 calls which gives
    ~0,7ms/call
    I'm no JDBC guru som i'm probably missing something vital here. One
    suspicion I have is that the second call first find the jdbc-pool andafter
    that makes the very same (DataSource)
    jndiCntx.lookup("java:comp/env/jdbc/txDatasource") in order to fetch the
    actual connection anyway. If that is true then my comparison is plainwrong
    since one call is part of the second. If not, then the second versionsure
    seems a lot faster.
    Apart from the obvious performance-differences in the two aboveapproaches,
    is there any other difference one should be aware of(transaction-context
    for instance) between the two ? Basically I'm working in anEJB-environment
    on weblogic 7.0 and looking for the most efficient way to get hold of a
    db-connection in code. Comments anyone ?
    //Linus Nikander - [email protected]

  • Most efficient way to do multiple crops on many images?

    I have a large number of images shot in the default 4:3 aspect ratio. I need to print almost 200 as 4x6, and and undetermined but certainly large number as 8x10, so I have a lot of cropping to do. What would seasoned Aperture users suggest as the most efficient way to do this? I've thought of two possibilities:
    1. Duplicate every image I need to print in both sizes and crop one for each size print. This is the best option I've thought of, but it would certainly eat a lot of drive space.
    2. Do all the 8x10 crops, revert to original, and do the 4x6 crops. Saves disk space, but leave me with only the 4x6 crop in Aperture. (Sounds like I want to have my cake and eat it too, I suppose.)
    Anyway, there are a lot of you out there who have logged a lot more Aperture hours than I have. Is there a better workflow I have not considered?
    Thanks,
    Ben

    Hello Ben,
    the beauty of Aperture is, that you can have many versions of an image without needing much extra disk space.
    To have three versions of an image cropped to different aspect ratios, don't create duplicate master images but use (from the Aperture main menu)  "Photos -> Duplicate version" or "New Version from Master". Then crop this new version to a different aspect ratio. Aperture will not really render a new image file but just store the cropping rectangle to be able to create the cropped image when you export or print it.
    So you can have an original version, a 8x10 version, a 4x6 version in your library without needing much extra space - that is one of the rare occasions when you can have your cake and eat it too
    Regards
    Léonie

  • [11g] most efficient way to calculate size of xmltype type column

    I need to check the current size of some xmltype column in a BIU trigger.
    I don't think it's good to use
      length(:new.xml_data.GetStringVal());
    or
      dbms_lob.GetLength(:new.xml_data.GetClobVal());
    What's the most efficient way to get the storage size?
    I don't need the string serialized size.
    It could also be the internal storage size (incl. administration data overhead).
    - thanks!
    regards,
    Frank

    > May I ask for what reason you need to know it?
    I need to handle very large XML document output, which currently hits the internal xmltype limitation of 4GByte, when aggregating XML document fragments for this.
    > You'll get a relevant answer if you give us relevant information :
    > - exact db version
    SELECT * FROM PRODUCT_COMPONENT_VERSION;
    product
    version
    status
    1
    NLSRTL
    11.2.0.3.0
    Production
    2
    Oracle Database 11g Enterprise Edition
    11.2.0.3.0
    64bit Production
    3
    PL/SQL
    11.2.0.3.0
    Production
    4
    TNS for Linux:
    11.2.0.3.0
    Production
    > - DDL of your table
    > XML stored as XMLType datatype can use different storage models, depending on the version.
    I don't use dedicated storage clause.
    But i am hitting the problem already for aggregation into some xmltype variable in PL/SQL
    - BEFORE writing back to a result table.
    Can i avoid such problems, when writing to a table DIRECTLY w/o intermediate xmltype PL/SQL variable
    - depending on the storage clause?
    The reason why asking how to get the size of some xmltype (in table column and/or in PL/SQL variable) is, that i am thinking of a threshold detection.
    In case threshold is reached: outsource XML fragment so far to some separate CLOB storage, and insert a smaller meta-information reference representing that in the output document.
    Finally leave up to the client system to use <xs:include> (or alike) to construct the complete document.
    rgds,
    Frank

  • The most efficient way to search a large String

    Hi All,
    2 Quick Questions
    QUESTION 1:
    I have about 50 String keywords -- I would like to use to search a big String object (between 300-3000 characters)
    Is the most efficient way to search it for my keywords like this ?
    if(myBigString.indexOf("string1")!=1 || myBigString.indexOf("string2")!=1 || myBigString.indexOf("string1")!=1 and so on for 50 strings.)
    System.out.println("it was found");
    QUESTION 2:
    Can someone help me out with a regular expression search of phone number in the format NNN-NNN-NNNN
    I would like it to return all instances of that pattern found on the page .
    I have done regular expressions, in javascript in vbscript but I have never done regular expressions in java.
    Thanks

    Answer 2:
    If you have the option of using Java 1.4, have a look at the new regular expressions library... whose package name I forget :-/ There have been articles published on it, both at JavaWorld and IBM's developerWorks.
    If you can't use Java 1.4, have a look at the jakarta regular expression projects, of which I think there are two (ORO and Perl-like, off the top of my head)
    http://jakarta.apache.org/
    Answer 1:
    If you have n search terms, and are searching through a string of length l (the haystack, as in looking for a needle in a haystack), then searching for each term in turn will take time O(n*l). In particular, it will take longer the more terms you add (in a linear fashion, assuming the haystack stays the same length)
    If this is sufficient, then do it! The simplest solution is (almost) always the easiest to maintain.
    An alternative is to create a finite state machine that defines the search terms (Or multiple parallel finite state machines would probably be easier). You can then loop over the haystack string a single time to find every search term at once. Such an algorithm will take O(n*k) time to construct the finite state information (given an average search term length of k), and then O(l) for the search. For a large number of search terms, or a very large search string, this method will be faster than the naive method.
    One example of a state-search for strings is the Boyer-Moore algorithm.
    http://www-igm.univ-mlv.fr/~lecroq/string/tunedbm.html
    Regards, and have fun,
    -Troy

  • Iterators - most efficient way to get last object?

    Collection of objects, such as from an EJB, and I want to only get the last object. What is the most efficient way of doing this?
    TIA!

    addendum to previous post.
    Allthough, that test would call to mind the question what are you going to do if it is 0? Throw an exception, as the code stands it will throw an index out of bounds exception to the calling process which could be handled there, and in truth probably should be.
    Modified and expanded example
    public class ListThingie{
         java.util.ArrayList listOfThingies = null
         public ListThingie(){
              super() ;
              listOfThingies = new java.util.ArrayList() ;
              buildListOfThingies() ;
         public void buildListOfThingies(){
              //... build the ArrayList here
         public Object getLastThingie() throws IndexOutOfBoundsException{
              return listOfThingies.get((listOfThingies.size()-1)) ;
    public class ThingieProcessor{
         public static void main( String[] args){
              try{
                   ListThingie listThingie = new ListThingie() ;
                   System.out.println(listThingie.getLastThingie()) ;
              catch(IndexOutOfBoundsException e){
                   System.out.println(e.getMessage()) ;
    }There, that's better.

  • What's the most efficient way to serve a file from a servlet?

    I have a servlet that does various different things depending on the needs. Sometimes it dynamically generates content, and sometimes all it does is send a file out, with no alteration.
    What is the most efficient way to just send a file?
    One option:
    OutputStream os = response.getOutputStream();
    InputStream is = new FileInputStream(...)
    (send all the bytes from is to os, the regular way using a buffer)Another option is to say:
    RequestDispatcher rd = response.getRequestDispatcher(fileName);
    rd.forward();Any other options? What's the prefered way of doing this?
    I know the rule of "don't optimize too early" but this is a situation where we need to get the maximum amount of files served with the hardware we have, and it's going to be a lot of static files, so efficiency is important.
    Thanks

    Ok, that's what I thought. It would be nice if there were a "response.sendStream(InputStream input)" method in the ServletResponse class. Even nicer would be a sendFile or sendChannel or something. This is probably a common usage and it's a place where the container has many opportunities for optimization. For example, it could call the operating systems send_file kernel call so the entire transfer would be done directly from the disk controller to the ether card (on systems that support that).
    For now I'll just do my own buffered copy.

Maybe you are looking for

  • IPod Nano screen = white and blank

    Hey everyone. Okay, I've had my nano for about 6 months now, I bring it to school every day, and I haven't had any problems until today... I went to go turn it on to listen to it, and i notice that the screen is plain white (backlight on) with a blac

  • Can't download Developer Edition CF MX 7 for Windows

    I can download any of the other versions... Linux, AIX, even other language versions, just not Windows, English, ColdFusion MX 7... does anyone know why? Thanks in advance for your help, M ;-)

  • EDI cheques & bank statement

    Hello: i am asking the banks to print cheque on our behalf, we used program:RFFOEDI1 to send IDOC to the banks. since cheque is printed by the bank, did we maintain any cheque register (transaction code; FCHI) in SAP? if we maintained cheque register

  • How can users add their devices to Profile Manager without a user account?

    We would like to allow company devices to be tracked, inventoried and managed in Profile Manager without creating a user account for each person so they can log into /MyDevices to download the mobile profiles. We aren't staffed to have someone manage

  • How to Export keyword hierachy to flickr

    I use a keyword hierarchy to tag my photo. For instance Australia :: NSW :: Sydney In that way, I tag my picture from Sydney only with the keyword Sydney but if I look for pictures from Australia, I still get the one tagued with sydney in the search