Proper way to distribute sample code?

I am about to release my first java package. What is the proper way to distribute the sample code? Should I place the source code in a jar file? Or a zip file? Yes I realize that a jar file is just a zip file but should my sample code have a zip or jar extension? Or maybe I should not put them in a jar / zip file at all??

How long is a piece of string?
If the program has a small number of classes you could get away with copying the class files. If you use a zip file then the user has to unzip.
I recommend using a jar file. There's a jar tutorial on this site somewhere. There are a few "gotchas" in building jars but re-reading the tutorial helps.

Similar Messages

  • What is the proper way to compile c++ code from the terminal?

    I'm using:
    g++ char.gpp
    And I get:
    ld: library not found for -lcrt1.10.6.o
    collect2: ld returned 1 exit status
    So I tried setting LIBRARY_PATH to a directory that contains crt1.10.6.o, but then I get:
    ld: warning: in char.gpp, file was built for unsupported file format which is not the architecture being linked (x86_64)
    Undefined symbols:
      "_main", referenced from:
          start in crt1.10.6.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    So clearly I am not picking up the right library, or perhaps just not all the libs needed. Why is this so hard? I haven't seen problems like this with earlier versions of Xcode.
    I'm using the latest version of Xcode on a MacBook Pro with Lion installed.
    Thanks,
    Kim

    d'oh! I think you're right. I clearly don't know what I'm doing.
    OK, so if I name the file .cc (it really IS a c++ file), the problem then becomes:
    char.cc:1:20: error: iostream: No such file or directory.
    So how is the compiler supposed to be instructed where to find the header files? I thought if it was properly installed, this would be set up correctly already.
    BTW: the file I'm trying to compile is short:
    #include <iostream>
    int main()
        char c;
        std::cin >> c;
        std:: cout << "the value of '" << c << "' is " << int(c) << '\n';
    It's code straight from the Stroustrup book.
    Thanks,
    Kim

  • Exist an easy way to convert base64 code in XML files into the original image file on forms

    I've made a form in lifecycle that will be distributed by email as a pdf, and submitted back to me as an XML file and then that data imported into the pdf form template to view the data. Issue is I have an "attach image" field on the form and in XML it gets written to a base64 encoded format. Is there convenient way to extract this code from the XML file so that I would have a workable jpeg image file that I can save and open in other apps? Thank you in advance!  -Robert Tampa

    I tried to make John Brinkman's sample working in reverse.
    This script will grab an image field's value and produce an attachment (png-file), which then can be saved to the hard drive.
    //Get Base64 data of the image field
    var b64Data = ImageField1.value.image.value;
    //Convert to a read stream
    var ReadStream = util.streamFromString(b64Data);
    //Decode from Base64
    var DecodedStream = Net.streamDecode(ReadStream, "base64");
    //Attach an empty image file
    event.target.createDataObject("MyExportImage.png", "", "image/png");
    //Update attached image file with stream data
    event.target.setDataObjectContents("MyExportImage.png", DecodedStream);
    //Show attachment pane
    event.target.viewState = {overViewMode:7};
    This works so far, but the produced images are always cutted off.
    No idea what's the reason for this behavior.

  • Legalities of using sample code

    Hi there
    just downloaded
    http://labs.adobe.com/technologies/textlayout/demos/
    This is so very very awsome - just wanted to check
    "Adobe permits you to use, modify, and distribute this file
              in accordance with the terms of the Adobe license agreement
              accompanying it." - ok - couldednt find any licence accompaning ti and when i looked around I only got to the SDK licences mozilla and adobe.
    This sample code is kinda what I was looking towards for a project im working on - (well perhaps a reduced version of it).
    Its obviously taken some one a stack of time to get this editor right.
    I was wondering if there was any other agremeents apart for the SDK ones which apply to "editing" and using this sample code?
    Just dotting the I's and crossing the T's before diving in.

    Th source code is in the JDK as an example of the use
    of the invocation API. Its pretty trivial stuff, so I
    can't see why you shouldn't use it.
    There's lots of java code in the JDK for that same
    reason: if we weren't supposed to look at it/use it,
    why is it there ?There is a difference between the reasonable, the moral and the legal.
    You specifically can not take a class out of (for example), src.zip, modify it slightly and then use it as you see fit. That is what the license says legally.
    I am rather certain that any lawyer who is familar with software law in the US will tell you that you can't use it.
    The application of the legal penalty is up to Sun though. And a reasonable person might guess that Sun will not follow up on this. But if Sun did have a problem with a company/product for some other reason and that company/product was using code like this then it would provide Sun a further way to challenge the company/product. And the law on usage like this is rather specific - the defendant would have no recourse, regardless of the outcome of any other facet legal difficulties, but to pull the product from the market.
    But then I am not a lawyer. And my layman's knowledge is only relevant in the US.

  • Hi All! I want to use javaFX controles in vaadin applications pls give some sample code

    Hi All!
    I want to use javaFX 2.0 Controles in Vaadin applications please give some sample code.
    Is it possible or not .
    Regards

    Hi,
    Thanks manish for your reply but i could not get any help from your suggesion because i have know idea in Java.
    I want to know how can we deploy jsp files in Oracle bpel.
    Because i'm not getting the proper way to deploy jsp files in oracle bpel.
    Can any one help me out by providing step by step information or suggest any url to resolve this.
    Regards,
    Nikhil Kumar Jain

  • How to create a database for sample code from Tutorial/Book?

    I want to try out the sample code from [http://shop.oreilly.com/product/0636920013471.do] for the book SQL Pocket Guide 3rd Ed.
    I have downloaded the oracle vm/appliance for oracle 11g2 and I have started sqlplus as sysdba.
    I'm feeling overwhelmed with these links describing how to create a database:
    [http://www.adp-gmbh.ch/ora/admin/creatingdbmanually.html]
    [http://tldp.org/HOWTO/Oracle-7-HOWTO-3.html]
    [http://www.adp-gmbh.ch/ora/admin/creatingdbmanually.html]
    (1) What is the command to list the existing databases?
    (2) What is the command to delete an existing database?
    (3) When creating a new database with the create database command, is it necessary to specify the logfile, character set, national character set, datafile, sysaux datafile, undo tablespace, temp table space? Do these have reasonable defaults? I'm not sure what proper directories are to specify for Linux and the examples are for windows.
    Can someone give me a simplified create database command to create a database called 3rdEdPocketGuide? Should I follow the example at [http://tldp.org/HOWTO/Oracle-7-HOWTO-3.html] and instead of orcl use 3rdEdPocketGuide?
    (4) What command do I use to execute the script that comes with the book SQL Pocket Guide 3rd Ed? This is the script that has all the drop table, create table and insert commands in it.
    (5) What command do I use in sqlplus to set the current default database prior to running this script? Perhaps this is the connect command? I don't want my script to create tables in the system database.
    (6) I tried the command "connect 3rdEdPocketGuide" and it prompted for a password! Yikes! What password? Do I need to specify a password when I create a database? I cannot tell if I have successfully created such a database or it is just prompting me for a password to thwart malicious users. Is it is possible to create databases which don't require a password or maybe a zero length password?
    Thanks
    Siegfried
    Edited by: user8816970 on Sep 26, 2012 12:01 PM
    Edited by: user8816970 on Sep 26, 2012 12:18 PM

    user8816970 wrote:
    Paul,
    Thanks! I tried changing my profile name to siegfried but I'm not seeing the change...
    Anyway, I'm trying your suggestion to use SQL Developer which was already installed in the virtual box appliance and I cannot figure out how to get a connection.
    When I use the defaults of sid=xe, port=1521, hostname=localhost and specify
    username=sysdba
    password=
    I get status: failure - test failed: listener refursed connection with the following error: ORA 12505, TNS: listener does not current know of sid given.
    So I try sid=orcl and that works better: status: failure - test failed: ORA-01017: invalid username/passowrd; login denied
    OK, sqlplus let me in with out a password, why does not this work?
    So I try checking the box for "OS Authentication" and I get the same error!
    Hoek: I tried searching the documentation and found "3 Exploring Oracle Database with SQL Developer" at http://docs.oracle.com/cd/E11882_01/appdev.112/e10766/toc.htm but following those directions did not help. Can you be more specific? The directions were for a tutorial and I need to know what the passwords are for the database set up with [http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html|http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html] . I also found [http://docs.oracle.com/cd/E11882_01/appdev.112/e10766/tdddg_connecting.htm#CEGHFHIG|http://docs.oracle.com/cd/E11882_01/appdev.112/e10766/tdddg_connecting.htm#CEGHFHIG] but that did not help either.
    Everyone:
    Do I need to create a user using SQL*Plus first so I can login with "Oracle SQL Developer" so I create my database called? What would be the "create user" command I would execute?
    OK, so I run sqlplus and issue these commands
    create user siegfried identified by abc ;
    grant connect to siegfried ;
    connect siegfried/abc;
    Now, how do I create a database? In Microsoft SQL Server one has to create a database first and if you just start creating tables without creating a database first, the tables will be created in the system database and this is usually undesirable.
    Sometimes a database is known in the java connection string as the catalog. Is there any such analog in oracle SQL plus?
    So now what do I do? I want to create a bunch of tables using my script I downloaded from 3rd Ed SQL Pocket Guide. Does my new user "siegfried" have the right to create tables? I guess I could try but I don't want to create tables in the system database.
    I noticed I can also use "Oracle SQL Developer" to connect with my new "siegfried" account. It seems that I should have been able to connect with sysdba... strange.
    So now I am connected in the "Oracle SQL Developer" and I see no list of databases.
    Thanks!
    Siegfried
    >Paul,
    Thanks! I tried changing my profile name to siegfried but I'm not seeing the change...
    Anyway, I'm trying your suggestion to use SQL Developer which was already installed in the virtual box appliance and I cannot figure out how to get a connection.
    When I use the defaults of sid=xe, port=1521, hostname=localhost and specify
    username=sysdba
    password=
    I get status: failure - test failed: listener refursed connection with the following error: ORA 12505, TNS: listener does not current know of sid given.
    So I try sid=orcl and that works better: status: failure - test failed: ORA-01017: invalid username/passowrd; login denied
    OK, sqlplus let me in with out a password, why does not this work?
    So I try checking the box for "OS Authentication" and I get the same error!
    Hoek: I tried searching the documentation and found "3 Exploring Oracle Database with SQL Developer" at http://docs.oracle.com/cd/E11882_01/appdev.112/e10766/toc.htm but following those directions did not help. Can you be more specific? The directions were for a tutorial and I need to know what the passwords are for the database set up with [http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html|http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html] . I also found [http://docs.oracle.com/cd/E11882_01/appdev.112/e10766/tdddg_connecting.htm#CEGHFHIG|http://docs.oracle.com/cd/E11882_01/appdev.112/e10766/tdddg_connecting.htm#CEGHFHIG] but that did not help either.
    Everyone:
    Do I need to create a user using SQL*Plus first so I can login with "Oracle SQL Developer" so I create my database called? What would be the "create user" command I would execute?
    OK, so I run sqlplus and issue these commands
    create user siegfried identified by abc ;
    grant connect to siegfried ;
    connect siegfried/abc;
    above does NOT use SQL*Net to connect to the instance
    >
    Now, how do I create a database? In Microsoft SQL Server one has to create a database first and if you just start creating tables without creating a database first, the tables will be created in the system database and this is usually undesirable.
    Sometimes a database is known in the java connection string as the catalog. Is there any such analog in oracle SQL plus?
    So now what do I do? I want to create a bunch of tables using my script I downloaded from 3rd Ed SQL Pocket Guide. Does my new user "siegfried" have the right to create tables? I guess I could try but I don't want to create tables in the system database.
    I noticed I can also use "Oracle SQL Developer" to connect with my new "siegfried" account. It seems that I should have been able to connect with sysdba... strange.
    So now I am connected in the "Oracle SQL Developer" and I see no list of databases.SQL Developer can only connect to the instance via SQL*Net
    >
    Thanks!
    Siegfrieda database in SQL Server is same as schema/user in Oracle

  • Report Engine SDK sample code questions

    Hello,
    I've been able to view a boxi report in an iframe via the Enterprise SDK by modifying the sample code in the HowToViewWebiReports_VB example.
    I'm not totally happy with the way that's working, so I'm looking at using the Report Engine SDK, although I understand it's performance and scalability isn't quite as good as the Enterprise SDK.
    I'm a VB.NET guy, not a C# guy, and I'm not clear on how the wssdk_net2.0_portal_sample_12.0_en example is supposed to work.
    I don't have one and my CMS server is running Tomcat, not IIS so there's not going to be an ASP.NET web service running there.
    In the dsws.config for the wssdk_net2.0_portal_sample_12.0_en example I put the name of the CMS server, but it's looking for a web service at http://cmsservername:8080/dswsbobje/services/Session, but I get a 404 when i try to hit that. 
    I'm not familiar with Tomcat, but in searching around on the server, I see a dswsbobje directory under the webapps in my Tomcat installation, but I don't see a services or a Session folder underneath that.  In the dswsbobje folder I see the following folders:
    BOAR-INF
    META-INF
    WEB-INF
    xsd
    Is there something else that needs to be installed on the Tomcat server to get the web service running?
    -Eric

    It looks like I have something there.  When I launch launch http://servername:8080/dswsbobje,  I see:
    Apache-AXIS
    Hello! Welcome to Apache-Axis.
    What do you want to do today?
    Validate the local installation's configuration
    see below if this does not work.
    To enable the disabled features, uncomment the appropriate declarations in WEB-INF/web.xml in the webapplication and restart it.
    Validating Axis
    If the "happyaxis" validation page displays an exception instead of a status page, the likely cause is that you have multiple XML parsers in your classpath. Clean up your classpath by eliminating extraneous parsers.
    I clicked on the "Validate" link and I see:
    Axis Happiness Page
    Examining webapp configuration
    QaaWS Configuration
    QaaWS Servlet is not valid.
    ErrorServer servername not found or server may be down
    See Web Application log to get more info or read QaaWS v2 documentation starting with section
    Perhaps this environment needs some additional configuration?

  • Simple sample code to display a Crystal Report from Crystal Enterprise?

    I am looking for a sample application that will "simply" view a report stored on our Crystal Enterprise server. I have looked at "boesdk_net_samples_12.zip", but that isn't really what I am looking for. And, the "CrystalReportViewer" and "CrystalReportSource" add ins for Visual Studio seem to only work with a "local" file (instead of one Managed or UnManaged on our Crystal Enterprise server).
    Can anyone point me to the right place? (Navigating the SAP site is so damn confusing!)

    Hi Shayne,
    You are not clear on how you will know which report you want and for which user? You can query the CMS database for the user and get all of their reports but without knowing which report object ID to get you will need to have the user select one. Unless you simply assume you want the last one, but if you don't give them a choice and they miss one day, or what ever your parameter is to select, there will be no way to get back to that report.
    For sample code on how to query the BOE Server look in the Enterpise SDK samples. You do need to use managed code. I don't suggest going into the FRS\output folder to use unmanaged reporting. There are a lot of folders created and it's easier to simply query the CMS database to get the latest instance.
    Since you have BOE you should also have a support contract. I suggest you log a case on line in Service Market Place and get a dedicated Engineer to assist you.
    This may be simply easier for you to use the Personal Favorites folder of the user so they can browse all report instances belonging to them. I suggest you talk to the BOE Administrator for more info on what BOE is capable of doing. what you want is fairly easy to manage with Enterprise itself.
    Thank you
    Don

  • What is the proper way to close all open sessions of a NI PXI-4110 for a given Device alias?

    I've found that, when programming the NI PXI-4110 that, if a the VI "niDCPower Initialize With Channels VI" (NI-DCPower pallette) is called with a device
    alias that all ready has one or more sessions open (due to an abort or other programming error) a device reference results from the reference out that has a (*) where "*" is post-fixed to the device reference where and is an integer starting that increments with each initialize call. In my clean up, I would like to close all open sessions. For example, let's said the device alias is "NIPower_1" in NI Max, and there are 5 open sessions; NIPower_1, NIPower_1 (1), NIPower_1 (2), NIPower_1 (3), and NIPower_1 (4). A simple initialize or reset (using niDCPower Initialize With Channels VI, or, niDCPower Initialize With Channels VI, etc.) What is the proper way to close all open sessions?
    Thanks in advance. Been struggleing with this for days!

    When you Initialize a session to a device that already has a session open, NI-DCPower closes the previous session and returns a new one. You can verify this very easily: try to use the first session after the second session was opened.
    Unfortunately, there is a small leak and that is what you encountered: the previous session remains registered with LabVIEW, since we unregister inside the Close VI and this was never called. So the name of the session still shows in the control like you noted: NIPower_1, NIPower_1 (1), NIPower_1 (2), NIPower_1 (3), and NIPower_1 (4), etc.
    There may be a way to iterate over the registered sessions, but I couldn't find it. However, you can unregister them by calling "IVI Delete Session". Look for it inside "niDCPower Close.vi". If you don't have the list of open sessions, but you have the device name, then you can just append (1), (2) and so forth and call "IVI Delete Session" in a loop. There's no problem calling it on sessions that were never added.
    However - I consider all this a hack. What you should do is write code that does not leak sessions. Anything you open, you should close. If you find yourself in a situation where there are a lot of leaked sessions during development, relaunching LabVIEW will clear it out. If relaunching LabVIEW is too much of an annoyance, then write a VI that does what I described above and run it when needed. You can even make it "smarter" by getting the names of all the NI-DCPower devices in your system using the System Configuration or niModInst APIs.
    Hope this helps.
    Marcos Kirsch
    Principal Software Engineer
    Core Modular Instruments Software
    National Instruments

  • Proper way to embed PDF into IE6 or 7

    Does anyone know the official proper way to embed these files?
    I have seen it this way
    [code]
    EMBED src="example1.pdf" width="450" height="450" href="example1.pdf"> /EMBED>
    [/code]
    and this way
    [code]
    OBJECT CLASSID="clsid:CA8A9780-280D-11CF-A24D-444553540000" WIDTH=728
    HEIGHT=728>  EMBED SRC="manual.pdf"
    HEIGHT=728 WIDTH=728> NOEMBED> Your browser does not support embedded PDF
    files. /NOEMBED> /EMBED>/OBJECT>
    [/code]
    Any help is appreciated.
    (I had to take out all the less-than signs becase it was trying to run the actual code.)
    thanks,
    -brett

    To send an html email, you must first build a web page (with the contents you need) then send that.
    Keep in mind that a lot of people have disabled the option to get the html so they will see garbage.
    Here is a great resource for html email design...
    http://www.mailchimp.com/resources/html_email_design.pdf

  • Sample code for creation of contact

    Creation of contact using the java api does not work as it should for me. I think i dont have the correct format for the vcard will someone help me with this!! A sample code example will be very helpfull§. I am using calander version 9.0.4.
    any additional information can be provided!
    thanks
    joyce

    Creation of contact using the java api does not work
    as it should for me. I think i dont have the correct
    format for the vcard will someone help me with this!!
    A sample code example will be very helpfull§. Hi Joyce,
    The thread "create contact returns -- CAPI_STAT_LIBRARY_INTERNAL_COSMICRAY"
    is the correct way to store a contact. Note that I just updated the thread.
    What is your problem exactly?
    Jean-Philippe

  • Sample code on how to populate data in DropDownListbox

    Hi all
    i am new to the webdynpro for java.
    i have one UI element called DropDownListBox and i want to populate some desired values to the dropdown list box.
    what are the different ways are there to populate data in DropDownList box.
    for example i have city as dropdownlist box and i want to populate some values in drop downlistbox like bangalore,hyderabad,chennai and delhi,
    can you pls send the sample code on the same?
    Regards
    Suresh Babu

    Hi,
    If you want to retrieve the city names then you can use the standard tables in R/3.
    We have countries list in T500T. Like this we have table for the cities also.
    Or
    You can manually populate a table and bind this table to the list box.
    Please check out this link -
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/ded11778-0801-0010-258f-ac3b9408a194
    http://help.sap.com/saphelp_nw70/helpdata/EN/74/450e8af57065468e88e4b86de47e4b/frameset.htm
    Regards
    Lekha

  • Sample code converting binary data to image file

    Hi experts ,
    I need sample code to convert binary data (bytes) in to an image file.
    any help will be appreciated.
    Thanks and Regards,
    Naresh

    You need to show binary and decimal?  Or now just decimal?
    If binary and decimal, you can right click on your indicator and choose "Display Format...".  If you select the Advanced Editing Mode, you can make soft interesting display formats.  This includes showing the same value in mulitple ways in the indicator.  Try something like "%032b - %d" for the format string.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Java Mapping sample code

    HI all,
    I want to learn how java mapping can be done in XI.
    I have created a javaMapping class implements StreamTransformation .
    I am not getting what code should be written in execute method. I have included all the jar files required.
    Please can anyone give me a sample code that should be written in execute method for a simple Message mapping.
    I presume we use jaxp Api for that,but I am not getting the exact way to proceed further.
    Thanks
    Yomesh

    Thanks Anad And Shridhar,
    I am able to do java mapping now.Actually I was not understanding how the input schema will be read and converted into output schema. Now I got that the DefaultHandler class's methods like startDocument EndDocument ,startElement and EndElement takes care of this. We have to just implement these methods and they are called automatically when corresponding tags are read.
    Thank You verymuch for your help,
    Yomesh

  • Proper way to exit with a j2ee java app running in the NW70 j2ee engine

    Hello,
    I am working on migrating an app and it's ear from j2ee 6.20 to 7.0. It deploys okay, but when invoked, the j2ee server restarts. Looking at the part that fails, its trying to create a jco connection, which fails and then it catches the failure and does a stack dump and a System.exit(1). It shuts down and restarts at that point. Is System.exit(1) the proper way to exit a java app that is running within the j2ee engine? If it is, is it possible I am picking up the wrong System.exit and need to use an SAP specific one? I inherited the code, but not the IDE it was written with.
    Thanks,
    Paul D. Chamberlain

    Hi,
    Answered my own question. System.exit(1) should not be used. Return works.
    Paul D. Chamberlain

Maybe you are looking for

  • How do I connect an Airport Extreme to my ISP with a static IP address?

    I have 5 static IP addresses from my ISP. The cable modem has five ethernet jacks. I run an ethernet cable from separate jacks on th cable modem to the devices listed next. I have one static IP address assigned to a Linksys wireless router for a MS n

  • Have not used subscription and can't figure out ho...

    I havent order or used this subscription  please cancel this annd refund my money,I have social security, and this keeps taking money out.I have tried emailing and I cannot find a phone number to call Skype. Please stop this subscription my phone num

  • Button or Widget to Reboot Into Windows

    The Windows utilities have a feature to click and boot into OS X. Is there a widget, or something similar, for OS X that will allow me to click and boot into Windows? I really hate having to wait around just to hold down the Option key. And, I do not

  • IE9 Disable AutoComplete for Forms Registry Setting (where is it?)

    I have tried with no success to use GP to consistently force Disable AutoComplete for forms (User Configuration\Administrative Templates\Windows Components\Internet Explorer). Using GPResult, some workstations show "disabled" when the setting is actu

  • Joindre des fichier

    J'ai iPad 3 avec écran retina. Mon problème est que lorsque je vais sur des sites pour postuler à des offres,  on me demande de transmettre mon cv . Sauf à ce moment lorsque je clique sur le lien le seul racourcis que me propose ma tablette est les p