473,808 Members | 2,869 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

database or file for name generator ?

I am making a random name generator, it will pick two or three words
from a list and turn them into a name. It seems a database needs to
work with name/value pairs, so am I right in thinking for a simple
list, seperated by line breaks, a file is the most sensible choice ?
If so, what happens if someone else tries to write to the file whilst
I am working with it ?
Jul 17 '05 #1
9 2042
charlie fortune wrote:
I am making a random name generator, it will pick two or three words
from a list and turn them into a name. It seems a database needs to
work with name/value pairs, so am I right in thinking for a simple
list, seperated by line breaks, a file is the most sensible choice ?
If so, what happens if someone else tries to write to the file whilst
I am working with it ?


Define "working"

Normally you need locking if multiple writers are possible.

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Jul 17 '05 #2
John Bokma wrote:
charlie fortune wrote:

I am making a random name generator, it will pick two or three words
from a list and turn them into a name. It seems a database needs to
work with name/value pairs, so am I right in thinking for a simple
list, seperated by line breaks, a file is the most sensible choice ?
If so, what happens if someone else tries to write to the file whilst
I am working with it ?

Define "working"

Normally you need locking if multiple writers are possible.

By definition

"it will pick two or three words
from a list and turn them into a name"


is not random, the degree of entropy proposed is open to any brute force
attack.
Jul 17 '05 #3
charlie fortune wrote:
I am making a random name generator, it will pick two or three words
from a list and turn them into a name. It seems a database needs to
work with name/value pairs, so am I right in thinking for a simple
list, seperated by line breaks, a file is the most sensible choice ?
If so, what happens if someone else tries to write to the file whilst
I am working with it ?


Any SQL database takes care of concurrency for you.

Any system managing data faces the question, do you learn a database like
the ever-popular MySQL, or do you just code up a couple of quick tricks
yourself. It always seems to make sense to code up a few quick routines
because it seems the initial needs are small. But if the site is
successful you will need more and more features and you will keep
"tweaking" your data handling functions. In short, the real question then
becomes, do you learn a database or do you write one? By then learning
seems a lot easier.

--
Kenneth Downs
Secure Data Software, Inc.
(Ken)nneth@(Sec )ure(Dat)a(.com )
Jul 17 '05 #4
Kenneth Downs wrote:
charlie fortune wrote:

I am making a random name generator, it will pick two or three words
from a list and turn them into a name. It seems a database needs to
work with name/value pairs, so am I right in thinking for a simple
list, seperated by line breaks, a file is the most sensible choice ?
If so, what happens if someone else tries to write to the file whilst
I am working with it ?

Any SQL database takes care of concurrency for you.

Any system managing data faces the question, do you learn a database like
the ever-popular MySQL, or do you just code up a couple of quick tricks
yourself. It always seems to make sense to code up a few quick routines
because it seems the initial needs are small. But if the site is
successful you will need more and more features and you will keep
"tweaking" your data handling functions. In short, the real question then
becomes, do you learn a database or do you write one? By then learning
seems a lot easier.

Kenneth

Concur
Jul 17 '05 #5
NSpam wrote:
Kenneth Downs wrote:
charlie fortune wrote:

I am making a random name generator, it will pick two or three words
from a list and turn them into a name. It seems a database needs to
work with name/value pairs, so am I right in thinking for a simple
list, seperated by line breaks, a file is the most sensible choice ?
If so, what happens if someone else tries to write to the file whilst
I am working with it ?


Any SQL database takes care of concurrency for you.
Any system managing data faces the question, do you learn a database like
the ever-popular MySQL, or do you just code up a couple of quick tricks
yourself. It always seems to make sense to code up a few quick routines
because it seems the initial needs are small. But if the site is
successful you will need more and more features and you will keep
"tweaking" your data handling functions. In short, the real question
then
becomes, do you learn a database or do you write one? By then learning
seems a lot easier.

Kenneth

Concur

If one uses a file as a semaphore then go with the low overhead global
file locking solution. If one needs a transaction that requires non
atomic row level locking then go for an RDBMS.
Ah hell, its horses for courses, what information do you need locked and
for how long ?

Get on with it guys, we all know that finding the solution that matches
the problem is the real question <g>
Jul 17 '05 #6
I'm pretty new, and still learning PHP, and this is really an
excersize for myself. I was going to use DBM because it seemed a bit
more sophistocated, but it was the name/value pair thing that made me
feel it was redundant. In a list, there are no 'keys', so I couldn't
even work out how to do it in a databse. Unless I had one field with
an array as the value. But then why bother with a database. Locking
seems suitable to stop two people trying to write concurrently.
Jul 17 '05 #7
NSpam wrote:
John Bokma wrote:
charlie fortune wrote:

