database

PHP - dynamic menu with submenus

Hello, I've got a menu, that is something like this: <ul id="menu_cat"> <li><a class="cat1" href="#">category 1</a> <ul> <li><a class="cat2" href="#">category 2</a> <ul> <li><a class="cat3" href="#">category 3</a></li> <li><a class="cat3" href="#">category 3</a></li> <li><a class="...

Store an array or hash of booleans in Ruby and Rails

I want to create a set of values in Ruby which I can store and retrieve in a MySQL databse under Rails. In Delphi I would use: //Create an enumeration with four possible values type TColour = (clRed, clBue, clBlack, clWhite); //Create a set which can hold values from the above enumeration TColours = set of TColours; //Create a var...

Storing database connections in session, in a small scale webapp

I have a j2ee webapp that's being used internally by ~20-30 people. There is no chance of significant growth in the number of users. From what I understood there's a trade-off between opening a new DB connection for each request made to the webapp (expensive, but doesn't block other users when the DB is in use), to using the singleton ...

Lookup names in large texts

Hi, What is the best way to parse large texts (5000 words and more), searching names, that are stored in a database? The texts will be multi lingual. My first idea is a rather naive approach, taking all words beginning with a big letter and compare them against the database. But this tends to fail in texts containing lowercase letters ...

Group by string optimization

I'm gonna convert string to integer to optimize group by performance. What do you guys think of the idea? If applicable,then is there a built-in function to convert string to a unique integer in PHP? ...

location based application

Hi all. I am building an application that that will allow people to post information in different areas of a city (for about 10 cities). Do you guys know of any existing (normalized) databases/datasets that have this kind of information? Or would I need to create one from scratch? Any pointers suggestions very much appreciated! ...

How create SQL query that validates friends of friends.

Hello. I have two tables. USER user_id password FRIEND_LIST user_id friend_id If user 1 is friend of user 2 then in friend_list there will be 2 records: 1 2 2 1 Thats how I'm controlling friend list. My question is how can I create an efficient query that validates if a user is a friend of a friend. For example user 1 has in his...

Can anyone suggest a DBMS which is fast and efficient at writes?

I have a project which is going to be write-heavy rather than read-heavy. I was wondering if anyone had any suggestions for open source DBMS setups which are quick at writes? It doesn't necessarily have to be a relational DBMS either; I'm open to suggestions. ...

What are the good resources for database monitoring?

Hey everyone, I was wondering if anyone could point me in the direction of some good resources (web sites, technical articles/journals, books, etc.) related to database monitoring/performance? I am looking to write a paper that explores what kinds of statistics are useful in database monitoring, and to whom they are useful for. So, I...

select maximum score grouped by date, display full datetime

Gday, I have a table that shows a series of scores and datetimes those scores occurred. I'd like to select the maximum of these scores for each day, but display the datetime that the score occurred. I am using an Oracle database (10g) and the table is structured like so: scoredatetime score (integer) ------------...

Simple Database Design Question

Hi, I am developing web application that powered php and mysql. I have table named users, in this table i store some information such as username, first and lastname, telephone number etc.. In my application user can enter some OPTIONAL information such as e-mail newsletter options, company name(if works..) or web site url. All of these ...

Unique BooleanField value in Django?

Suppose my models.py is like so: class Character(models.Model): name = models.CharField(max_length=255) is_the_chosen_one = models.BooleanField() I want only one of my Character instances to have is_the_chosen_one == True and all others to have is_the_chosen_one == False . How can I best ensure this uniqueness constraint is re...

Some kind of Data persistency

Hi to all, Basically what I need to know is this: I have to show a drop down list of countries to my users each country also has a code associated to it. I will have to work with both the country and the code What would be the best approach: -We (the dev.) are thinking about a table in our app database with this data, or XML file. -O...

Hibernate lazy initialization help

Hi, I have an issue trying to delete using hibernate. When I try to delete I get an exception saying that children exist and there is a FK violation. I want to delete the children also but the delete doesn't seem to be cascading. After about a week of trying to fix this issue I read that I should be using HibernateInterceptor to keep...

SQLite3 with NSMutableArray

In my app the user will be able to make/load configurations and each configuration is made up of NSStrings and BOOL values. I need to be able to store the users configurations into a NSMutableArray (there is no set limit to how many rows can be in the array) and store that NSMutableArray into a database. I don't know enough about obj-c ...

Advice on how to write robust data transfer processes?

I have a daily process that relies on flat files delivered to a "drop box" directory on file system, this kicks off a load of this comma-delimited (from external company's excel etc) data into a database, a piecemeal Perl/Bash application, this database is used by multiple applications as well as edited directly with some GUI tools. Some...

How to avoid accidental deletions of databases in Lotus Notes?

I have always worried about users deleting lotus notes databases by accident. We had one such case last week and I want to know how we can lock the databases so that users cannot delete them. Is there a way in Lotus Notes - either at the Db level or server level where we can set up the database so that only the administer of the db or t...

What is the most efficient way to write query to get latest item from collection?

Hi, Sorry about the title. That was the best I could come up with. Anyways, here is my question - I have 2 tables, a Customer table and Order table as shown below: Customer { Long id; String name; String address; Timestamp createdOn; } Order { Long id; String productName; Long customerId; Timestamp createdOn; } Ther...

Searching a database of names.

I have a MYSQL database containing the names of a large collection of people. Each person in the database could could have one or all of the following name types: first, last, middle, maiden or nick. I want to provide a way for people to search this database to see if a person exists in the database. Are there any off the shelf products...

JDBC Connection pooling using C3P0

Following is my helper class to get DB connection: I've used the C3P0 connection pooling as described here. public class DBConnection { private static DataSource dataSource; private static final String DRIVER_NAME; private static final String URL; private static final String UNAME; private static final String PWD; ...