Regarding algorithm

im logging the data into the que when the serial data is coming in the serialevent().In another thread i created im getting the data from the que.i dont want the que functions to be accessed by both serialevent() and the thread i created.i have a varible "check" to protect the que
In the serialevent()
check=true
que.add(data);
check=false
In the thread
if(!check) data=que.remove();
when the check value is false and when thread is executing que.remove()
at that time data arrives in the serial port then que.add() will be executed.how can i ensure que.remove() doesn't get executed when
there is a serialevent().when i use Synchronized keyword,i cant make the
code in the serialevent() to sleep since there will be a data loss
when some other data comes.kindly help me regarding this

Here is code for your basic queue between two threads. The push method never blocks for any significant amount of time, only for the time to pop one object. The pop method will block until an object is available.
import java.util.LinkedList;
// a simple queue class between two threads
public class Queue
     LinkedList q = new LinkedList();
     public synchronized void push(Object obj)
          q.add(obj);
          this.notify();     // tell pop to run with it
     public synchronized Object pop()
          while(q.isEmpty())
               try{this.wait();}
               catch (InterruptedException e){}
          return q.remove(0);

Similar Messages

  • Query regarding algorithm resource estimation at system generator (VIVADO IDE- 2014.3.1)

    Hi Guyz,
    I am able to estimate the resource required for a design only after the synthesis is done in the Vivado.
    The question is: 
    Is it possible to estimate the resource in system generator (Vivado IDE 2014.3.1) itself ?
    Couldn't find the RESOURCE ESTIMATOR block in  the system generator [xilinx blockset/tools] as in its precursor, i.e. System generator (ISE).
    When i went through the documents, came to know that resource estimator block has not yet been introduced in System generator - Vivado IDE [Please correct me, if i am wrong]
    Is there any way [other than checking utilization report after synthesis], which will allow me to estimate the resource as soon as the algorithm is ready - as a system generator model ?
    PLEASE GUIDE.
    THANKS in advance.
    Thanks & Regards,
    Ananya

    Hi Satish,
    Thanks for the quick reply.
    My doubt:
    Can I find the resource estimation for the algorithm model using ISE and then approximate the resource at Vivado ?  [Not sure if this makes sense, just wanted to know if this approach works]
    Please suggest.
    Thanks & Regards,
    Ananya

  • Help regarding algorithm..

    One of my tables is having following data :
    Category     Scheme     SchemeType     Amt
    A          ABC     Z1          10
    A          ABC     Z2          20
    A          DEF     X1          18
    A          DEF     X2          15
    B          XY     A1          12
    B          YZ     B1          0
    ------------------------------------------Validation to be built on data:
    1. Max amount in SchemeType should not exceed 20
    2. Max amount in Scheme should not exceed 50
    3. Max amount in Category should not exceed 100
    All the above mentioned validations are compulsory.
    Which approach shall i take so that the cost is mininum.
    Top - Bottom - i.e. check for Category validaton then Scheme and SchemeType
    OR
    Bottom - Top - i.e. check for SchemeType validaton and then Scheme and Category.
    Thanks in advance.
    Regards
    Kaustubh

    Kaustubh wrote:
    One of my tables is having following data :
    Category     Scheme     SchemeType     Amt
    A          ABC     Z1          10
    A          ABC     Z2          20
    A          DEF     X1          18
    A          DEF     X2          15
    B          XY     A1          12
    B          YZ     B1          0
    ------------------------------------------Validation to be built on data:
    1. Max amount in SchemeType should not exceed 20
    2. Max amount in Scheme should not exceed 50
    3. Max amount in Category should not exceed 100Do you mean that the sum(amt) for each thing should not exceed those limits?
    And should that be based on any relationship between category, scheme and schemetype?
    i.e.
    sum(amt) for a given schemetype within a scheme, within a category should not exceed 20
    sum(amt) for a given scheme within a category should not exceed 50
    sum(amt) for a given category should not exceed 100
    This would make more logical sense (to me anyway)

  • Weblogic 5.1 Clusters

    I am trying to find out information regarding to the setup of a Weblogic 5.1
              Cluster.
              I am in the process of reading the online docs as a start....
              Base components being currently utilised on 4.5.1 are:
              - Solaris version 2.6
              - Netscape version 3.6
              - Database version Oracle, 8i
              - JDK 1.2.1_03a
              Questions:
              What is the most popular cluster type used by vendors?
              Are there any specific requirements that define what is best for what
              circumstance?
              What implications exist if any for the clustered environment?
              Is there anyone out there that I would be able to speak regarding algorithms
              they may have implemented?
              Anyone have any statistical information about performance / load balancing
              etc?
              Anyone know any resources that may be able to suggest for me to investigate
              in the specific area of 5.1 clustering, or can anyone outlay any experiences
              please?
              I would really like to obtain stats / benchmark performance of differences
              between 4.5.1 and 5.1 as well?
              any help appreciated?
              Simon
              

    I am trying to find out information regarding to the setup of a Weblogic 5.1
              Cluster.
              I am in the process of reading the online docs as a start....
              Base components being currently utilised on 4.5.1 are:
              - Solaris version 2.6
              - Netscape version 3.6
              - Database version Oracle, 8i
              - JDK 1.2.1_03a
              Questions:
              What is the most popular cluster type used by vendors?
              Are there any specific requirements that define what is best for what
              circumstance?
              What implications exist if any for the clustered environment?
              Is there anyone out there that I would be able to speak regarding algorithms
              they may have implemented?
              Anyone have any statistical information about performance / load balancing
              etc?
              Anyone know any resources that may be able to suggest for me to investigate
              in the specific area of 5.1 clustering, or can anyone outlay any experiences
              please?
              I would really like to obtain stats / benchmark performance of differences
              between 4.5.1 and 5.1 as well?
              any help appreciated?
              Simon
              

  • Need help regarding implementing SSAS solution using microsoft decision trees algorithm

    Hi All,
    I am new to SSAS and Data Mining techniques. I dnt have a good knowledge about data mining in SSAS.  I have a requirement regarding predictive analysis and want to check whether i can implement SSAS for it. 
    I have two tables namely Tree and Node. The Tree table has the columns namely NodeID, ParentID and Level. The ParentID in the tree table represents a node in the node table and at the same time the nodeid in the tree table also represents the nodeid in the
    node table.
    If you run the below query, it will list out all the possibilities of getting the nodename 'CTRYIMPACT - High - PRODIMPACT - Low - Question 6'
    select p.*
    from Node n, Tree t, Node p
    where n.NodeName='CTRYIMPACT - High - PRODIMPACT - Low - Question 6'
    and n.NodeId = t.NodeId
    and t.ParentId = p.NodeId
    I want to predict the various nodenames that are possible by inputting a NodeID using analysis services. If this is done, then i can implement it in my project. 
    I went over this link to know about implementing decision tress but, they have used only a single table in the example. Since I have two tables i am struck in the middle. And also they have not specified clearly of what they need to achieve. They have just
    stated that on changing the play the value changes. 
    http://www.mssqltips.com/sqlservertip/2965/classic-machine-learning-example-in-sql-server-analysis-services/
    Can anyone help me with this?
    Below is the link for data containing the values for the Node and Tree table.
    https://www.dropbox.com/s/hpzooa039zbtkk8/analysis_services_data.xlsx?dl=0
    Thanks you and Kind Regards, Karthik Venkatraman

    Hi Karthink,
    Acording to your description, you need to predict the various nodenames that are possible by inputting a NodeID using analysis services, right?
    In your scenario, in order to make prediction in Data Mining Model, we would create a prediction query. Before we can create a prediction query, we need to build a Data Mining Model. Please refer to the links below to see the detail infomaton.
    http://msdn.microsoft.com/en-in/library/bb677206.aspx
    http://msdn.microsoft.com/en-in/library/hh213169.aspx
    http://captechconsulting.com/blog/mark-hudson/making-predictions-microsoft-data-mining-tools-%E2%80%93-part-ii
    Regards,
    Charlie Liao
    If you have any feedback on our support, please click
    here.
    Charlie Liao
    TechNet Community Support

  • Regarding MD5 algorithm in C#

    hello,can any one help me or suggest a way how can i encode a url of web page is encrypted in C# using MD5 algorithm
    Latheesh K Contact No:+91-9747369936

    It is not possible. MD5 is a one-way hashing algorithm so you cannot
    "unhash" och "decrypt" the hashed value.
    And if you have web related questions you should ask these at
    http://forums.asp.net.
    Please remember to mark helpful posts as answer and/or helpful.

  • Where can I find source code for CPRM algorithm?

    Hi, everyone.
    Where can I find reference implementation or some sample codes for CPRM(content protection for recordable media) algorithm? Can anyone help?
    Information about CPRM can be find here,
    http://www.4centity.com/
    Thanks in advance,
    Geo

    Thanks, edsonw buddy!
    I really take rather a lot of time to search reference implementation in this site but failed to find it out. Can you give me the precise link from which I can download reference implementation and sample vectors?
    Best regards,
    George

  • In EBS document not get auto clear Algorithms 11

    In Electronic bank statment  document not get  clear automatically while batch run.
    I update check no to payment document.  even though it is not get auto clear.
    in OT51 assign Interpretation Algorithms 11 011:(Outgoing check: Check number not identical to document number)
    why it is not get  auto clear with check number.

    011 = Outgoing check: Check number not identical to document number
    012 = Outgoing check: Check number identical to document number
    The "document number" in the descriptions is the payment document number - the FI doc that cleared the invoice.  If you use the payment document number as the check number - and thus that is the number the bank includes in the bank statement - then you would use algorithm 012.  If you create a check in the check register that is a different number than the payment document - and the check number is the number in the bank statement - then you would use algorithm 011.
    Search SAP Help for a document titled "Interpretation Algorithms".  This document includes descriptions of all the standard interpretation algorithms.
    Regards,
    Shannon

  • I need a new Macbook but -.I need advice regarding the new fixed configurations

    I have a MacBook from 2007 and it probably needs replacing as I'm starting to see problems, little hints that any day it might completely stop working.  I was ready to buy a new computer but after reading about the new MacBook Pros, it seems like Apple has forgotten its roots.
    Let's say you get 8 GB of RAM which is probably enough for my purposes( but I'm still not sure, I might get 16 though its very expensive) and there is a problem with the RAM.  Do you really have to replace the entire logic board and what are we talking in terms of parts and labor assuming you are out of warranty?  This happened to my current Macbook and it was very cheap because I was able to snap new chips in but everything is soldered  on the new Macbooks and I don't want to buy a computer that I might be throwing away in 2 years.
    The same questrion applies in regard to the CPU.  If it fails, is this going to be a huge repair bill?
    Another major concern regards complaints from dissapointed customers who are unhappy with the glare of the screen.  As I have eye problems, this could be a big issue for me.
    Finally, but less of a problem, Its disappointing that you need to purchase an ethernet adaptor and have to buy an external CD/DVD drive. People look at me like I'm crazy when I talk about CD drives, but I listen to a lot of classical music which you cannot get on the net, and, even if you can, it is of low quality.  You have to go to a store like Amoeba to find the CD.   Not a huge deal, but a bit annoying and these little things add up.
    I'm starting to think I may have to take a look at PC's,  something, I never thought I'd do again.

    I'd recommend 8 GB RAM, based upon all the information available today it should be sufficient for a very long time. OS X "Mavericks" uses system resources extremely efficiently and the MBP's flash memory goes a long way toward masking a paucity of RAM. Apple claimed that Mavericks' new memory compression algorithm results in an effective increase of 50% more memory than what is actually installed, a claim that I have empirically determined to be accurate, perhaps a bit conservative. In other words 8 GB memory will perform as if 12 GB were actually installed, if not for OS X's memory compression algorithm. Even 4 GB is sufficient for Mavericks whereas it was barely adequate for Mountain Lion.
    If you were to ask an iPad or iPhone owner how much memory it has, and if they actually understood what you were asking, most would not know, or care. Nor should they. Such is the future of the Mac product line.
    The same questrion applies in regard to the CPU.  If it fails, is this going to be a huge repair bill?
    It certainly will. Fortunately I have never heard of a single case in which a Mac's CPU has failed.
    Another major concern regards complaints from dissapointed customers who are unhappy with the glare of the screen.
    All you can do is try it for yourself. Matte screens have disadvantages too. If you don't like your MBP, return it for a full refund, no questions asked. You have 14 days to decide.
    Classical music used to been a challenge to find on iTunes, but Apple has been getting better. You can still buy an external CD drive to import your music; they're not terribly expensive.
    Any computer design is a study in compromises and an optical drive simply isn't worth the tradeoffs. People howled about Apple's decision to eliminate floppy disk drives too, even as they were ridiculed for originally promoting the 3 1/2" floppy disk format. What Apple creates, Apple destroys, lest someone else do it for them.
    In any event optical discs are antiquated and obsolete, so get used to the idea.
    I'm starting to think I may have to take a look at PC's,  something, I never thought I'd do again.
    Choice is good. Knock yourself out.

  • Advice regarding house guest internet access through Airport Express

    I would like to set up trouble-free (on my part and my house guests) access to the internet. Any thoughts or suggestions? It seems to me that if folks may have reasonable access to cable/satellite TV and telephone, or what have you, it is also reasonable to make available to them the internet. What is the best way to go about doing this? I have an existing home wireless system using Airport Express (may also work in a Netgear WG614 wireless router). Mostly, I am concerned with the technical aspects but would also like to hear from anyone regarding the legal/social ramifications. Any such solutions must take into account both Windows and Mac environments. Thanks.
    17 in. iMac G5 ALS (1.8 GHz)   Mac OS X (10.4.5)   iMac G3 DV (400 MHz), Airport Express, 3rd gen iPod

    Meme,
    A nice touch, and one that made me choose one small hotel over another when I used to travel a lot.
    I can't give a complete solution, but I can give you bits of info, which others will also do.
    One thing that probably is a must, is to set Wireless Isolation. That is that although all the wireless clients can see the internet, they can't see each other. I'm not sure that the AE supports this, I honestly thought it did, but now I can't find it. The Netgear will support it.
    Wireless encryption will be a must too, you may even want to make it a "closed network", so that the network does not advertise it's presence. Clients wishing to connect must specify ("key in") the network name and connect. That may be just a little too difficult for some business travellers. Back to wireless encryption, some may say to use some ultra-modern hi-tech secure encryption algorithm to be really safe, but these are enormous long passwords that your clients will have to key. Those with older computers may not support the latest encryption methods. Some may recommend WPA, I'd say WEP (more compatability) and a simple (non-dictionary) password, like "@pple" or "@irPortXPr3ss" or any easy to communicate word(s) with a few letters replaced by vowels or (printable) symbols. It is up to you how often you change the password.

  • Issue regarding consecutive run for an Interface

    hi all,
    i have an issue regarding an interface
    if this Interface is a initial run for the file, you have to populate all the data of the people. That is , unlike other interfaces where we send only the latest record, in this interface we need to send all the records of the employees. in a employee has 10 records with different dates, we will pick up all the records greater than 1999 and pass it. whereas if there is a change in one field, then we will send all the record of that file. And If it is a consecutive run  then you have to populate changes only. the following algorithm can help you in this
    if intial_run EQ 'X'
    transfer IT_FINALDATA to XI.
    else
    Declare a 2 more internal tables similar to IT_FINALDATA...for our below example let us assume that
             DATA: IT_CLUSTERDATA type standard table of IT_FINALDATA.
             DATA: IT_COMPAREDATA type standard table of IT_FINALDATA.
    use the following statement to retrieve the data from cluster and comparing it
            IMPORT IT_CLUSTERDATA TO IT_COMPAREDATA  FROM DATABASE indx(zn) ID 'IN_8085'.
            Compare IT_COMPAREDATA with IT_FINALDATA
    If sy-subrc = 0.
    Means there are no changes, and no output required
    Else
    Pass the data to XI interface,  And store the internal table in the same INDX table, using the following statement
    EXPORT IT_FINALDATA to  IT_CLUSTERDATA FROM DATABASE indx(zn) ID 'IN_8077'.
    Endif.
    In this  can we deliver the changed data at every single consecutive run.
    Please let me  know,
    Thank Q
    Rohini.

    This is something where HR Interface Toolbox (PU12) can be very helpful, it will take care of changes from one run to another and you can configure it to send changes only in next run. But, you will need some ABAP in its user exits to restrict the data after 1999, and any other restrictions that you might want.

  • Help needed Regarding a business logic

    Hi all,
    My business requirement is
    requires to get a checksum from the KIOSK field. This would be something like a rule that for a given KIOSK generates a number from 0 to 9.
    The Field value contains alphanumerical
    Can any of guys help me in this logic.how to generate a checksum for a given field..
    Thanks & Regards;
    Vinit

    Alright I found something  I am not  sure if it is of use to you , A checksum is generally used to  detect the integrity of file
    it is calculated oin basis of hash algorithms so  how it is useful to for incoming filed values i m not  sure
    Please find the links below
    http://en.wikipedia.org/wiki/Checksum
    http://www.fastsum.com/support/online-help/checksums.php
    http://www.flounder.com/checksum.htm
    http://www.mkyong.com/java/how-to-generate-a-file-checksum-value-in-java/
    If it is useful , you need to implement a hash algorithm
    regards
    Ninad

  • 3D extrusion algorithm in Photoshop CS5 Extended

    Hi,
    I am a researcher at NTU Singapore and was using 3D features of Adobe Photoshop CS5 Extended. To be specific the 3D on a plane feature from a single image. I wanted to know what algorithm is being used here? Is it shape from shading? I want to know because I want to improve it and use it in my research as the 3D generated by is quite "noisy".
    Thanks in advance for any help
    Regards
    Shaz

    You will get much closer to an to your question if you ask it on the Photoshop forum.  This forum is dedicated to Acrobat 3D features only.  Also, the answer to your question may require internal knowledge of Photoshop 3D engineering, and, since these forums are not necessarily monitored by Adobe employees, may be difficult to come by.

  • Need to clear openitems for Bank Reconciliation without useing Algorithms

    Dear All,
    As per configuration of Manual Bank Reconciliation, for clearing cheque deposit & cheque issue we are useing Algorithms 15 & 13 respectively. while uploading Bank statement we used to give SIX digit cheque number as a reference to clear the open items (i.e the same cheque Number is used to enter by the user in Allocation field of GL Account)
    But as a special case the user has entered more than SIX digit cheque Number in Gl Account. Now am unable to clear those open items, since bank statement is having six digit cheque Numbers only.
    My question is if i want to clear the open items of cheque deposit, cheque issue, others without useing Algorithms... let me know the configuration with various specification parameters.
    Regards,
    Swathi

    HI
    My Requirement is only one..... can we clear without useing Algorithms..... let me know the process.... on what parameters/specifications can do
    Rgds,
    Swathi
    Edited by: swathi fico on Aug 27, 2009 10:08 AM
    Edited by: swathi fico on Aug 27, 2009 12:55 PM

  • Types of internal tables with regard to EFFICIENCY

    Will any one tell me syntax to define each type of internal table  (standard, sorted , hashed , database) . how to compare their efficincy ( access time which is more effficent) is there any documantation or programme of such type exist then please tell  . i want to declare each type of above table and also to compare them w.r.t to efficeny thanks  want urgent reply

    Hi,
    There are 3 types of Internal tables.
    Standard Internal Tables:
    Standard tables have a linear index. You can access them using either the index or the key. If you use the key, the response time is in linear relationship to the number of table entries. The key of a standard table is always non-unique, and you may not include any specification for the uniqueness in the table definition.
    This table type is particularly appropriate if you want to address individual table entries using the index. This is the quickest way to access table entries. To fill a standard table, append lines using the (APPEND) statement. You should read, modify and delete lines by referring to the index (INDEX option with the relevant ABAP command). The response time for accessing a standard table is in linear relation to the number of table entries. If you need to use key access, standard tables are appropriate if you can fill and process the table in separate steps. For example, you can fill a standard table by appending records and then sort it. If you then use key access with the binary search option (BINARY), the response time is in logarithmic relation to the number of table entries.
    Sorted Internal Tables:
    Sorted tables are always saved correctly sorted by key. They also have a linear key, and, like standard tables, you can access them using either the table index or the key. When you use the key, the response time is in logarithmic relationship to the number of table entries, since the system uses a binary search. The key of a sorted table can be either unique, or non-unique, and you must specify either UNIQUE or NON-UNIQUE in the table definition. Standard tables and sorted tables both belong to the generic group index tables.
    This table type is particularly suitable if you want the table to be sorted while you are still adding entries to it. You fill the table using the (INSERT) statement, according to the sort sequence defined in the table key. Table entries that do not fit are recognised before they are inserted. The response time for access using the key is in logarithmic relation to the number of table entries, since the system automatically uses a binary search. Sorted tables are appropriate for partially sequential processing in a LOOP, as long as the WHERE condition contains the beginning of the table key.
    Hashed Internal Tables:
    Hashes tables have no internal linear index. You can only access hashed tables by specifying the key. The response time is constant, regardless of the number of table entries, since the search uses a hash algorithm. The key of a hashed table must be unique, and you must specify UNIQUE in the table definition.
    This table type is particularly suitable if you want mainly to use key access for table entries. You cannot access hashed tables using the index. When you use key access, the response time remains constant, regardless of the number of table entries. As with database tables, the key of a hashed table is always unique. Hashed tables are therefore a useful way of constructing and
    using internal tables that are similar to database tables.
    http://help.sap.com/saphelp_470/helpdata/EN/fc/eb35de358411d1829f0000e829fbfe/frameset.htm
    Regards,
    Kiran Sure

