database

Efficient way to display Inbox(1) count in a webapp w/o calling DB for each page request

In my web application we have built a message center / inbox functionality, in the navigation of each page we link to the "Message Center" and include next to it a count of the unread messages, for example "Message Center (2)". To populate the (2), with each request we run a *SELECT COUNT(*) FROM MessageTable WHERE unread = true blah bl...

iPhone sqlite3 locked, can only read, not write.

So I have been working on this project for a short while now. I have no problems with reading data from the DB, and formatting it into UITableViews and what not. But now I am wanting also to write to the DB as well. The problem is I keep getting a "Database is Locked" error from sqlite. After messing around with the original version I ha...

How develop a financial software in Qt?

I want to create a little finance-software for my association. I want to keep it simple and easy-using, creating new persons should be possible, and every person has entries and costs. The programm should calculate the sum in every step and the total of every person. Now my question: What is a good way to realize that? I thought about SQ...

mySQL - A new table of each page?

Every page on my application will display 1000 records and they are only needed on that page. Is it more efficient to have one huge table with an additional 'page id' column or to have a new table for each page? I imagine accessing data from a single small table would be easier than a huge one but it will make the database a bit of a m...

Database for microblogging startup

Hello, I will do microblogging web service (for school, so don't blast me for lack of new idea) and I worry that DB could be often be overloaded (user could following other users or even tag so I suppouse that SELECT will be heavy - check 20 latest messages which contains all observing tags and user). My idea is create another table, an...

How-to store a questionary in database

How-to store a questionary in database and maintain it using Enity Framework and ASP.NET ? I have couple of question with certain numbers of answers.This questions are part of an users registration formular. Something like: Aaaaaaaa? Checkbox1 - bbbbbbb Checkbox2 - ccccccc Checkbox3 - ddddddd Checkbox4 - eeeeeee and more questions.....

Finding ways to not check a db regularly in rails..

Hi all- I have an application wherein the application will need to check whether one user is waiting for another user whenever a page is loaded. I have entries that look like this: def self.up create_table :calls do |t| t.string "user1_id" t.string "user2_id" t.boolean "active", :default=>false t.strin...

How to show multiple results from MySQL Array

Here is my current code: $sql = "SELECT * FROM user_posts"; $result = mysql_query($sql); $row = mysql_fetch_array($result); while ($row = mysql_fetch_array($result)) { print $row['message']; } My goal is to show all of the data in that SQL database through an array. But currently, it only shows the latest one and not...

How can I fetch a single count value from a database with DBI?

The following code seems to be just too much, for getting a single count value. Is there a better, recommended way to fetch a single COUNT value using plain DBI? sub get_count { my $sth = $dbh->prepare("SELECT COUNT(*) FROM table WHERE..."); $sth->execute( @params ); my $($count) = $sth->fetchrow_array; $sth->finish; ret...

Can I have 2 unique columns in the same table?

I have 2 tables: roomtypes[id(PK),name,maxAdults...] features(example: Internet in room, satelite tv) Can both id and name field be unique in the same table in mysql MYISAM? If the above is posible, I am thinking of changing the table to: features[id(PK),name,roomtypeID] ==> features[id(PK),name,roomtypeNAME] ...because it is he...

hibernate: create table with names in lowercase

Hibernate: I want to have hibernate automatically generate my tables with names in lowercase. For example, if my class is called com.myapp.domain.Customer, hibernate will generate a table named Customer. I want it to be called customer. I know I can use the @Table annotation to specify the table name per class. But I want it to happen "...

Should I make specification table referenceable?

Since I know there are lots of expert database core designers here, I decided to ask this question on stackoverflow. I'm developing a website whose main concern is to index every product that is available in the real world, like digital cameras, printers, refrigerators, and so on. As we know, each product has its own specifications. For...

How does Wikipedia avoid duplicate entries?

How can websites as big as Wikipedia sort duplicated entries out? I need to know the exact procedure from the moment that user creates the duplicate entry and so on. If you don't know it but you know a method please send it. ----update---- Suppose there is wikipedia.com/horse and somebody afterward creates wikipedia.com/the_horse this...

What is the future of Class::DBI?

Does anyone know what is the status of Class::DBI? I see that it was last updated on 4 October 2007, is anyone still working on this project or is it just left to die? Thank you. ...

asp.net with javascript

hello.. How can i insert a javascript in database as a record in ASP.net... with the help of stored procedure... ...

How to make ActiveRecord work with legacy partitioned/sharded databases/tables?

Hi all, thanks for your time first...after all the searching on google, github and here, and got more confused about the big words(partition/shard/fedorate),I figure that I have to describe the specific problem I met and ask around. My company's databases deals with massive users and orders, so we split databases and tables in various ...

Optimising Mysql Databases

I am planning to research how to improve my Databases (in speed , quality,queries ,transaction , indexes ) and i would like to know what are the best books for that. I would like the links to the books on where I could download them/buy. I wanna find out how to improve the speed on my database engine , what mistakes should I avoid or wh...

Evolutionary Database Migration and Default Data

Hi, we're re-evaluating our database upgrade process for our application to try and remove the pain of having to generate all the upgrade scripts for a release at the end of the release cycle. We're looking to move towards a more evolutionary process, using migrations which are checked in alongside features with a tool such as migrator...

How would you design this DB?

Hi, We are launching a website (paid subscription) and the sign up process includes entering an activation code. Activation codes are printed on scratch cards and sold via offline channels. Some of these cards are for 1 month access. Others are for 3 months and 1 year. Activation codes are unique 10-digit random numbers. When the acces...

mysql - storing comma separated string more efficiently

I am working on an application where users 'fight' to own larger parts of the map. Each map is made of a 1000 regions. Now my initial plan was to store the areas a user owns as a comma separated string e.g a user owns regions one to ten 1,2,3,4,5,6,7,8,9,10 Problem is a user could potentially own all 1000 which means it could be a str...