Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

standalone database

Name: Anonymous 2009-02-04 20:23

I'm working on an app that is basically a ui and a database.  How should I implement the database?

For the sake of the argument pretend it's for an iTunes/Foobar type music player.

inb4 no help at all

Name: Anonymous 2009-02-04 20:29

sorry, your question sucks.

Name: Anonymous 2009-02-04 20:33

I was thinking flat-file or xml, but I have no idea about these things.

Name: Anonymous 2009-02-04 20:36

>>2
C'mon, man.  The thread below mine right now is asking how to separate the digits of three digit numbers in Java and he got an answer.  How could this be the worst question?

Name: Anonymous 2009-02-04 20:39

I agree with >>2, but you're probably looking for sqlite.

Name: Anonymous 2009-02-04 20:42

>>5
DON'T HELP HIM!!!

Name: Anonymous 2009-02-04 20:50

>>5
I was going to go with sqlite if I ended up using an embedded db.  I'm just wondering if that's the best solution.  I'm trying to figure out what some popular music players use for user data atm.

Name: Anonymous 2009-02-04 21:10

>>7

why didnt you say this in the orginal question instead of asking

" WHATS THE BEST WAY TO IMPLEMENT A DATABASE?"

Name: Anonymous 2009-02-04 21:19

Microsoft Access
seriously

Name: Anonymous 2009-02-04 21:31

>>8
Just because I don't store it as an SQL database doesn't mean it's not a database.

Name: Anonymous 2009-02-04 21:33

>>10
I'm sorry, you cannot be helped your too far gone.

Name: Anonymous 2009-02-04 22:01

>inb4 no help at all
welcome 2 /prog/

Name: Anonymous 2009-02-04 22:08

SQLite
[/tread]

Name: Anonymous 2009-02-04 22:09

>>12
You are doing it in a manner that is incorrect.

Name: Anonymous 2009-02-04 22:25

>>7
Songbird uses SQLite, for one.

(In before songbird is shite.)

Name: Anonymous 2009-02-04 22:49

Ok, I'll give sqlite a go.  Suck it, everyone on /prog/

Name: Anonymous 2009-02-04 22:54

>>16
Don't blame us for the incoherence of your questions or your inability to parse sentences, dude.

Name: Anonymous 2009-02-05 0:00

>>17
Well, my excuse is that parsing sentences is NP complete.
Thread over.

Name: Anonymous 2009-02-05 0:00

Use MorkDB

Name: Anonymous 2009-02-05 4:04

>>3
Just for even considering the use of XML for a database, you now must repeatedly bludgeon yourself with a Data Structures and Algorithms textbook. Make sure to use one that's at least 500 pages.

Name: Anonymous 2009-02-05 4:15

>>20
I'm not >>3 but is XML really that bad?

Name: Anonymous 2009-02-05 4:20

>>21
Your problem seems simple, and XML is probably an overkill, and not really that suitable for your problem.

Name: Anonymous 2009-02-05 4:23

>>22
what about his problem?

Name: Anonymous 2009-02-05 4:59

>>21
XML is like violence. If it doesn’t solve the problem, use more. XML works but there are better ways for storing data.

Name: Anonymous 2009-02-05 5:08

>>21
No, it is just a really fucking stupid way to store data. You can't search it without sequentially reading and parsing the whole file, you can't store a single record without rewriting the whole file, and you can't remove a record without rewriting the whole file.

Out of the four CRUD operations, there's three that are basically impossible to do with any sort of efficiency. Why again do you think XML is at all worthwhile as a data format?

Name: Anonymous 2009-02-05 6:59

>>26
While I don't use XML for storing data myself, it does have the advantage of being human readable/modifiable.

Name: Anonymous 2009-02-05 8:31

>>25
I chuckled at CRUD.

Name: Anonymous 2009-02-05 8:33

>>27
That's a really common databse term.

>>26
Way to reply to yourself there. ;)

XML is far from human-readable. You're just as well off editing the output from mysqldump. It's a hideous format, with stupendously commplicated character escaping rules that are highly dependent on the location of data (< is special, except in a CDATA block where anything is valid (except for the sequence ]]>, which is incidentally perfectly valid outside of a CDATA block!) a <!-- comment --> can't have -- in it even though that's valid elsewhere; you can have unescaped quote marks except in strings where they need to be &-escaped; certain characters are invalid everywhere even when escaped so you can't reference \x02 in an XML file, even if you try to write it as ... except for within CDATA blocks where &-escapes don't get interpreted at all.

Incidentally, a flat text-file format is actually human readable and modifiable, more so than XML; and in addition, it's more straightforward, easier to parse, faster to implement, and every bit as portable.

As for SQL, it can be human readable and modifiable, and DBMSes typically come with several tools to make it easy to modify and manipulate the data in a sane manner so that Joe Random User doesn't fuck everything up for your application. Every SQL engine has some prompt, which can be used to edit the raw data if desired or necessary; and most of them have some form of access control built in, if you need that. Does your XML do that?

Oh and if you really want to edit the data in a text editor for some reason, you can use pg_dump, mysqldump, etc., manipulate it as a set of INSERT statements, and then reload it into the database -- or even into another database, if you want. If you're more inclined to editing it in a more grid-like format, many databases offer a way to export to CSV or similar. (Does your XML do that?)

ENTERPRISE databases naturally require a db server, which reduces portability somewhat, but it's quite easy to install something like mysql or postgres on your own computer; aside from that, since SQLite is self-contained, you've got portability as well. (And it still offers most, if not all, of the features that you're actually likely to use for an application where portability is even of the slightest concern.)

Name: Anonymous 2009-02-05 8:34

... Oh what the hell, shiichan allows random character escapes?! Nice.

Name: Anonymous 2009-02-05 9:27

So now I've learned something.  /prog/ is still an easier way to learn than textbooks or google.  Suck it.

Name: Anonymous 2009-02-05 18:18

>>25
and you can't remove a record without rewriting the whole file
This is notoriously false. You can overwrite it in-place with whitespace.
you can't store a single record without rewriting the whole file
If you store it at the end, you just need to truncate the file a bit and then write the new record.

DISCLAIMER: Albeit both databases and XML suck, the latter is fucking terrible. It's a way to scream to the world "I have no fucking idea about computers, but XML is cool, right?" - if you are confident you need an ENTERPRISE-READY structured data store for a commodity desktop application, then PLEASE PLEASE just use SQLite. If you have any doubts about its capabilities, maybe you'll sleep better knowing both Firefox and the faster-than-light Chrome use it extensively for (almost) all their storage needs. Not to mention countless other well-designed applications.

Name: Anonymous 2009-02-05 18:26

Don't mind me, just testing some
expert
quoting.

Name: Anonymous 2009-02-05 19:43

>>32
BBCODE EXPERTS simply use | since shiiichan quotes aren't part of the BBCODE STANDARD

Name: Anonymous 2009-02-05 19:47

>>32

USING THAT QUOTE IS THE EQUIVALENT OF USING A GOTO STATMENT, ITS SIMPLY NOT DONE.

Name: Anonymous 2009-02-05 19:54

| USING THAT QUOTE IS THE EQUIVALENT OF USING A GOTO STATMENT, ITS SIMPLY NOT DONE.

I USE GOTO ALL THE TIME!

Name: Anonymous 2009-02-05 21:50

I never don't use goto

Name: Anonymous 2009-02-05 22:25

10 PRINT "GOTO MY ANUS"
20 GOTO 10

Name: Anonymous 2009-02-05 22:31

label :: String -> [IO a] -> IO ()
goto :: String -> IO ()

main = do
    putStrLn "HAX "
    label "haxing" do
    putStrLn "MY ANUS"
    goto "haxing"
    putStrLn "J/K lol"


Halp how do I implement goto in haskell

Name: Anonymous 2009-02-05 22:31

I keep reading it as gotō, fucking Nips are messing with my head.

Name: Anonymous 2009-02-06 0:03

ゴトー

Name: Anonymous 2009-02-06 0:40

>>39
fuck you。

Name: Anonymous 2009-02-06 11:31

>>38
main = do
    putStrLn "HAX "
    let haxing = putStrLn "MY ANUS" >> haxing in haxing
    putStrLn "J/K lol"

Name: Anonymous 2009-02-06 12:26

e

Name: Anonymous 2009-02-06 17:33

>>40
ごとう

Name: Anonymous 2009-02-06 17:43

>>38
{-# LANGUAGE DeriveDataTypeable #-}

import Control.OldException
import Data.Dynamic

main :: IO ()
main = do
    putStr "HAX "
    label "haxing" $ do
    putStrLn "MY ANUS"
    goto "haxing"
    putStrLn "J/K lol"


data Goto = G String deriving (Typeable)

label :: String -> IO a -> IO ()
label d k = m
    where
    m = catchDyn (k >> return ()) (\(G t) -> if d == t then m else goto t)

goto :: String -> IO ()
goto = evaluate . throwDyn . G

Name: Anonymous 2009-02-07 0:25

>>45
sup p`s`j

Name: Anonymous 2009-02-07 22:00

Name: Anonymous 2009-02-07 23:00

Are you using SQLite yet?

Don't change these.
Name: Email:
Entire Thread Thread List