Maybe you are looking for

  • Ipod Problems: Folder Icon

    i got my 30gb 5G ipod for Christmas and i have had a few small problems, But this is the worst, When i connect my Ipod to my Windows PC it resets itself, Shows the folder icon and then turns off. Ive trawled the support with no avail.The Ipod Updater

  • Apple video suggestion

    I was watching a video on Youtube the other day. The contents of the video itself is irrelevant, but the quality of the video was stunning. It made me wonder what type of phone or camera it was taking with. In today's youtube era information broadcas

  • Best way to edit/update data in JSP ?

    Hi Friends, I want to know about Update / Edit data procedure in JSP. ie. If we have one form having 10 fields, and we need to change only 1 field then do we require to set update query for all 10 fields ? don't it make some overload ? Can you give m

  • I have a vector Star(Red) then I create small bubbles vector(blue) how to create Red star w/ blue bubbles inside star get rid of excess bubble outside of star?

    I tried path finder but then it will create a bubbles hole in the star leaving the blue color of bubble behind Masking  also made a hole in the star             <           >                  V  V         <----   this is my red star  :*^.......**    

  • Os 9 to x

    I want to upgrade to os X Can I upgrade to tiger and safari? If so what do i need to do this? Do I have to add ram? And if so how do i do this and for how much approximately?