Quick and Dirty Calculator - Can It Be Done?

I'm making a calculator. I've looked into my options, stacks, postfix, or just using someone else's class. But one idea struck me as more interesting than the others, but while I've programmed plenty, I by no means consider myself a veteran, and I need a little help from you guys and gals.
Is there any way to use Java's own expression evaluator in making a calculator?
I imagine this would be possible by creating a new File by the name of TemporaryClass.java, and having the program write the expression in class form in TemporaryClass.java, for example...
class TemporaryClass
   public TemporaryClass(){
      double x = /* Program writes expression here */ ;
      /* Something class writes x to xValue.dat */
}... and then I would have my main program read in the number printed in xValue.dat, and then it's all Double.parseDouble() from there.
But that's too much of a pain. Is there any simpler way to have java do the work for me, without forcing me to dissect an expression myself?
Thanks in advance,
Scott

i wrote a program similar to this once
you would give it a mathematical expresion in the form of a String (i.e. "3 + 4 * 3") and it would give you an answer
i couldn't find a way to do it so i had to write my own program that would break apart the string and convert it into a mathematical expresion. i did this by using the order of operations (parenthesis, ^, *and/, +and-). i would search for each of the operators in the string using the indexOf(char) method. when i found the appropriate operator i would find the two numbers that were on either side of it, and convert them into doubles using the Double.parseDouble(String method) i would than apply the operator to the two numbers and reconstruct the string with the appropriate answer. i would repeat this using all of the operators until there were no more operators left and than i would call Double.parseDouble(String) one last time to give me a final double answer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Is there any quick and dirty way to determine what something will look like

    Hi,
    Is there any way (rule of thumb) to determine what something will look like when printed.
    for example.
    I am doing a composite (hope this is the right word). It will have some people sitting at a table and I want to have another layer with another picture behind it.
    I plan for the output to be fairly small (print size), say 4 x 5 or whatever.
    Now, if I go to the internet and google (or mamma.com) and search for images (large) and it comes back to me, I will see pictures that are (for example) 800 x 526 pixels 367 kb, or 940 x 480 pixels 166 kb.
    I would have to assume the 367 kb will print at better resolution, but if i liked the 166 kb picture better, is there a quick and dirty way to determine if it would print better (say 250 or 300 dpi or whatever) or not?
    So, bottome line,
    Assume my output picture will be 4 x 5 (and I want 300dpi (or is it ppi)
    How do quickly look at google results and determing if they will print ok?
    Bob

    The closest to a one click fix in photoshop cs-cs5 is
    Image>Adjustments>Shadow/Highlight or opening the
    image through camera raw and using the recovery slider.
    http://help.adobe.com/en_US/photoshop/cs/using/WSfd1234e1c4b69f30ea53e41001031ab64-765da.h tml
    MTSTUNER

  • HT1535 I would like to move my songs from my ipod nano back on to my freshly reinstalled windows and iTunes.  Can that be done?  I turned off automatic syncing so I can charge up the ipod.

    I would like to move my songs from my ipod nano back on to my freshly reinstalled windows and iTunes.  Can that be done?  I turned off automatic syncing so I can charge up the ipod.  Help!

    You won't be able to, just by navigating out the iPod's photos folder in iTunes. You'll likely need the help of some sort of third party software to get the job done for you.  One thing you'll want to keep in mind about these photos is that they are no longer in their full resolution, but instead are scaled down thumbnail versions that were optimized for viewing on your iPod's Video smaller 2.5" LCD display.
    Here is one such product.
    http://www.macroplant.com/phonetopc/
    Google for more.
    B-rock

  • Quick and Dirty Tree Mapping

    Hi, i'm trying to do a quick and simple mapping for categories.
    Something like...
    Vector v = new Vector();
    v = PatriotmemDB.getFAQCategories();
    FAQCategoryObj catObj = null;
    String catname = null;
    int catid = 0;
    int parent = 0;
    int counter = 0;
    int prev = 0;
    Vector catTree = new Vector();
    for(int j=0;j<v.size();j++) {
    catObj = (FAQCategoryObj)v.elementAt(j);
    parent = catObj.getCatID();
    if(parent == counter) {
    if(counter == prev) {
    catTree.elementAt(counter).add(catObj);
    } else {
    catTree.elementAt(counter) = new Vector();
    catTree.elementAt(counter).add(catObj);
    } else {
    counter++;
    I know this will give an error but basically break out each parent in separate Vectors so that when i loop through them i can test and show in a select list. My table retuns below...
    categoryid catname catdesc imglink order parent
    1 DRAM DRAM NULL 0 0
    2 Solid State Drives Solid State Drives NULL 0 0
    3 USB Flash Drives USB Flash Drives NULL 0 0
    4 Peripherals Peripherals NULL 0 0
    5 Torqx Torqx NULL 0 2
    6 Zephyr Zephyr NULL 0 2
    7 Xporter XT Boost Xporter XT Boost NULL 0 3
    8 Xporter Razzo Xporter Razzo NULL 0 3
    Where the parent is the last column.
    Thanks for your help

    OK, so you have a tree, and you want to product these kind of weird vector slices of the tree, presumably as input to something else.
    How is the tree implemented? It looks like a vector of some class, in which the tree structure is implicit in the relationship of some fields of the class, but not an actual tree (composed of nodes, with directed edges between the nodes, no cycles, and a single node is identified as root). Right?
    If so, I can imagine one way to do it would be to create a Map<Integer, Vector<TheClass>> Loop through the vector, looking at each class, get the parent reference (which I take to be an integer from your example), and then look up in the map the vector identified for that integer. (If it doesn't exist, create it and add it to the map.) Then add the given class to that vector. When you're done, take the values set from the map.
    If you have an actual explicit formal tree, then I'd suggest writing a simple recursive function to span it.
    By the way, Vector is kind of long in the tooth. The more canonical List implementations these days are ArrayList or LinkedList.

  • Any way to use a quick and dirty icon like cLabel in the quick tools toolbar?

    I am a javascript cut-and-paster with ability to cobble things together.
    In previous versions of Acrobat, I had tools that were added to the toolbar using the technique shown in this script:
    app.addToolButton({cName: "MyFlattenButton",
       cLabel: "Flatten",
       cEnable: "event.rc = (app.doc != null);",
       cExec: "flattenPages();"
    That would create a toolbar button with the "icon" that read "Flatten" which is all that I needed.  I could click on it and it would flatten all pages in the document.
    I used this to create several different tools, all with different names and cLabels.
    This script still works in Acrobat XI (it adds the tool to the add-on tools list, and then I can add it from there to the quick tools toolbar).  The cLabel names show up in the add-on tools list, but not in the quick tools toolbar.  In the toolbar they all use the same generic icon (but they all work correctly).
    From reading in this forum I see that there is a way to create a custom icon but it does not look easy.  Is there any simple way to just have text appear as the icon as I used to do for earlier versions of Acrobat?
    Thanks.

    One further question...
    I found a code snippet somewhere online that attempted to deal with this issue.  That led me to this (failed) solution:
    this.importIcon("myIconFlat", "/D/J/CAD Standards/Stamps/Acrobat tools/flatten.jpg", 0);
    var flatIcon = util.iconStreamFromIcon(this.getIcon("myIconFlat"));
    app.addToolButton({cName: "MyFlattenButton",
       cLabel: "Flatten",
       oIcon: flatIcon,
       cEnable: "event.rc = (app.doc != null);",
       cExec: "flattenPages();"
    The problem there is that importIcon is not allowed from a folder-level javascript, apparently.  Would there be any way to use the importIcon part of this from the console and then cut and paste some output into the rest of the script?  Just looking for a way to get the icon into my script.

  • Quick and Dirty "Chapters" with DVD Studio Pro?

    Ok, so here is my workflow:
    I have a project in FCP.  It's one large 60 minute file broken into segments from start/stop in my timeline.
    - I am going to export this to a quicktime reference file (uncompressed, 10bit)
    - Then use Compressor to turn the uncompressed movie file into MPG and AC3 video and audio format
    - Import the mpg and the ac3 into DVD Studio Pro as a track, set to play on dvd start
    - then burn the DVD
    My question is, is there any quick way to lay down chapter markers where the segments are so that when I put the DVD into a regular DVD player I can just skip to the next clip with the DVD remote?  (My source is one large 60 minute file with about 30 start/stop points in FCP)
    I just want to be able to scan the disc in the DVD player with the remote control without having to use the "search/speed" buttons to manually scan all the footage.
    If this is a noob question, and I am missing something, please explain.
    - I DO know how to add chapter markers in Compressor (and FCP), but am not sure if that translates to DVD studio in the output file, and I'd really like to do it in FCP because the segment start/stop points are already in my timeline.
    Thanks!

    1st, a QT reference movie is the same compression as the original files, not uncompressed.  Once you're workign with a compression scheme (HDV, DVCPRO-HD, NTSC-DV) going to uncompressed does absolutly nothing for you, it does not add quality, just gives you larger than nessisary file sizes.  If you export, use either a QT reference movie (there is no choice of compression scheme), or a ProRes QT.
    If you want the best quality, go directly from the FCP Timeline to Compressor, don't export anything.
    If your chapter markers in FCP are Chapter markers, go directly to Compressor, use one of the DVD preset folders, the chapter markers will translate into DVD SP.  You can than use DVD SP's automated chapter menu function to get things done fast, create Stories for more complex functioning, etc.
    This is old, FCP/Compressor parts may be outdated now, but the DVD SP part is still valid.  Shows that functioning I'm talking about.
    http://bbalser.com/tutorials_long/DVDSP/DVDSP_Full_Orig.mov.zip

  • Quick and dirty sound advice...

    ...bit off topic I know but:
    Filming just the service part of a friends wedding tomorrow. With their little Sony Handycam, hiding in a bush for sake of discretion. Want to put a mic by the couple so you hear them, not the bush rustling.
    I have an ECM personal mic and a lollypop/reporter mic both XLR, and a tiny Audio Technica personal mix which is mono mini jack.
    Has anyone got some quicky kludges to attach any of those mics to the camera. No idea what camera but I imagine it has one of those wee plug-in-power sockets...
    Thanks, in advance, for your wisdom
    Tall Jim

    For backing up:
    I save my tapes
    On disc I put music, Livetype/Soundtrack files, pictures etc
    I put my project files
    I don't bother with the render files; I can just render them out later
    If you have been circumspect with properly logging your reels, you can re-build everything with Capture Project

  • Time Capsule, Airtunes, and Apple TV - can it be done?

    Hi,
    Long-time lurker, second-time poster!
    Here's my situation:
    I have a huge amount of music (all Apple Lossless, so it takes up loads of space) spread over a MacBook Pro and a Windows laptop.
    I'd like to move everything to a Time Capsule acting as a network drive (so it's all in one place and to free up HD space on my laptops), then put the Time Capsule through my AirPort Express into my music system. From what I've read, this seems to be possible, but still means having to have a laptop switched on to navigate my library in iTunes.
    Is there some way to use the Time Capsule/Airtunes solution with Apple TV, so I can browse my music collection on the telly and then play it through my stereo, without needing to use a laptop?
    I don't use iTunes for video - only music - so hopefully that will make things simpler....
    Thanks in advance for any advice!

    Imagine the combined unit with synchronised audio/video streaming to an external sound system - even the wireless iPod touch could join the party with Apple TV as the central digital hub. A product like this would be as big a revolution as the iPod itself! Price tag, i'd pay up to £500 for such a device - what do you reckon?
    At home I'm using an Epson HD projector instead of a Hi-Def TV. All that's missing is wireless, synchronised audio (to the AEX which connects by optical cable to my Apple Hi-Fi, remember those?). The TV here is my old G4 iMac and EyeTV. Elgato disappoints though, they still haven't enabled MPEG-4 HD as we're using in Europe and elsewhere. I just love the swivel screens of the old iMacs, so convenient. Unfortunately I have way too much digital material to fit on an Apple TV so I'm not buying one until the hard disk space increases, then I'll shift all the content from the G5 onto AppleTV and couple it with a 1TB Time Capsule. That's the plan at least

  • HP Designjet 130, Dlink DNS 323 and OS X-can it be done?

    I'm trying to use a D-Link DNS 323 to share my 130 with my MacBook Pro and PC. The PC setup was easy, but whenever I try to add the Samba shared printer in OS X (10.4.8), it shows "Kind" as Local System V Printer, which doesn't give me any control over paper, color, etc. Basically useless for my needs.
    I've been having to manually find the driver since OS X won't display the 130 in it's printer list, so it's possible I'm pointing it to the wrong driver file, but I can't seem to figure out where I should point it to.
    The printer does not appear to be supported by GIMP print or any of the other free drivers, so I fear I may be up a creek here.
    Any ideas? I really don't want to invest in a JetDirect card at this point...

    The DesignJet 130 is supported by www.printfab.net.
    Unfortunately not free.

  • Blurring out MULTIPLE and moving faces-Can this be done?

    Hi-
    I need to work on a project that will entail blurring out the faces of a few people running in and out of a room. So it's the nightmare of multiple moving faces!!!
    Any ideas?
    Oh, and the sequence is about 45 minutes long!!!!!

    What's wrong with Andy's region Blur, Dina?
    The answer is yes, you can mask and blur faces in Motion, however you don't want to create a 45 minute project in Motion - that's not what it's good at. It's made for short segments...
    Patrick

  • I have iTunes on 2 PC's. Somehow I wound up with 2 Apple ID's. I would like to combine the music and apps under one ID so that I can synch with my iPhone 4 and iPad. Can this be done?

    I had a WIndows XP desktop and Laptop. Each had iTunes installed. When moving from iPhone 3 to 4, I acquied a second Apple ID. I want to migrate all of my playlists, downladed songs, podcasts and apps to my new sesktop (HP 64-bit, WIndows 7) and make that my headquarters for iPhone and iPad 1. Is it even possible to combine my media and get it together on my hand-elds? If yes, please enlighten. Thanks in advance.

    I think I will do this.  I will use my apple ID and set face time and message to work independently.  That solves one problrem.  My other problem and maybe my bigger problem is that if I am using my apple ID, how do I iflter all of this so that my kids don't see my contacts, get my apps, etc. ?

  • Best quick and dirty export format for roughcuts

    They'll be going up on vimeo.  Currently using H264, but filesizes are not small.  Cant use FLV for vimeo, was wondering for opinions are the best format for quick encoding and small filesize (quality not such an issue)
    thanks!

    are you saying reducing the size makes no difference to filesize?
    Correct.  The bit rate determines how much data is available to create the image in the frame.  If it's a small frame size, the data goes a long way and the picture quality is good.  If the frame size is big, then the data gets spread very thin and the picture quality is bad.  So a higher bit rate = bigger file = better picture quality for larger frame sizes.
    Regardless of frame size, only the bit rate and duration determine the size of the video file on disk.
    Jeff

  • Favicon, iWeb SEO tool and Safari. Can it be done?

    I have successfully create a favico.iso file and uploaded it directly to my web server and placed it in the root folder. Works fine in Firefox but doesn't show in Safari. How can I get it to work in Safari? I use Rage iWeb SEO tool. Can SEO be used? Rage forum for SEO tool says it can't work? Anyone found a way?
    Thanks in anticipation

    You can add a favicon via an HTML snippet on each page with the following code:
    JAVASCRIPT FOR ADDING FAVICON TO WEB PAGE W/O EDITING
    <script type="text/javascript">
    var head = parent.document.getElementsByTagName("head")[0];
    var favicon = parent.document.createElement("link");
    favicon.rel = ("shortcut icon");
    favicon.href = ("URL TO FAVICON LOCATION");
    head.appendChild(favicon);
    </script>
    Thanks to Koeklin from this topic:
    http://discussions.apple.com/thread.jspa?messageID=11234670#11234670
    OT

  • Quick and DIRTY Canon S90 lens correction

    From ACR 6.1 choose the Canon G10 profile, make it the default for the S90, set Distortion slider to 85, CA slider to 105, Vignette left at default 100.  I picked the values examining a 6mm (widest) brick wall image, then checked tracking for other focal lengths.  Does a surprisingly good job, certainly adequate for 99% of my S90 images.
    Richard Southworth

    LR does not ship with a separate profile for each body, against each lens. The camera model info here, AFAICT just notifies you what camera the lens was mounted on, when the profile was created.
    The same profile can quite happily work for other camera models too - even so far as, automatically extracting just the relevant middle coverage out of a FF lens profile, to correct images taken from a crop sensor body with the same lens mounted. (This will of course not work the other way around).
    The profile's aim is to characterise the lens optical performance, which does not per se change when you move it between cameras - (although this may not be quite 100% precise, e.g. in terms of vignetting off microlenses etc, it is normally quite good enough IMO). In the past, profiles used to address CA as well, and I believe this issue was more sensor dependent (the newer LR CA correction does not depend on the profile).
    If the need is a critical one, then your individual lens copy and your individual camera body can be used to "close the loop", and generate an empirically "perfect" custom profile. It's not very hard to print out and photograph the special targets, and then run the free DNG Profile utility; you can put as much or as little effort as you like into the number of focal lengths and apertures that you include. But if the supplied standard profile is good enough to save you that trouble altogether, it may not matter that it is not the theoretical best.
    AFAICT, the installed / downloaded profile is likely more subject to LENS sample variation (between your lens, and the one used to make the profile) - than, anything to do with using a different camera model.
    RP

  • Cut and Paste in emails and SMS?  Can it be done?

    Can you cut and paste from emails or SMS? Can you forward SMS's? Thanks

    If you would like to send feedback on the iphone, this link might help.
    http://www.apple.com/feedback/iphone.html

Maybe you are looking for

  • Jabber plan to replace WebEx Connect and CUPC

    Can someone from Cisco articulate the roadmap plan for WebEx Connect Client Cisco Unified Presence Client ...in light of the FCS availability of 'Jabber Branded' clients for everything now? Are there subsequent releases planned? I thought WebEx Conne

  • Unable to run ALBPM Ant tasks on Linux

    Hi, I am trying to execute a simple build script that creates a session with given directory details and deploys/publishes a project on to the Enterprise Server. With usual modifications, this scripts works fine on Windows, but on Linux it keeps on g

  • Flash Pro debugging on Nexus 7 via USB didn't work - at first.

    I had a wonderful day so far. Although I have debugged on my Nexus 7 in the past, today it just didn't want to work. Perhaps there are some bugs to be found here, but I'll leave that up to Adobe to decide. I'd already been testing an app on my Droid

  • UCCX 9.0 HR delete filters

    Hi, We have UCCX 9.0 after deleting some agents, CSQs and Teams, they still found at UCCX HR filter. How can we totally remove that? they won't be used any more. Regards. Mohamed Helmy

  • Windings in my emails

    Does anyone know how to eliminate the Wingdings that show up in the body of an email?  This occurs typically at apostrophes.  Very annoying.