Help! with creating a J2ME program using the http connectivity interface

So this is what I have to do using the http connectivity interface:
1.Creating two threads – one for communication (receiving and sending) and the other (main) thread will be for interaction with the user.
2.The main thread will make use of three midlet forms. The first form will ask for web page address (URL) and separately for a delimiter which will separate the words in the URL document, the third form will display the ratio of all symbols on the page and the number of occurrences of the delimiter specified
3.The second thread should perform http connectivity to the WWW, utilise the web page address supplied and connect to the appropriate web page and read its content, count all symbols on the chosen page, count the number of occurrences of the delimiter given as user input on the same form as the web page address, calculate the ratio between the two and pass this information to the first thread to display.
I have many questions but my main concerns are:
*1. How to communicate using HTTP interface within a thread*
*2. What is a delimiter in the context above and how should it be implemented*
I've been thrown in at the deep end with little programming experience with this assignment. If anyone can share a similar example or answer my concerns I'd be more than happy.
Thanks in advance.

thelane wrote:
hi thanks for the response.
As I said I have coded in other languages before, but this is a new for me in java. I needed to get it working quickley. Now I can clean up.
I will have a look at method and see how I get on.
ANy similiar examples would be great.
Thanks.I can certainly give you a similar example.
Say you have code such as this:
  int a = 10, b = 11;
  int temp = 1;
  for(int i = 2; i < a; ++i) {
   temp *= i;
  System.out.println(a + " factorial is " + temp);
  temp = 1;
  for(int i = 2; i < b; ++i) {
   temp *= i;
  System.out.println(b + " factorial is " + temp);Each section of code takes the factorial of the current variable an outputs it. The factorial code can be placed within a method to be called more easily, as such:
public void factorial(int num) {
int temp = 1;
for(int i = 2; i < num; ++i) {
  temp *= i
System.out.println(num + " factorial is " + temp);
}Then, whenever you need to call it, you can just do so:
int a=10,b=11,c=12;
factorial(a);
factorial(b);
factorial(c);

Similar Messages

  • Help with creating a movie presentation using a theme and titles

    I need to make a movie for a presentation for  work and wanted to use the 007 theme or mission impossible on the iPad 2 however I've been told you can only do it on a Mac.? Or can it be done on iMovie I can't work it out on iMovie can anyone put me in the right direction I have seen someone do one using the indianna jones theme with titles but again it was on a Mac thanks Gail

    Those themes are only on a Mac.

  • Can I create a new folder using the command line interface

    Hi.
    Is there a way to create a new folder in an existing business area, from the command-line?
    We have an application that provides an interface for the user to create a table and load flat file data into the table. After loading the data, the user will verify the loaded data using discoverer. If there is a command line interface to create a new folder, then the script that created the table can also call the discoverer command line to create a new folder for the new table. Is this possible?
    Thanks

    Hi,
    I think I am having a similar question here. I am using Oracle 10g on Windows xp.
    I logged in to Oracle from command prompt. I used command “create directory myFunDir as 'd:/funDir';”. Oracle returns: “Directory created”. But I couldn’t find the directory “myFunDir”! Where is it?
    Thanks.
    Newbie.

  • Help with creating a form, I want to add a check box to enable me to unlock certain fields and deselect the block again

    Help with creating a form, I want to add a check box to enable me to unlock certain fields and deselect the block again

    Look to the right under "More Like This". Your issue has been discussed many many times. The error you are seeing is because you do not have enough free "contiguous" space on your hard drive. Read the other threads that address this issue to find how to solve the issue.
    Or, put "The disk cannot be partitioned because some files cannot be moved" into the search box at the upper right of this page.

  • Create a work order using the BAPI for IW31

    Hi,
          I want to create a work order using the BAPI for IW31 tr. can any one help me with the program description.
    Full points will be awarded for the useful answers.
    Thanks and regards,
    Sunil

    hi,
      first use fm "bapi_po_create".
      then use fm "BAPI_ACC_GL_POSTING_POST"
    The demo environment was made with real business scenario in mind, but following subjects need to be addressed in a live implementation:
    •     No exceptions and error handling is implemented, except the order rejection (e.g. partly delivery);
    •     In Navision both XML Ports and the XML DOM has been used to integrate with SAP XI, because XML ports has some drawbacks regarding to Namespaces in XML Documents (mandatory in SAP XI);
    •     A minimum of SAP and Navision customization is required to implement this solution. (e.g. user exit in SAP, Navision XML DOM).

  • Create a Purchase order using the BAPI using the data in the XML file.

    Hello Gurus,
    here is the scenario can anyone help me how to proceed explaining the procedure?
    Create a Purchase order using the BAPI using the data in the XML file.
    comprehensive explanations are appreciated.
    thanks in advance.

    hi,
      first use fm "bapi_po_create".
      then use fm "BAPI_ACC_GL_POSTING_POST"
    The demo environment was made with real business scenario in mind, but following subjects need to be addressed in a live implementation:
    •     No exceptions and error handling is implemented, except the order rejection (e.g. partly delivery);
    •     In Navision both XML Ports and the XML DOM has been used to integrate with SAP XI, because XML ports has some drawbacks regarding to Namespaces in XML Documents (mandatory in SAP XI);
    •     A minimum of SAP and Navision customization is required to implement this solution. (e.g. user exit in SAP, Navision XML DOM).

  • I need help with Creating Key Pairs

    Hello,
    I need help with Creating Key Pairs, I generate key pais with aba provider, but the keys generated are not base 64.
    the class is :
    import java.io.*;
    import java.math.BigInteger;
    import java.security.*;
    import java.security.spec.*;
    import java.security.interfaces.*;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    import au.net.aba.crypto.provider.ABAProvider;
    class CreateKeyPairs {
    private static KeyPair keyPair;
    private static KeyPairGenerator pairGenerator;
    private static PrivateKey privateKey;
    private static PublicKey publicKey;
    public static void main(String[] args) throws Exception {
    if (args.length != 2) {
    System.out.println("Usage: java CreateKeyParis public_key_file_name privete_key_file_name");
    return;
    createKeys();
    saveKey(args[0],publicKey);
    saveKey(args[1],privateKey);
    private static void createKeys() throws Exception {
    Security.addProvider(new ABAProvider());
    pairGenerator = KeyPairGenerator.getInstance("RSA","ABA");
    pairGenerator.initialize(1024, new SecureRandom());
    keyPair = pairGenerator.generateKeyPair();
    privateKey = keyPair.getPrivate();
    publicKey = keyPair.getPublic();
    private synchronized static void saveKey(String filename,PrivateKey key) throws Exception {
    ObjectOutputStream out= new ObjectOutputStream(new FileOutputStream(filename));
    out.writeObject(key);
    out.close();
    private synchronized static void saveKey(String filename,PublicKey key) throws Exception {
    ObjectOutputStream out= new ObjectOutputStream( new FileOutputStream(filename));
    out.writeObject(key);
    out.close();
    the public key is:
    �� sr com.sun.rsajca.JSA_RSAPublicKeyrC��� xr com.sun.rsajca.JS_PublicKey~5< ~��% L thePublicKeyt Lcom/sun/rsasign/p;xpsr com.sun.rsasign.anm����9�[ [ at [B[ bq ~ xr com.sun.rsasign.p��(!g�� L at Ljava/lang/String;[ bt [Ljava/lang/String;xr com.sun.rsasign.c�"dyU�|  xpt Javaur [Ljava.lang.String;��V��{G  xp   q ~ ur [B���T�  xp   ��ccR}o���[!#I����lo������
    ����^"`8�|���Z>������&
    d ����"B��
    ^5���a����jw9�����D���D�)�*3/h��7�|��I�d�$�4f�8_�|���yuq ~
    How i can generated the key pairs in base 64 or binary????
    Thanxs for help me
    Luis Navarro Nu�ez
    Santiago.
    Chile.
    South America.

    I don't use ABA but BouncyCastle
    this could help you :
    try
    java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
    java.security.KeyPairGenerator kg = java.security.KeyPairGenerator.getInstance("RSA","BC");
    java.security.KeyPair kp = kg.generateKeyPair();
    java.security.Key pub = kp.getPublic();
    java.security.Key pri = kp.getPrivate();
    System.out.println("pub: " + pub);
    System.out.println("pri: " + pri);
    byte[] pub_e = pub.getEncoded();
    byte[] pri_e = pri.getEncoded();
    java.io.PrintWriter o;
    java.io.DataInputStream i;
    java.io.File f;
    o = new java.io.PrintWriter(new java.io.FileOutputStream("d:/pub64"));
    o.println(new sun.misc.BASE64Encoder().encode(pub_e));
    o.close();
    o = new java.io.PrintWriter(new java.io.FileOutputStream("d:/pri64"));
    o.println(new sun.misc.BASE64Encoder().encode(pri_e));
    o.close();
    java.io.BufferedReader br = new java.io.BufferedReader(new java.io.FileReader("d:/pub64"));
    StringBuffer keyBase64 = new StringBuffer();
    String line = br.readLine ();
    while(line != null)
    keyBase64.append (line);
    line = br.readLine ();
    byte [] pubBytes = new sun.misc.BASE64Decoder().decodeBuffer(keyBase64.toString ());
    br = new java.io.BufferedReader(new java.io.FileReader("d:/pri64"));
    keyBase64 = new StringBuffer();
    line = br.readLine ();
    while(line != null)
    keyBase64.append (line);
    line = br.readLine ();
    byte [] priBytes = new sun.misc.BASE64Decoder().decodeBuffer(keyBase64.toString ());
    java.security.KeyFactory kf = java.security.KeyFactory.getInstance("RSA","BC");
    java.security.Key pubKey = kf.generatePublic(new java.security.spec.X509EncodedKeySpec(pubBytes));
    System.out.println("pub: " + pubKey);
    java.security.Key priKey = kf.generatePrivate(new java.security.spec.PKCS8EncodedKeySpec(priBytes));
    System.out.println("pri: " + priKey);
    catch(Exception e)
    e.printStackTrace ();
    }

  • Help! I am trying to use the scripts image processor in Photoshop CC.

    Help! I am trying to use the scripts>image processor in Photoshop CC. When I click on it it comes up with an error saying that it cannot find the Javascript Plug In. I have the newest version of Java installed. How do I get it to work in Photoshop. Do I have to download a separate plug in? Any help would be greatly appreciated.

    Java is not Javascript.
    Do you have a Mac or PC?
    If PC, do you have this file on your system?
    C:\Program Files\Adobe\Adobe Photoshop CC (64 Bit)\Required\Plug-Ins\Extensions\ScriptingSupport.8li
    If not, you've got a corrupted installation of Photoshop.  Uninstalling and reinstalling may help.
    -Noel

  • Help with creating a Quiz

    Hey i need help with creating a quiz with scoring and all.
    I need a helping hand so if you can get me started that
    would help a lot.
    Use the Question class to define a Quiz class. A
    quiz can be composed of up to 25 questions. Define the add method
    of the Quiz class to add a question to a quiz. Define the giveQuiz
    method of the Quiz class to present each question in turn to the user,
    accept an answer for each one, and keep track of the results. Define
    a class called QuizTime with a main method that populates a quiz,
    presents it, and prints the final results.
    // Question.java Author: Lewis/Loftus/Cocking
    // Represents a question (and its answer).
    public class Question implements Complexity
    private String question, answer;
    private int complexityLevel;
    // Sets up the question with a default complexity.
    public Question (String query, String result)
    question = query;
    answer = result;
    complexityLevel = 1;
    // Sets the complexity level for this question.
    public void setComplexity (int level)
    complexityLevel = level;
    // Returns the complexity level for this question.
    public int getComplexity()
    return complexityLevel;
    // Returns the question.
    public String getQuestion()
    return question;
    // Returns the answer to this question.
    public String getAnswer()
    return answer;
    // Returns true if the candidate answer matches the answer.
    public boolean answerCorrect (String candidateAnswer)
    return answer.equals(candidateAnswer);
    // Returns this question (and its answer) as a string.
    public String toString()
    return question + "\n" + answer;
    }

    Do you know why this lazy f&#97;rt-&#97;ss is back? Because when he posted his homework last week, some sorry-assed idiot went and did it for him.
    http://forum.java.sun.com/thread.jspa?threadID=5244564&messageID=10008358#10008358
    He didn't even thank the poster.
    It's the same problem over and over again. You feed the bears and it only teaches them to come back for handouts.
    My polite suggestion to the original poster: please do your own f&#117;cking homework.

  • Selecting an object fails when creating a new dashboard using the 'New Dashboard and Widget Wizard'

    Hi,
    I am using SCOM 2012 SP1
    I have recently been experiencing an issue when trying to create a new dashboard using the wizard. I get to the step where you select a group or object to add to the  Scope and Counters section. When I try to search for a particular object such as a
    port or interface it times out and returns an error. The error is shown below:
    Please provide the following information to the support engineer if you have to contact Microsoft Help and Support :
    Microsoft.EnterpriseManagement.Presentation.DataAccess.DataAccessDataNotFoundException: Exception reading objects ---> Microsoft.EnterpriseManagement.Common.UnknownDatabaseException: The query processor ran out of internal resources and could not
    produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions. Please simplify the query. If you believe you have received this message in error, contact Customer
    Support Services for more information.
       at Microsoft.EnterpriseManagement.Common.Internal.ServiceProxy.HandleFault(String methodName, Message message)
       at Microsoft.EnterpriseManagement.Common.Internal.EntityObjectsServiceProxy.GetManagedEntitiesByManagedEntityTypesAndCriteriaWithInstanceQueryOptions(IList`1 managedEntityTypeIds, IList`1 managedEntityBaseTypeIds, IList`1 criterias, String
    languageCode, InstanceQueryOptions instanceQueryOptions)
       at Microsoft.EnterpriseManagement.InstancesManagement.GetObjectsReaderInternal[T](ICollection`1 criteriaCollection, ObjectQueryOptions queryOptions)
       at Microsoft.EnterpriseManagement.Management.DataProviders.ManagedEntityProvider.GetManagedEntitiesByClass(ICollection`1 baseTypeNames, String criteriaString, List`1 valueDefinitions, List`1 sortValueDefinitions, Int32 maxEntities, String typePropertyName,
    String typeWithIconPropertyName, Boolean propertyCollectionRequested)
       --- End of inner exception stack trace ---
       at Microsoft.EnterpriseManagement.Presentation.DataAccess.DataProviderCommandMethodInvoker.Invoke()
       at Microsoft.EnterpriseManagement.Monitoring.DataProviders.RetryCommandExecutionStrategy.Invoke(IDataProviderCommandMethodInvoker invoker)
       at Microsoft.EnterpriseManagement.Presentation.DataAccess.DataProviderCommandMethod.Invoke(CoreDataGateway gateWay, DataCommand command)
       at Microsoft.EnterpriseManagement.Presentation.DataAccess.CoreDataGateway.ExecuteInternal[TResult](DataCommand command)
       at Microsoft.EnterpriseManagement.Presentation.DataAccess.CoreDataGateway.<ExecuteAsync>b__0[TResult](<>f__AnonymousType0`1 data)
    It appears to be complaining about internal resources, but we have not experienced this issue before and both the management and SQL servers have plenty of resource. The databases are held on a seperate dedicated sql server and I have noticed that when I
    try to search for the object, the sqlservr.exe process immediately consumes 50% CPU while the query is running. As soon as it ends (errors) the sqlservr process drops back to a reasonable number.
    No changes have been made to either the management server or sql server. We were able to create dashboards one day, but then recieved this error the next.
    Has anyone else seen this issue? or can anyone explain what is happening?
    Many thanks

    Hi,
    Asposted earlier,hadt he same problem
    when creating a Dashboard widget type
    State.
    Ones olution I found for this was as follows:
    When creating the State widget,the option
    to specify the criterion I left blank
    and finished the creation of the dashboard.
    With that managed to solve the problem.Of course this
    is not the solution, or the root cause
    of the problem.
    I will examine more about this issue, and sohave
    the ultimate solution and why such behavior,I post
    here.
    thank you
    Wilsterman Fernandes

  • Help with creating extension

    I am very new to extension creating but i gave it a go and cs5 said it install
    ed the extension but when i went to use it it threw an error on line 22..
    i don't know what i did wrong.. the ext html is below along with the mxi text .. hope someone can help. thanks in advance. hopefully your help will assist me with creating others that work and share.
    http://www.pegaan.com/extension/convey.html
    http://www.pegaan.com/extension/conveyer.mxi
    this is the extension cs5 made
    http://www.pegaan.com/extension/conveyer.mxp

    Hi
    You have posted this question in the wrong section of the forum, this is the html5 section, you would be better advised reposting in the extension developers section.
    As for your problem, you have used microsoft word or similar to develop the code, and the javascript should be in a separate file. Can I suggest that you read the following, which will explain extension development in dreamweaver -
    http://help.adobe.com/en_US/dreamweaver/cs/extend/dreamweaver_cs5_extending.pdf
    PZ

  • I am automating the process of sending appointment reminders to my clients. I started with an alert with an email in calendar using the clients email address as a custom entry in my me card in my contacts. this was resulting in three emails being sent wit

    I am automating the process of sending appointment reminders to my clients. I started with an alert with an email in calendar using the clients email address as a custom entry in my me card in my contacts. this was resulting in three emails being sent with slightly different versions of the same address (see my previous post). Heating someone else's suggestion I created a workflow file to send an email and calling that file from an alert on my calendar. This is working and sends only one email to the client.
    My calendar is on I cloud and I access it from three different computers so I can keep my appointment calendar current. The files that send the email only exist on one computer. My other computers show error messages when those emails get sent. It seems that each computer wants to send the email. It's a small problem but is there a way that I could not get those alerts.
    But appreciate any thoughts about this. It seems like both problems might be related to the iCloud system.
    Thank you in advance,
    Michael

    Good work, catch so far Michael, does seem to be a "feature" of iCloud syncing, not sure what you could do to disable it.

  • How can i create multiple accounts but use the same itunes?

    how can i create multiple accounts but use the same itunes?

    Hi iCloud is Making Me Go Crazy,
    You will need to create a new Apple ID for your GameCenter and iCloud services.  You can continue to use the current Apple ID you share with your Mom for access to iTunes Store purchases if you wish. 
    Using your Apple ID for Apple services
    http://support.apple.com/kb/HT4895
    Frequently asked questions about Apple ID
    http://support.apple.com/kb/HT5622
    Cheers,
    - Judy

  • It seems cranky sometimes works, somtimes not.  My other issue - is there a way to create a mail signature using the font I use in Outlook (or can I import that signature)?

    I have a new iPhone 4s - having lots of trouble with Siri.  It seems cranky - sometimes works, somtimes not.  My other issue - is there a way to create a mail signature using the font I use in Outlook (or can I import that signature)?  How can I find fonts availble on my phone?
    Thanks for any help

    Not in Acrobat unless your image is already in the PDF format.
    This is a feature of forms created with LiveCycle Designer.

  • When using the Database Connectivity Toolset, reads and writes with long binary fields are incompatible.

    I am trying to write LabVIEW Variants to long binary fields in a .mdb file using the Database Connectivity Toolset. I get errors when trying to convert the field back to a variant after reading it back from the database.
    I next tried flattening the variant before writing it and ultimately wound up doing the following experiments:
    1) If I use DB Tools Insert Data to write an ordinary string and read it back using a DB Tools Select Data, the string is converted from ASCII to Unicode.
    2) If I use DB Tools Create Parameterized Query to do an INSERT INTO or an UPDATE operation, specifying that the data is BINARY, then read it back using a DB Tools Select Data,
    the length of the string is prepended to the string itself as a big-endian four-byte integer.
    I can't think of any way to do a parameterized read, although the mechanism exists to return data via parameters.
    Presuming that this same problem affects Variants when they are written to the database and read back, I could see why I get an error. At least with flattened strings I have the option of discarding the length bytes from the beginning of the string.
    Am I missing something here?

    David,
    You've missed the point. When a data item is flattened to a string, the first four bytes of the string are expected to be the total length of the string in big-endian binary format. What is happening here is that preceding this four-byte length code is another copy of the same four bytes. If an ordinary string, "abcdefg" is used in place of the flattened data item, it will come back as <00><00><00><07>abcdefg. Here I've used to represent a byte in hexadecimal notation. This problem has nothing to do with flattening and unflattening data items. It has only to do with the data channel consisting of writing to and reading from the database.
    I am attaching three files that you can use to demonstrate the problem. The VI file c
    ontains an explanation of the problem and instructions for installing and operating the demonstration.
    Ron Martin
    Attachments:
    TestLongBinaryFields.vi ‏132 KB
    Sample.UDL ‏1 KB
    Sample.mdb ‏120 KB

Maybe you are looking for