Click here to Skip to main content
15,892,059 members
Home / Discussions / Algorithms
   

Algorithms

 
QuestionHi, I'm a freshman for the Digtal image processing, I wonder if HMM or Markov model is the right choice for target tracking. Pin
superwave6-Aug-09 21:51
superwave6-Aug-09 21:51 
AnswerRe: Hi, I'm a freshman for the Digtal image processing, I wonder if HMM or Markov model is the right choice for target tracking. Pin
fresi8-Aug-09 1:50
fresi8-Aug-09 1:50 
GeneralRe: Hi, I'm a freshman for the Digtal image processing, I wonder if HMM or Markov model is the right choice for target tracking. Pin
superwave8-Aug-09 3:27
superwave8-Aug-09 3:27 
GeneralRe: Hi, I'm a freshman for the Digtal image processing, I wonder if HMM or Markov model is the right choice for target tracking. Pin
Tim Craig9-Aug-09 8:48
Tim Craig9-Aug-09 8:48 
GeneralRe: Hi, I'm a freshman for the Digtal image processing, I wonder if HMM or Markov model is the right choice for target tracking. [modified] Pin
superwave9-Aug-09 18:33
superwave9-Aug-09 18:33 
QuestionHow to extract data from web Pin
Rakesh Ranjan Dey6-Aug-09 2:17
Rakesh Ranjan Dey6-Aug-09 2:17 
AnswerRe: How to extract data from web Pin
Super Lloyd6-Aug-09 3:13
Super Lloyd6-Aug-09 3:13 
QuestionNeed some logic help. Pin
benjamin yap4-Aug-09 15:00
benjamin yap4-Aug-09 15:00 
Hi people, i am doing some 'while' loop but kinda stuck somewhere.

What i want to do is actually is comparing from 2 database tables.

The problem now is example i have 10 records in SMS_IN table, but my code only runs the first record everytime i calls it. By right, it should loop thru all the data and check.

SMS_IN (sample data)

originator | text | date
88411254 | Internet bla bla bla | 5 August
78412447 | Quiz ans1 ans2 ans3 | 5 August

USERAPP (sample data)

userid | keyword
54 | Internet
80 | Quiz

So the logic is first it will check the SMS_IN text column, example the first word of the first result is 'Internet', then it will check the USERAPP keyword column, if the keyword 'Internet' exists, means its a valid sms. If the keyword does not exists at all in the USERAPP table, the msg will be deleted from SMS_IN table

this is my code

  ResultSet rs = null;
    ResultSet rs2 = null;
    String sql = "Select * from smsserver_in";
    String sql1 = "Select * from USERAPP";
    rs = db.SelectDB(sql);
    rs2 = db.SelectDB(sql1);

    try {
        String firstword = null;
        String keyword = null;
        int number = 0;
        while (rs.next()) {
            StringTokenizer st = new StringTokenizer(rs.getString("text"));
            firstword = st.nextToken();
            //out.println("1"+firstword);
            number = rs.getInt("id");

            while (rs2.next()) {
                keyword = rs2.getString("keyword");
                //out.println("2"+keyword);
                if (firstword.equals(keyword)) {
                    out.println(number);
                    String sql3 = "Insert into app_" + keyword + "(originator,text)values(" + rs.getString("originator") + ",'" + rs.getString("text") + "')";
                    db.InsertDB(sql3);
                    String sql4 = "delete from smsserver_in where id=" + number;
                    db.UpdateDB(sql4);
                } else {

                }

            }

        }
    } catch (Exception ex) {
    }
}

AnswerRe: Need some logic help. Pin
Luc Pattyn4-Aug-09 15:38
sitebuilderLuc Pattyn4-Aug-09 15:38 
GeneralRe: Need some logic help. [modified] Pin
benjamin yap4-Aug-09 17:18
benjamin yap4-Aug-09 17:18 
GeneralRe: Need some logic help. Pin
Luc Pattyn4-Aug-09 23:25
sitebuilderLuc Pattyn4-Aug-09 23:25 
QuestionLexical Analysis Useful for Other Things as Well? Pin
Richard Andrew x644-Aug-09 5:31
professionalRichard Andrew x644-Aug-09 5:31 
AnswerRe: Lexical Analysis Useful for Other Things as Well? Pin
Luc Pattyn4-Aug-09 6:13
sitebuilderLuc Pattyn4-Aug-09 6:13 
AnswerRe: Lexical Analysis Useful for Other Things as Well? Pin
N a v a n e e t h4-Aug-09 7:57
N a v a n e e t h4-Aug-09 7:57 
AnswerRe: Lexical Analysis Useful for Other Things as Well? Pin
harold aptroot6-Aug-09 2:58
harold aptroot6-Aug-09 2:58 
AnswerRe: Lexical Analysis Useful for Other Things as Well? Pin
N a v a n e e t h6-Aug-09 18:10
N a v a n e e t h6-Aug-09 18:10 
AnswerRe: Lexical Analysis Useful for Other Things as Well? Pin
Eddy Vluggen8-Aug-09 7:13
professionalEddy Vluggen8-Aug-09 7:13 
QuestionBackus-Naur Form Terminology Pin
Richard Andrew x643-Aug-09 13:36
professionalRichard Andrew x643-Aug-09 13:36 
AnswerRe: Backus-Naur Form Terminology Pin
Luc Pattyn3-Aug-09 15:23
sitebuilderLuc Pattyn3-Aug-09 15:23 
GeneralRe: Backus-Naur Form Terminology Pin
Richard Andrew x643-Aug-09 15:28
professionalRichard Andrew x643-Aug-09 15:28 
GeneralRe: Backus-Naur Form Terminology Pin
Luc Pattyn3-Aug-09 15:36
sitebuilderLuc Pattyn3-Aug-09 15:36 
GeneralRe: Backus-Naur Form Terminology Pin
Richard Andrew x643-Aug-09 15:39
professionalRichard Andrew x643-Aug-09 15:39 
QuestionAny algorithm for allocation Pin
Sabari MD31-Jul-09 1:03
Sabari MD31-Jul-09 1:03 
QuestionRe: Any algorithm for allocation Pin
harold aptroot31-Jul-09 1:28
harold aptroot31-Jul-09 1:28 
AnswerRe: Any algorithm for allocation Pin
Sabari MD31-Jul-09 1:45
Sabari MD31-Jul-09 1:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.