[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] pseudo-code, browser-based ERDs



Page 2 of this .pdf has a flow-control diagram:

http://www.advms.pl/roczniki_2005_supl_2/volumes/04_Borowska.pdf

A couple days ago someone asked me how to implement that in source code with NO goto statements. (Because (1) goto statements are evil, and (2) MATLAB doesn't support them.)

Here's the psuedo-code I wrote. It looks right to me? Seemed like a simple task? -ponder-

c=1
j=0
i=-1
k=1
kmax=1
while (1) {
  if (s[i+k]==s[j+k]) {
     k=k+1;
     if (j+k > N-1) {
        c = c+1
        return     # or last or whatever
     }
  } else {
     if (k > kmax) {
        kmax = k
     }
     i = i + 1
     if (i==j) {
        c = c + 1;
        j = j + kmax;
        if (j + 1 > N - 1) {
           return;
        } else {
            i = -1
            k = 1
            kmax = 1
        }
     } else {
        k = 1
     }
  }
}

-----------

WWW SQL Designer is way too cool. 2.0 was released today:

http://ondras.zarovi.cz/sql/

This tool allows you to draw and create database schemas (E-R diagrams) directly in browser, without the need for any external programs (flash). You only need JavaScript enabled.


Data Monkeys represent!


Cheers,

j