new in trunk, for fun

8 views
Skip to first unread message

mdipierro

unread,
Nov 12, 2009, 1:39:50 AM11/12/09
to web2py-users
I do not know if this should be in web2py or not but it can be useful
for testing and debugging.

from gluon.contrib.populate import populate

db=DAL()
db.define_table('person',
Field('name'))

db.define_table('dog',
Field('name'),
Field('person',db.person),
Field('description',length=50),
Field('birthdate','date'))

populate(db.person,5) ### guess what it does?
populate(db.dog,10)

print 'owner, dog name, description, birthdate'
for row in db(db.person.id==db.dog.person).select():
print row.person.name, row.dog.name, row.dog.description,
row.dog.birthdate

sample output:

owner, dog name, description, birthdate
masasapo cedutopo M.c..Berridge. an untutored bird s wing is famili
2000-07-31
posodaso todacoco Surely follows that these fiery eruptions at 186 0
2002-06-16
posodaso dutocomo Spread over functioning properly the planet the ec
1997-05-10
masasapo macocedu Modes of protozoa and continually added to be shot
2003-08-30
masasapo cetomaso Circling round and explosively from the flesh avai
1990-07-27
posodaso codacopa Fractions showing a dull white polar cap. illustra
1987-11-26
dudamoso cesotaco Economically; a mastery of which the two feet four
2003-04-02
dudamoso tasapoma Accomplishment would explode and open-sea knife-bl
1994-05-18
samotomo dasapama Highly specialized in which they come to the creat
1998-11-27

Jason (spot) Brower

unread,
Nov 12, 2009, 1:57:32 AM11/12/09
to web...@googlegroups.com
AWSOME This would come in very handy in teaching and testing!

Douglas Soares de Andrade

unread,
Nov 12, 2009, 6:13:27 AM11/12/09
to web...@googlegroups.com
Em Thu, 12 Nov 2009 08:57:32 +0200
"Jason (spot) Brower" <enco...@gmail.com> escreveu:

Hi all,

Totally +1 from me, it helps a lot to make dummy data for testing.

Great work, Massimo =)

mr.freeze

unread,
Nov 12, 2009, 11:08:48 AM11/12/09
to web2py-users
I like it! +1

On Nov 12, 5:13 am, Douglas Soares de Andrade <dsandr...@gmail.com>
wrote:
> Em Thu, 12 Nov 2009 08:57:32 +0200
> "Jason (spot) Brower" <encomp...@gmail.com> escreveu:
>
>
>
>
>
> > AWSOME  This would come in very handy in teaching and testing!
>
> > On Thu, Nov 12, 2009 at 8:39 AM, mdipierro <mdipie...@cs.depaul.edu>

Thadeus Burgess

unread,
Nov 12, 2009, 12:18:55 PM11/12/09
to web...@googlegroups.com
That is sweet.

Now I'm going to go generate 20k plus records to see how my database scales! :)

-Thadeus

Mengu

unread,
Nov 12, 2009, 4:26:35 PM11/12/09
to web2py-users
yes, faker helps too much. thanks for that :)

mr.freeze

unread,
Nov 14, 2009, 6:03:28 AM11/14/09
to web2py-users
I don't see this in gluon.contrib. Did it get pulled?

mr.freeze

unread,
Nov 14, 2009, 6:39:24 AM11/14/09
to web2py-users
On subversion that is.

villas

unread,
Nov 14, 2009, 1:32:54 PM11/14/09
to web2py-users
Like Mr Freeze, I can't find "populate" on Google Code.
Maybe you forgot to add the file?

Álvaro Justen [Turicas]

unread,
Nov 14, 2009, 2:06:03 PM11/14/09
to web...@googlegroups.com
On Sat, Nov 14, 2009 at 16:32, villas <vill...@gmail.com> wrote:
>
> Like Mr Freeze, I can't find "populate" on Google Code.
> Maybe you forgot to add the file?
>
You can found the code at Launchpad (we need to centralize the
development! We need BitBucket! ;-):
http://bazaar.launchpad.net/~mdipierro/web2py/devel/annotate/head%3A/gluon/contrib/populate.py

Great work, Massimo! It'll be very useful.

--
Álvaro Justen
Peta5 - Nós fazemos TV digital
http://www.peta5.com.br/
21. 3021-6001 / 9898-0141

Thadeus Burgess

unread,
Nov 14, 2009, 2:27:09 PM11/14/09
to web...@googlegroups.com
By the way.... I wouldn't run that code.

I just read an article the other day about how hackers will embed code within base64 code, and it ends up extracting an entire programming environment that gives the hacker full access..

Not sure exactly what that code in IUP evals too, but I WOULD NOT trust it.

http://www.devside.net/blog/smf-exploit-like-phpbb-hack

-Thadeus

villas

unread,
Nov 14, 2009, 2:56:29 PM11/14/09
to web2py-users
On Nov 14, 7:27 pm, Thadeus Burgess <thade...@thadeusb.com> wrote:
> By the way.... I wouldn't run that code.
> Not sure exactly what that code in IUP evals too, but I WOULD NOT trust it.

populate.py = 1.1 Mb !!
Maybe Massimo can confirm it's safe :-)

mr.freeze

unread,
Nov 14, 2009, 3:06:33 PM11/14/09
to web2py-users
I decoded it. Appears to just be the giant dictionary of random words
that populate uses. Starts and finishes like this:

{'shoebill': {'a': 1, '187': 1}, 'trout-like': {'parr': 1}, 'fig.':
{'19':
1},.........................................................................................................................................................................................................................'ranks':
{'of': 2}, 'half-second': {'that': 1}, 'volumes': {'of': 1, 'g': 1},

Thadeus Burgess

unread,
Nov 14, 2009, 3:35:18 PM11/14/09
to web...@googlegroups.com
Thanks for decoding it Freeze!

-Thadeus

mr.freeze

unread,
Nov 14, 2009, 3:50:19 PM11/14/09
to web2py-users
My pleasure. Thanks for the heads up!

mdipierro

unread,
Nov 14, 2009, 7:30:41 PM11/14/09
to web2py-users
I need to change that. It is unnecessarily big.

The dictionary maps words into words with a probability to generate
text that seems to make sense but does not. It can be trained to mimic
an existing piece of text.
Reply all
Reply to author
Forward
0 new messages