How to use a self compiling compiler in Java

I'm creating a user-customizable calculator - a calculator where the user can create his/her own buttons while the calculator runs.
What I need to know is how I can get the calculator to compile an instruction - i.e. what a new button does, and add it to itself.
For example, and user would create a button that calculates (UK) V.A.T by writing y = (x*0.175)
This instruction would then be compiled while the calculator was running and be added to the calculator.
Thanks,
Aled.

You need to think about how the whole system is going to work - you need to know everything that the button will require, and then think about how to provide this information to the button.
So, by the sounds of you need say a single button to press when you want to add a new button to the calculator. Associated with this have text fields that take the function for the calculator. I would specify that the function uses variables e.g. x and y as in function = x * y. Then your program could parse the input string describing the function, by recognising "*" to mean * in the Java code syntax and "/" to mean /. Then treat everything else as variables. Since you can filter out the other variables i.e. not the operators, you can then say associate an array to contain the values of these. Then when the user uses the button and specifies the input parameters and presses the button, you can update this array, and perform the calculation based upon these values.
Hope this helps.
My advice really is just to think about everything that a button that creates new function buttons is going to need.
PS. Remember to repaint the GUI once update its Container. Swing does this automatically, but I always specify it explicitly anyway to be safe. You can use either repaint(), validate(), or revalidate().
Goodluck mate!

Similar Messages

  • How to use a self-signed certificate

    Hello,
    I am having some troubles understanding how to use a self-signed certificate. I have created one using Keychain Access -> Create Certificate but it never asked me for the private key and it never told me where the certificate is stored. How am I supposed to use it?
    Typically I would like to do two things:
    1) use the certificate to for example sign an email or other document so that the recipient can verify that it was really me. I understand the concept that they have to have my public key and use it to somehow decrypt something that I have encrypted with my private key. But where is my private key? As mentioned, the certificate creation process never at any point asked me to provide a private key.  An example using this process to sign an email would be really appreciated.
    2) I want to be able to decrypt a message that someone sends to me after encrypting it with my public key. Again, I need my private key, where is it? I was never asked to choose one!
    Please note that i am familiar with the whole process using openSSL ssh via command line, I just need to understand how to achieve the same thing using the certificate creation procedure provided via Keychain Access.
    In short, now thta I have created my certificate, how do I use it? Examples for dummies would be really appreciated
    Thanks  in advance
    /Andrea

    Can you import the CA cert under “Your Certificates.”, delete the CA cert, switched to “Authorities”, re-imported the CA cert, and restarted Firefox.

  • How to use of ffmpeg or jffmpeg with java

    I am creating an application in java to convert one video format to other. (eg. avi to wmv) . as JMF does not support all the video formats available today. I read on the net that I can use ffmpeg or jffmpeg together with jmf to process many video formats. but i did not get any example or guide to use ffmpeg with java. Can you plese guide me how to use this libraries with jmf. with some example or simple steps to integrate ffmpeg with jmf.
    I am using java 1.6 and jmf 2.1. eclipse IDE and windows xp professional and redhat linux.

    Can you plese guide me how to use this libraries with jmf. No.
    This is a JMF forum. 3rd party stuff like ffmpeg is not supported here.

  • How to use a VB dll file in java

    hi,
    i am working on college project,In this output of calculation is not matching with college site .So any one can tell "how to use or combine a VB 'dll' file in java?".so that i can use VB 'dll' file in java to get right Output.
    If possible write code or send it to "[email protected]"
    Thanks
    Ravi kapani

    Did you try Google? And no, there is no native support for accessing .dll files from Java. That said, take a look at JNI.

  • How to use chart engine for web dynpro java(EP) for Graphics generation.

    Hi Frndz..
    now lookiing out for different types of dynamic graphics generations according to my requirment, n i saw the followiing blog
    Testing BusinessGraphics in Web Dynpro for Java
    Itz very nice to see that we can generate planty of types, but here our server is EP 7.0(not CE 7.1) and i gone thru  these links also
    http://help.sap.com/saphelp_nwmobile71/helpdata/en/86/243f403f0a9354e10000000a155106/frameset.htm
    http://help.sap.com/saphelp_nwmobile71/helpdata/en/0b/79553b066d9414e10000000a114084/frameset.htm
    https://help.sap.com/saphelp_nw04/helpdata/en/0c/95c83956852b51e10000000a114084/frameset.htm
    here it seems to be Chart Engine n Chart Designer is mainly for BSP(R3), how best we can use this for web dyn pro java.
    Thanks in Advance
    Regards
    Rajesh

    hi
    if you want to use BusinessGraphics in WebDynpro java you have to configure IGS.
    IGS Configuration
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/4846ac90-0201-0010-099d-d3b4e271849c
    Business Graphics docs.
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/3261cd90-0201-0010-268c-d8d72e358af6
    ChartDeigner Usage
    http://help.sap.com/saphelp_nw04/helpdata/en/18/d4d43fb9490c65e10000000a114b1d/frameset.htm
    Generating Gantt chart using web dynpro business graphics

  • How to use UI Element "AbstractApplet" to embedd java applet in WDA

    Hello,
    I want to embedd a java applet in a WebDynpro ABAP application and I've found the following statement on SAP online help:
    The Active Control Framework (ACF) enables the development of applets or ActiveX-based controls that can be embedded in Web Dynpro ABAP.
    Link:[AbstractApplet|http://help.sap.com/saphelp_nwpi71/helpdata/en/47/b915bc878a2d67e10000000a42189c/frameset.htm]
    Is there any further help, how to use this (abstract) UI Element to integrate a given java applet?
    Kind Regards,
    Guido

    Hi,
    As per the link you gave,
    In the View layout, You can use the UI elements like - AcfExecute and AcfUpDownload. For upload and download the things.
    Try to use these UI elements and get the reference of the Abrstact APplet class and use the methods inside it.
    Regards,
    Lekha.

  • How to use debugproxy for debugging on AS-Java?

    Dear Sirs,
    I'd like to debug java program on AS-Java without occupying AS-Java instance.
    I expect debugproxy can help it.
    I could enable it on SAP Management Console, but I don't know how to use it with NWDS.
    Could I get instraction of using debugproxy with NWDS?
    In addition, I'm afraid that my idea is feasible and debugging always occupy AS-Java instance. It means I have to have another instance specified for debugging.
    Please advise me.
    Best regards,
    Shingo Suzuki

    Hi Shingo,
    Not always
    Check [this|SAP NW CE 7.1: Start Debug Session... vs. Enable Debugging; thread.
    HTH!
    \-- Vladimir

  • How to completely remove self-compiled programs?

    As we all know, software installed by pacman can be easily removed by
    pacman -R softwarename
    But if we download the source code from web, and install it by ourselves using
    ./configure
    make
    make install
    Then if we want to delete it, how can we make sure that this is done completely? I mean, no junk files are left.
    PS. Suppose we have deleted the source folder and cannot use
    make uninstall

    tomk wrote:
    cyker - I read your question. You wanted to know what would happen if you put 'make install' in your build function. This indicates to me that you have little or no experience using makepkg to build Arch packages, because if you had, you would know what would happen if you did that. Every single piece of relevant documentation includes the recommendation repeated by flamelab earlier in this thread. I haven't read your tutorial, but I sincerely hope that you have included it too. I have my doubts though:
    cyker wrote:Maybe DESTDIR is a good choice.
    To summarise - you are looking for a solution to a problem that does not exist when a PKGBUILD is written correctly.
    If everyone acts according to a give specification, that's fine. I won't post here. But sometimes you'll find badly-written install scripts that make compiled files scatter everywhere in your system. Of course you may make your system clean again by running make uninstall -- if
    1. The author of the code successfully manage the details
    2. You still have the source code(at least the makefile)
    So initially my question has nothing to do with makepkg. I just wonder how to make the system clean if the source code, including the makefile, is lost. This makepkg tool is just proposed as a potential solution to my problem. But I tested it and found no mechanism is provided by makepkg to prevent make install writing files outside the building folder you want. So a badly-written makefile could still make your system a mess -- makepkg won't save that!
    Even if PKGBUILD is written correctly, it is of no use. If the makefile want to write something elsewhere during installation, it still can do that.
    I appreciate all of your answers. But my problem is based on a bad source code(perhaps makefile, but not PKGBUILD). Suppose, during make install, it will write junk files to /usr, /bin, /lib, etc. You don't want that happen, right? But you may not carefully read each line of the makefile of each software you install. I want a mechanism to make the whole compilation not generate files(final binaries and intermediate files and temporary files and config files) outside the building folder so that situation can be controlled. Or it will record each file generated in any methods so that when you want to delete them, you can delete them completely.
    Last edited by cyker (2010-03-02 20:49:14)

  • How to use xcode to compile standard C prgram

    Hi all,
    I am a new developper in xcode. I have several standard C programs written by myself before.
    I have problem to open them with the new xcode (4.1 i guess). If I drag the program folder to xcode icon, nothing happens. I noticed through xcode I can start a new project or workspace, then I can add my program to it.
    However, problem still exists. e.g. my program contains several files (*.c *.h), if I select one variable and select go to the definition of it, xcode cannot find the definition.
    Besides I cannot debug neither run the program in xcode.
    Normally I compile my codes with gcc or icc in terminal, but now I am totally lost in xcode. I know my questions sound silly, hope some guys can help me out of it and I will appreciate a lot.
    Mono

    First, if you normally compile your code in the Terminal, you can keep doing that. You don't have to use Xcode.
    In Xcode 4 every program requires a project, even simple command-line programs. Create a command-line tool project. Choose File > New > New Project to create a new project. Select Application under Mac OS X on the left side of the New Project Assistant. Select Command Line Tool from the list of application projects. Click the Next button. Choose C from the Type menu. Name the project. Click the Next button. Select a location to save the project and click the Create button.
    After creating your project, add your source code files to the project. Choose Files > Add Files to ProjectName to add the files to your project. You may need to delete the main.c file Xcode created when you created the project.
    If you want to debug your project, click the Breakpoints button in the project window toolbar. Click the Run button in the toolbar to build and run your project. If you click the Breakpoints button, your program will run in the debugger. If you don't see the debug area at the bottom of the project window when running your program, choose View > Debug Area > Show Debug Area to show it. You need the debug area open to do command-line input and output in Xcode.

  • Does anyone know how to use a self signed certificate with apple mail??

    Ive read about it in mail's help and tried to set it up according to it. Ive created a self-signed certificate but have no idea how to set it up as it would work with Mail so that i would be able to send signed messages. could anyone help me??

    Hello rado:
    Welcome to Apple discussions.
    I am assuming this is what you read:
    http://docs.info.apple.com/article.html?path=Mac/10.5/en/8916.html
    If you follow the instructions when you set up the certificate, you should be fine.
    Incidentally, most +"ordinary users"+ (like me) do not use this function. I am curious as to why you want to jump through hoops in your Mail application.
    Barry

  • How to use an self-made iView in the Portal Content?

    Hi everybody,
    I followed the instructions to set up a Portal (6.0 SP 2) with the PDK. Now I just wrote a simple "Hello-World" iView and deployed it into the portal server. It worked fine when I clicked to test it in the Java Development Inspector.
    But...
    In the Portal Content I can not find my self-made iView? How do I get it there? I coudn't find any documentation.
    I'd appreciate your help!

    In the portal content try to create a new Iview and select the option (create new iview from portal Archive).
    After selecting that you will see all the PARs deployed on your server, just select yours and follow on.
    Hope that helps.
    Thanks
    Ankur

  • Guide on how to use a self programmed BAPI in Visual Composer

    Hi all,
    I am absolutely new to modelling with the Visual Composer, so probably this is a fairly easy question for most of you, but it's driving ME nuts.
    I have a BAPI in my ERP6 system. This BAPI was programmed by some other guy (not working here anymore) and it is used to output some time management data for a user. It expects a personnel number as input and is then supposed to return the amount of time an employee worked that day.
    Now what I need/want to do is this:
    a user logs on to the portal with his user-id and I want to create an iView on the first page that displays his/her remaining time of work for that day.
    All I have is the user-id, from which I need to query the personnel number from infotype105 and then use this number as input for the BAPI - And I want to do this with the Visual Composer!
    Can someone point me to some good documentation how to get started with using a BAPI in Visual Composer?
    I have a sesond problem right now, that has something to do with necessary rights for system connection or system alias - not sure:
    Right now, I can't see any BAPI in my backend-system, because I seem to be mssing the necessary rights to use the system connection I created - although group everyone has read access to the connection an I setup SSO between portal and ERP system.
    So maybe solme of you gurus might be able to point me to some good documentation on these topics, as I'm kinda stuck here
    Greetings,
       Christian

    Hi,
    Yes its very much necessary to do the user mapping untill unless if you did not do the single sign on Trust .
    It is necessary to get the data from the Back end i.e your Ssytem.
    Steps :
    Go to Useradministartion->find your VC user (using which user you are logging to the VC)->CLICK ON MODIFY->Select usermapping Tab->select the System alias ->give the credentials of the System (i.e Back end) then Save.
    After that Check the Connection Test for the Syetm you connected .
    Steps:
    System Administartion->Syste configuration->Visual Composer-> fRight Click on your Backend Sytem->select Connection test->do the connecton test .
    if the results are failed means the usermapping is wrong.
    Regards,
    Govindu

  • How to use a self signed certificate in Firefox 33

    Unfortunatly https://support.mozilla.org/de/questions/1012765 does not provied a reasonable solution for version 33
    Is there realy no other option, to use own testsites and old embedded Web-Servers, than switching to chromium?

    Can you import the CA cert under “Your Certificates.”, delete the CA cert, switched to “Authorities”, re-imported the CA cert, and restarted Firefox.

  • How to use CTS+ in PI 7.31 Java-Only?

    Hi Gurus,
    The basis colleague told me that the configuration with CTS+ is finished and I can use it to transport objects.
    In PI Test-System E03 the Tools "Export Design Objects" the Mode "Transport Using CTS" is avaiable. Everything runs well.
    Now in the Transport Organizer i can see the following status:
    How to import them into Q system? In the Quality Q03 and Product P03 systems the tool "Open CTS Transport Organizer" is deactivated.
    Are they configured correctly?
    Any helps would be highly appreciated.
    Regards
    Christine

    Hi Christine,
    I guess you have to transport it manually into Q. Do you have any system which is responsible for transporting objects?
    For our PI 7.31 we create transport requests on development stage, then we transport them via transaction STMS in Solution Manager into the next stage because for this case, this is our central transport platform.
    Your basis colleagues should know which transport domain was set up for your PI.
    Regards
    Claudia

  • How to used a JCR Data Control in Java class?

    Hi,
    I created a JCR Data Control to my UCM to obtain a treeTable with the datas. But it's impossible to create a treeTable like i want to.
    So I know how to create a treeModel to obtain the treeTable I want.
    Is there a way to used the getItems method of the dataControl in a Java Class?
    I tried this :
    BindingContext bc = (BindingContext)JSFUtils.resolveExpression("#{data}");
    DCDataControl dc = bc.findDataControl("UcmDC");
    But dc is null.
    There are some xml files (UcmDC.xml or getItems_return.xml). Is it a way to resolve my problem. And if so, how do I use?
    Best regards,
    Thomas

    please refer metalink id(305710.1)

Maybe you are looking for