Re: [OT] SQL woes
On Sat, 23 Aug 2003, David Cantrell wrote: > Dominic Mitchell wrote: > > > Many people say the same thing about perl code in general. Like all > > tools you need to know when to say "no". At the moment, we're just > > using triggers to put an mtime field onto all of our rows, and this > > works well. But I'd want to think carefully about more advanced uses. > > I've used a trigger in the past to enforce a constraint - I couldn't > think of any other way to enforce "must be unique or one of [a list of Create a unique index? > values]". Of course, having to use such a constraint probably means Create a not-null join to a table containing only those values? > that my database design was wrong. S. -- Shevekhttp://www.anarres.org/ I am the Borg. http://www.gothnicity.org/
Re: [OT] SQL woes
Dominic Mitchell wrote: Many people say the same thing about perl code in general. Like all tools you need to know when to say "no". At the moment, we're just using triggers to put an mtime field onto all of our rows, and this works well. But I'd want to think carefully about more advanced uses. I've used a trigger in the past to enforce a constraint - I couldn't think of any other way to enforce "must be unique or one of [a list of values]". Of course, having to use such a constraint probably means that my database design was wrong. -- David Cantrell | http://www.cantrell.org.uk/david " We must get users past their misunderstandings of uptime. A reboot doesn't mean that anything broke, there is no hardware or software corrective action taken, so there wasn't any real downtime. " -- overheard in an MS strategy meeting
Re: hash lookup with regex
On Tue, 19 Aug 2003, Martin Bower wrote: > I have 2 hashes, one with 10,000 entries and the other with 5,000, and > these are loaded from a database table(sybase). > > %hash1 contains values such as "111.666.fff.jjj.ccc.222" > %hash2 contains values such as "111.666.fff.___.ccc.222" (where the ___ > can eixst in any position) This is a job for a tree. S. -- Shevekhttp://www.anarres.org/ I am the Borg. http://www.gothnicity.org/
Re: [OT] SQL woes
On Fri, Aug 22, 2003 at 05:59:01PM +0100, Colin Magee wrote: > > SuSE 8.1. As I say, I can see the files installed in usr/bin, as root, but > when I try running it I get all sorts of error messages: > 1."Can't connect to local MySQL server through socket > /var/lib/mysql/mysql.sock". Try checking mysqld is running and that the > socket exists" > 2.When I try to run mysqld independently, or add it to my .bashrc it > doesn't work either. > 3.Even if the above did work, I understand there are a number of other > setup and admin tasks with MySQL. ie. you need to run mysql_install_db, set > permissions, passwords and so forth. It runs as a service, so if installed, root can start it with /etc/init.d/mysqld start if it's not autmatically started. The init.d script does the first-time-startup actions (except setting a root password). HTH -- Chris Benson
Re: [OT] SQL woes
What Linux distro are you running? SuSE 8.1. As I say, I can see the files installed in usr/bin, as root, but when I try running it I get all sorts of error messages: 'it' being the server or the client? 1. "Can't connect to local MySQL server through socket /var/lib/mysql/mysql.sock". Try checking mysqld is running and that the socket exists" ps awx | grep mysqld is a good test for what it suggests 2. When I try to run mysqld independently, or add it to my .bashrc it doesn't work either. safe_mysqld / mysqld_safe is the usual way to start mysqld. running it from .bashrc is a little unusual. 3. Even if the above did work, I understand there are a number of other setup and admin tasks with MySQL. ie. you need to run mysql_install_db, set permissions, passwords and so forth. The database is only for my use, so (1 + 2 + 3) = not straightforward in my book. Have you read http://www.mysql.com/doc/en/Post-installation.html ? 1 and 2 won't work without 3. hth a bit, dave
RE: [OT] SQL woes
On Fri, 22 Aug 2003, Colin Magee wrote: > >What Linux distro are you running? > > SuSE 8.1. As I say, I can see the files installed in usr/bin, as root, but > when I try running it I get all sorts of error messages: > 1."Can't connect to local MySQL server through socket > /var/lib/mysql/mysql.sock". Try checking mysqld is running and that the > socket exists" > 2.When I try to run mysqld independently, or add it to my .bashrc it > doesn't work either. That's not what you need to do. First check that you have the mysql server package installed: rpm -qa | grep mysql will give you a list of all of the mysql packages installed. Like many others SuSE provide several packages and the server may not have been installed by default. Once you have the server package installed make sure it is started at boot: chkconfig --add [package] chkconfig --level [level] [package] on Where [package] is the name of the server package and level is the runlevel you start your system at. > 3.Even if the above did work, I understand there are a number of other > setup and admin tasks with MySQL. ie. you need to run mysql_install_db, set > permissions, passwords and so forth. The rpm will initialist MySQL for you. The frist task will to set the root password as by default there isn't one. > The database is only for my use, so (1 + 2 + 3) = not straightforward in my > book. That's why the rpm does it for you. As I said previously PostgreSQL is pretty much the same. Jason Clifford -- UKFSN.ORG Finance Free Software while you surf the 'net http://www.ukfsn.org/ ADSL Broadband available now
Re: [OT] Decompiling perl2exe apps
On Fri, Aug 15, 2003 at 03:02:27PM +0100, Nicholas Clark wrote: > On Fri, Aug 15, 2003 at 12:46:50PM +0100, Shevek wrote: > > On Fri, 15 Aug 2003, James Campbell wrote: > > > > > I have managed to lose some source code (ahem) for a script that I packaged > > > with perl2exe on a Windows 2000 PC. I have seen a few hints that perl2exe > > > applications can be cracked to reveal the source code. This sound great > > > except the word trivial seems to crop up a lot without actually giving much > > > detail on how to do it. > > > > 'strings' is probably a good start. > > I don't know whether perl2exe hides the source code more effectively than > this, or doesn't even include the source code. > > I'm not sure if 'trivial' solutions involve B::Deparse No, I'm told that the trick is to run it under a debugger (at C level) Put a trap on parse_body. I gather that this is the point where the plain sourcecode is about to be passed into the perl interpreter to be parsed. I've not got access to anything Windows, so I've not tried this. I've no idea if the trick you can do on gdb maps nicely to Windows. On gdb I'd save "stuff" by doing things like call open ... call write ... call close ... at the gdb prompt - ie making direct calls to the OS to open a file handle and save out the memory corresponding to variables, rather than attempting any cut&paste. Nicholas Clark
RE: [OT] SQL woes
>What Linux distro are you running? SuSE 8.1. As I say, I can see the files installed in usr/bin, as root, but when I try running it I get all sorts of error messages: 1. "Can't connect to local MySQL server through socket /var/lib/mysql/mysql.sock". Try checking mysqld is running and that the socket exists" 2. When I try to run mysqld independently, or add it to my .bashrc it doesn't work either. 3. Even if the above did work, I understand there are a number of other setup and admin tasks with MySQL. ie. you need to run mysql_install_db, set permissions, passwords and so forth. The database is only for my use, so (1 + 2 + 3) = not straightforward in my book. >read and learn. As I say, I can see how I would start to use DBI from perl - that's not really the problem. The problem is setting up the database itself, and having a dbase to use and maintain that is as simple as possible. So that's the reason I'm giving up on MySQL and am looking at SQLite. Also, since all dbases vary, that's why I'd like ot understand with SQLite what I need to know that is different, since I have documentation about using perl with Mysql. Colin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Jason Clifford Sent: 23 August 2003 12:02 To: [EMAIL PROTECTED] Subject: RE: [OT] SQL woes On Thu, 21 Aug 2003, Colin Magee wrote: > As a Perl beginner who has realised I need to set up a database, I have to > add that I immediately went for MySQL due to all the attention it seems to > have, and bought a few books to get me started. The whole thing - using > installing etc etc looks hellish complicated AND I haven't even been able to > install it. What Linux distro are you running? Pretty much all of them offer binary packages of MySQL so you should be able to use rpm or apt-get to install it. > All I can see is where the files are installed in my copy of > Linux. So it looks as if you already have to know what you're doing in > order to use it which is useless for a beginner and teh antithesis it seems > to me of what Perl is all about - because you don't already have to know > what you're doing to get started/ use it. I disagree. Installing MySQL is very simple. Using it with perl is as simple as: perldoc DBI read and learn. The same is true for PostgreSQL. Jason Clifford -- UKFSN.ORG Finance Free Software while you surf the 'net http://www.ukfsn.org/ ADSL Broadband available now
RE: [OT] SQL woes
On Thu, 21 Aug 2003, Colin Magee wrote: > As a Perl beginner who has realised I need to set up a database, I have to > add that I immediately went for MySQL due to all the attention it seems to > have, and bought a few books to get me started. The whole thing - using > installing etc etc looks hellish complicated AND I haven't even been able to > install it. What Linux distro are you running? Pretty much all of them offer binary packages of MySQL so you should be able to use rpm or apt-get to install it. > All I can see is where the files are installed in my copy of > Linux. So it looks as if you already have to know what you're doing in > order to use it which is useless for a beginner and teh antithesis it seems > to me of what Perl is all about - because you don't already have to know > what you're doing to get started/ use it. I disagree. Installing MySQL is very simple. Using it with perl is as simple as: perldoc DBI read and learn. The same is true for PostgreSQL. Jason Clifford -- UKFSN.ORG Finance Free Software while you surf the 'net http://www.ukfsn.org/ ADSL Broadband available now
Re: [OT] SQL woes
> Thanks - I did see the module on CPAN but wan't sure if I only needed the > one download. What I can't see there (or at the SQLite site) is a nice > example which shows creates, updates and queries a dbase. If I look at the > books I've got which show the DBI working with MySQL, can I simply transpose > these? What differences with SQLite would you advise I need to look out > for? Hi Colin, To interact with databases in Perl, you use the DBI (database interface) module. This talks to a DBD (database driver) module, such as DBD::SQLite. If you installed DBD::SQLite through one of the CPAN shells, it'll probably make sure you install DBI too. http://www.perladvent.org/2002/3rd/ Is an excellent introduction. +Pete
RE: [OT] SQL woes
>You don't even need to install a separate SQLite; the CPAN module includes everything you need. Thanks - I did see the module on CPAN but wan't sure if I only needed the one download. What I can't see there (or at the SQLite site) is a nice example which shows creates, updates and queries a dbase. If I look at the books I've got which show the DBI working with MySQL, can I simply transpose these? What differences with SQLite would you advise I need to look out for? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Roger Burton West Sent: 22 August 2003 22:58 To: [EMAIL PROTECTED] Subject: Re: [OT] SQL woes On Thu, Aug 21, 2003 at 08:51:49PM +0100, Colin Magee wrote: >So this SQLite seems like a great idea IF it makes setting up and >administering a dbase simple. Unfortunately I just looked up where I can >download it, but didn't see any example code showing it working with Perl, >or any documentation about how to use it with Perl. Please can you inform >what do I have to do/install in order to start creating, updating and >querying the database from Perl? DBD::SQLite. You don't even need to install a separate SQLite; the CPAN module includes everything you need. Roger
Re: [OT] SQL woes
At 09:03 + 8/23/03, Dominic Mitchell wrote: Tony Bowden <[EMAIL PROTECTED]> wrote: > Unchecked they lead to an unmaintainable mess quicker than most other > things can ... Many people say the same thing about perl code in general. Like all tools you need to know when to say "no". At the moment, we're just using triggers to put an mtime field onto all of our rows, and this works well. But I'd want to think carefully about more advanced uses. And in MySQL that's just adding an extra TIMESTAMP field and just don't update that field in an update: it will automatically get the mtime... ;-) *ducks* Liz
Re: [OT] SQL woes
Roger Burton West <[EMAIL PROTECTED]> wrote: > On Thu, Aug 21, 2003 at 08:51:49PM +0100, Colin Magee wrote: > >>So this SQLite seems like a great idea IF it makes setting up and >>administering a dbase simple. Unfortunately I just looked up where I can >>download it, but didn't see any example code showing it working with Perl, >>or any documentation about how to use it with Perl. Please can you inform >>what do I have to do/install in order to start creating, updating and >>querying the database from Perl? > > DBD::SQLite. > > You don't even need to install a separate SQLite; the CPAN module > includes everything you need. And once you've got that installed, you can use dbish from the DBI distribution to do adhoc queries / updates over it. Hmmm, looks like it's migrated to DBI-Shell. I'll have to install that. -Dom -- | Semantico: creators of major online resources | | URL: http://www.semantico.com/ | | Tel: +44 (1273) 72 | | Address: 33 Bond St., Brighton, Sussex, BN1 1RD, UK. |
Re: [OT] SQL woes
Tony Bowden <[EMAIL PROTECTED]> wrote: > On Fri, Aug 22, 2003 at 03:30:48PM +0100, Andy Ford wrote: >> Well thanks for summing that up - it was an interesting read!! >> Currently I use mySQL only and don't really need transactional stuff. >> Now triggers I can see a need for!! > > Triggers at the db level will bite you hard at some point. > > If you're going to have multiple people building your application make > sure you have VERY strict rules on adding triggers. > > Unchecked they lead to an unmaintainable mess quicker than most other > things can ... Many people say the same thing about perl code in general. Like all tools you need to know when to say "no". At the moment, we're just using triggers to put an mtime field onto all of our rows, and this works well. But I'd want to think carefully about more advanced uses. -Dom -- | Semantico: creators of major online resources | | URL: http://www.semantico.com/ | | Tel: +44 (1273) 72 | | Address: 33 Bond St., Brighton, Sussex, BN1 1RD, UK. |
Re: [OT] SQL woes
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > What about Firebird? > > http://firebird.sourceforge.net/ > > does anyone here have personal experience? On paper (well, online) it > compares favorably to PostgreSQL, and it can be easily embedded. It's an excellent browser, much quicker than mozilla on it's own. Oh. Databases. Bother. -Dom -- | Semantico: creators of major online resources | | URL: http://www.semantico.com/ | | Tel: +44 (1273) 72 | | Address: 33 Bond St., Brighton, Sussex, BN1 1RD, UK. |