I am making a random name generator, it will pick two or three words
from a list and turn them into a name. It seems a database needs to
work with name/value pairs, so am I right in thinking for a simple
list, seperated by line breaks, a file is the most sensible choice ?
If so, what happens if someone else tries to write to the file whilst
I am working with it ?

Define "working"

Normally you need locking if multiple writers are possible.

By definition

"it will pick two or three words
from a list and turn them into a name"


is not random, the degree of entropy proposed is open to any brute

force attack.


But that doesn't mean it's not random. With a dice you can generate a
random number, yet there are just 6 possibilities.

But I agree that picking 2 or 3 words and glueing them together can be
attacked using a dictionary.

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
Jul 17 '05 #8
"charlie fortune" <go****@charlie fortune.com> wrote in message
news:8f******** *************** ***@posting.goo gle.com...
I am making a random name generator, it will pick two or three words
from a list and turn them into a name. It seems a database needs to
work with name/value pairs, so am I right in thinking for a simple
list, seperated by line breaks, a file is the most sensible choice ?
If so, what happens if someone else tries to write to the file whilst
I am working with it ?


Why would you need name/value pairs? Won't a simple list of words do? And
why would you write to the file?
Jul 17 '05 #9
Thats what I mean, I just wanted confirmation that a list was the
right way to go. I need to write to the file if I want to add more
words.
Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1582
by: Jon Franz | last post by:
----- Original Message ----- From: "Jon Franz" <jfranz@neurokode.com> To: "Serge Orlov" <sombDELETE@pobox.ru> Sent: Wednesday, November 19, 2003 2:39 PM Subject: Re: Python Database Objects (PDO) 1.2.0 Released > > Yes, if the .open() is an generator then it must return a sequence of > items > > but only one at a time. If the loop body doesn't keep the result object
11
2239
by: Jeff Wagner | last post by:
I am importing a file which contains a persons name (firstName, middleName, etc). If I define a function to do this, how can I use the variables outside of that function? Here is the code: import string def getName(): data = open("enterName.txt")
14
4076
by: Miranda | last post by:
Hi, I have a ASP/vbscript program that generates random passwords. The problem is I need to insert those passwords into an Access database of 327 clients. I have the random password program generating the 327 passwords, but have had no luck inserting them. =============================================== Here is the code that generates the passwords: =============================================== <% Option Explicit %>
10
3731
by: mike | last post by:
regards: I use Jtidy (api) to translate a HTML file into a "XHTML file". But The "XHTML file" cannot be identified by nokia 6600. Do I miss something important? Or this is Jtidy's weakness or bug? Can someone excellent to tell me the reason. best wishes
2
1605
by: Nickneem | last post by:
I made a key generator according to the specs of a shareware partner so customers can register online. It generates a key from a 'secret' and a combination of name and email / zip and then encrypts with the md5 algorithm. This shareware partner sends the key file in an email to the customer. I'm sorry to ask this perhaps 'stupid' question but: How do I check on my application side if the licence file / bin file is
2
1842
by: Ryan Taylor | last post by:
Hello. I am trying to upload a file and save it in a Sql Server 2000 database. This seems to be working fine. However, when I download the file from SQL Server, it appears that the page that is downloading this file is being appended to the end of the file. So I am accidently modifiying every file that is placed in the database. What follows is my code for uploading and downloading a file, minus the sql code to insert/retrieve the data...
13
8879
by: Daniel Walzenbach | last post by:
Hi, Imagine the following situation: I have an asp.net application which allows uploading files to a SQL Server 2000 database (Files are stored as type "images"). As a next step I would like to implement some way to enable downloading those files from the database which leads me to the following two problems: 1.) How can I create a file "in memory" as I don't want to create temporary files stored on my web server and
2
1841
by: hawat.thufir | last post by:
cross-posted to: mailing.database.myodbc,comp.text.xml I have an xhtml file whose data I'd like to import to MySQL. Unfortunately, mysqlimport will only work with text files. Mixed in with text are some links, URL's, which I'd like to import to the database. For the most part, a copy/paste into a plain-text file would do the trick, but the links get lost in the process. how do I grab the links?
2
2876
by: vinodkus | last post by:
Problem 1I m writing a code to upload a file There are two files form.asp, uploadScript1.asp Code for form1.asp <html> <head> <meta name="GENERATOR" content="Microsoft FrontPage 5.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
0
9600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10374
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10114
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.