Hi Jim. I've been playing with your recent EBNF posting, expanding on the
idea. Nice. Thanks Jim/Chris.
Web stufff:
I evaluated
USING: db.types db.tuples db.sqlite io.directories fry db calendar ;
TUPLE: entity id author date content ;
entity "entity" {
{ "id" "ID" INTEGER +db-assigned-id+ }
{ "author" "AUTHOR" { VARCHAR 256 } +not-null+ } ! uid
{ "date" "DATE" TIMESTAMP +not-null+ }
{ "content" "CONTENT" TEXT +not-null+ }
} define-persistent
: blog-db ( -- db ) "adhoc" home prepend-path [ make-directories ] [
"adhoc.sqlite" append-path ] bi <sqlite-db> ;
: with-blog-data ( quot -- ) '[ blog-db _ with-db ] call ; inline
: init-db ( -- ) [
entity ensure-table
] with-blog-data ;
at the listener prompt.
Then I evaluated
"adhoc" home prepend-path "Look in: " prepend .
and did not see the expected adhoc directory.
A file called "adhoc.sqlite" should appear upon execution of init-db, or
nothing further can work, so please remind me of the results of the above
two expectations.
Do you mean I should see an adhoc folder containing file adhoc.sqlite?
There was however, an hold adhoc directory under my user directory from
last week (which I deleted to test the new code), when I was playing with
your first sample of web-server code.
This
"adhoc" home prepend-path "Look in: " prepend .
doesn't make a directory. It only makes the full path to folder adhoc, and
then displays the path.
Shaping
From: Jim mack [mailto:j...@less2do.com]
Sent: 2010-November-18, 12:46
To: factor-talk@lists.sourceforge.net
Subject: Re: [Factor-talk] loading of webapps.site-watcher
We can't seem to get the below simple high level db-tuple example going,
which may be easier to debug if it is sqlite problem. Shaping, this prints
a folder to 'Look in:'. Does it actually create that folder? If not, we
have a permissions problem, perhaps. A file called "adhoc.sqlite" should
appear upon execution of init-db, or nothing further can work, so please
remind me of the results of the above two expectations.
USING: db.types db.tuples db.sqlite io.directories fry db calendar ;
TUPLE: entity id author date content ;
entity "entity" {
{ "id" "ID" INTEGER +db-assigned-id+ }
{ "author" "AUTHOR" { VARCHAR 256 } +not-null+ } ! uid
{ "date" "DATE" TIMESTAMP +not-null+ }
{ "content" "CONTENT" TEXT +not-null+ }
} define-persistent
: blog-db ( -- db ) "adhoc" home prepend-path [ make-directories ] [
"adhoc.sqlite" append-path ] bi <sqlite-db> ;
: with-blog-data ( quot -- ) '[ blog-db _ with-db ] call ; inline
: init-db ( -- ) [
entity ensure-table
] with-blog-data ;
"adhoc" home prepend-path "Look in: " prepend .
init-db
entity new "Jim" >>author now >>date "blog entry" >>content
[ insert-tuple ] with-blog-data
entity new "Shaping" >>author now >>date "blog entry reply" >>content
[ insert-tuple ] with-blog-data
[ entity new select-tuples ] with-blog-data
[ "select * from entity order by author" sql-query ] with-blog-data
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk