Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

yaoi prophet posted:

probably my biggest frustration with strongly typed haskell is 'okay i want to know what the hell type this is evaluating to so i can fix it', it's easy to do that if the function i'm defining isn't used anywhere else but if it is i have to rename it to foo', let foo = undefined, and check the type of foo'

sounds like a problem with haskell

Adbot
ADBOT LOVES YOU

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
one nice thing about strong typing is the code completion in your ide

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>
neways all these reasons and more are why objective c is the best programming language

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

vapid cutlery posted:

neways all these reasons and more are why objective c is the best programming language

brought to you by the Love-Cox team, lmbo

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

rotor posted:

brought to you by the Love-Cox team, lmbo

Zombywuf
Mar 29, 2008

Is it too much to ask for a language with strong types, type inference, maybe type states, and error messages that aren't "Couldn't infer infinite type t -> t'".

EVGA Longoria
Dec 25, 2005

Let's go exploring!

static vs dynamic typing isn't the problem here the problem is proper variable scoping

if your language doesn't support lexical scoping, get the gently caress out

tef
May 30, 2004

-> some l-system crap ->

yaoi prophet posted:

probably my biggest frustration with strongly typed haskell is 'okay i want to know what the hell type this is evaluating to so i can fix it', it's easy to do that if the function i'm defining isn't used anywhere else but if it is i have to rename it to foo', let foo = undefined, and check the type of foo'

-fdefer-type-errors

http://hackage.haskell.org/trac/ghc/wiki/DeferErrorsToRuntime

Sapozhnik
Jan 2, 2005

Nap Ghost
qfnp

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

EVGA Longoria posted:

static vs dynamic typing isn't the problem here the problem is proper variable scoping

if your language doesn't support lexical scoping, get the gently caress out

Another win for objective c

syntaxrigger
Jul 7, 2011

Actually you owe me 6! But who's countin?

Jonny 290 posted:

so i taught myself more sql with perl this weekend. im scraping the local police dispatch logs, storing them in mysql and then geolocating them all. then i have a client script that calcs distance and alerts me if poo poo goes down within 1 mile radius of my house.

the sql bit was a little tricky b/c timestamps, incident descriptions and addresses can all be duplicated, but all 3 will never be duplicated at once, so I ended up taking an md5 of $timestamp.$desc.$addr and using that as a unique index field. Then since i'm scraping the whole page each minute and will see entries multiple times, i md5 each item and if that index exists, skip. i guess sql can do this but i didnt want to build up a bunch of huge gross queries at 2am saturday night

for the geo i'm doing a v. simple query via geocoder.us, which rate limits to one query every 15 seconds for free accounts, so i set up a background script to build a LIFO queue of items with no location and geolocate them out.

could use this to bench test

https://spotcrime.com/

JG_Plissken
Oct 22, 2005

I went to a four year college and all I got was this stupid look on my face!

Jonny 290 posted:

the sql bit was a little tricky b/c timestamps, incident descriptions and addresses can all be duplicated, but all 3 will never be duplicated at once, so I ended up taking an md5 of $timestamp.$desc.$addr and using that as a unique index field. Then since i'm scraping the whole page each minute and will see entries multiple times, i md5 each item and if that index exists, skip. i guess sql can do this but i didnt want to build up a bunch of huge gross queries at 2am saturday night

That's cool, but md5 is not collison-resistant so their is a chance you could have the same md5 twice. A small chance, but still a chance. If your still playing around with this you might want to find a better way.

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
or for a better use of your time, calculate the odds of a randomly occurring md5 collision

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp
yeah i knew about md5 collisions but accepted that as a limitation of my approach. if this were crit i would have used something else.

gonna try dbix::class tonight. shaggar what are ur thoughts

HORATIO HORNBLOWER
Sep 21, 2002

no ambition,
no talent,
no chance
this is kind of like how every C book in the world is this giant fuckoff doorstop brick of a tome while the only one worth reading, K&R, is a thin svelte little pamphlet that still tells you every single thing you need to know about the language

burn all doorstop tomes forever

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Jonny 290 posted:

yeah i knew about md5 collisions but accepted that as a limitation of my approach. if this were crit i would have used something else.

gonna try dbix::class tonight. shaggar what are ur thoughts

Why didn't you just make a unique constraint for all 3 fields?

Rufus Ping
Dec 27, 2006





I'm a Friend of Rodney Nano

vapid cutlery posted:

Tiny Bug Child posted:

tbh that sounds like a shitton more work than making a unique index on (timestamp, description, address)

lmao

yeah whats the problem here (im not a db guy)

0xB16B00B5
Aug 24, 2006

by Y Kant Ozma Post
among other things, unique indexes on multiple very long string columns is going to destroy insert performance

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
insert performance isn't something most yosposters are known for

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp

Hard NOP Life posted:

Why didn't you just make a unique constraint for all 3 fields?

i think i understand what you're sayin, but none of the fields are guaranteed unique. dispatches can go out at the exact same second, multiple dispatches can go to the same address, and they use macros for the incident description so those can match too. the best way that i could figure out to get a unique identifier for each thing that i could use later to determine if a record existed without a big sql query was to md5 the whole thing, as the one thing that will never happen is same time, same address, same description.

i mean i guess i could just add a serial number field and increment it but it wouldn't be useful in any way i dont think

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

0xB16B00B5 posted:

among other things, unique indexes on multiple very long string columns is going to destroy insert performance

good point, i bet the fraction of a fraction of a second will make a big difference in the dozen-odd daily inserts into this table that will never top 10k rows

let's prematurely optimize the gently caress out of this poo poo

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Jonny 290 posted:

i think i understand what you're sayin, but none of the fields are guaranteed unique. dispatches can go out at the exact same second, multiple dispatches can go to the same address, and they use macros for the incident description so those can match too. the best way that i could figure out to get a unique identifier for each thing that i could use later to determine if a record existed without a big sql query was to md5 the whole thing, as the one thing that will never happen is same time, same address, same description.

i mean i guess i could just add a serial number field and increment it but it wouldn't be useful in any way i dont think

in good sqls and oracle and mssql and maybe mysql you can make a unique constraint over multiple columns

code:
| time | address | description | comment |
| 4:20 | 888 elm | description | 1234567 | # first entry would insert okay
| 4:20 | 555 pin | description | 1234567 | # time and desc match, address doesn't, inserts okay
| 4:20 | 888 elm | description | 8888888 | # (time, address, description) not unique, doesn't insert

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

Jonny 290 posted:

i think i understand what you're sayin, but none of the fields are guaranteed unique.

right, but you said that the three of them together would never be the same---you'd want one unique index on all three columns, not three unique indexes.

but if i was doing it i wouldn't do that to uniquely identify the rows, that would just be a constraint to stop me if i accidentally do something stupid like gently caress up a script so it inserts the same row 500 times. you know that constraint exists irl, so why not codify it in the db?

you prolly do actually also want an auto-incrementing primary key here. let's say someday there's a whole bunch more poo poo that goes with any given dispatch record and you want to make a details page to view it. without that key you have to do something like this to uniquely identify the row:

crime_details.php?timestamp=4:00:23&address=BUTT+ST&description=....

instead of just

crime_details.php?crime_id=5

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Tiny Bug Child posted:

right, but you said that the three of them together would never be the same---you'd want one unique index on all three columns, not three unique indexes.

but if i was doing it i wouldn't do that to uniquely identify the rows, that would just be a constraint to stop me if i accidentally do something stupid like gently caress up a script so it inserts the same row 500 times. you know that constraint exists irl, so why not codify it in the db?

you prolly do actually also want an auto-incrementing primary key here. let's say someday there's a whole bunch more poo poo that goes with any given dispatch record and you want to make a details page to view it. without that key you have to do something like this to uniquely identify the row:

crime_details.php?timestamp=4:00:23&address=BUTT+ST&description=....

instead of just

crime_details.php?crime_id=5

TBC was right, I was about to make this same post :)

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.
420 smoke synthetic keys all day

gently caress a business key as a unique index

JawnV6
Jul 4, 2004

So hot ...

rotor posted:

insert performance isn't something most yosposters are known for

let's all have a big nerdy conversation and just let this slide by! completely unacknowledged!
   - u

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

trex eaterofcadrs posted:

420 smoke synthetic keys all day

gently caress a business key as a unique index

we use a business key as key (because riak) at work because it saves us some queries: we can ask for the record we want instead of querying to see if it exists

and now that leveldb has a bloom filter in riak 1.2 that might actually be more efficient than querying to see if it exists lol

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp

Tiny Bug Child posted:

right, but you said that the three of them together would never be the same---you'd want one unique index on all three columns, not three unique indexes.

but if i was doing it i wouldn't do that to uniquely identify the rows, that would just be a constraint to stop me if i accidentally do something stupid like gently caress up a script so it inserts the same row 500 times. you know that constraint exists irl, so why not codify it in the db?

you prolly do actually also want an auto-incrementing primary key here. let's say someday there's a whole bunch more poo poo that goes with any given dispatch record and you want to make a details page to view it. without that key you have to do something like this to uniquely identify the row:

crime_details.php?timestamp=4:00:23&address=BUTT+ST&description=....

instead of just

crime_details.php?crime_id=5

GOT IT

you own yospos owns

EVGA Longoria
Dec 25, 2005

Let's go exploring!

Tiny Bug Child posted:

right, but you said that the three of them together would never be the same---you'd want one unique index on all three columns, not three unique indexes.

but if i was doing it i wouldn't do that to uniquely identify the rows, that would just be a constraint to stop me if i accidentally do something stupid like gently caress up a script so it inserts the same row 500 times. you know that constraint exists irl, so why not codify it in the db?

you prolly do actually also want an auto-incrementing primary key here. let's say someday there's a whole bunch more poo poo that goes with any given dispatch record and you want to make a details page to view it. without that key you have to do something like this to uniquely identify the row:

crime_details.php?timestamp=4:00:23&address=BUTT+ST&description=....

instead of just

crime_details.php?crime_id=5

tbc actually says a right thing

Zizzyx
Sep 18, 2007

INTERGALACTIC CAN CHAMPION

it is difficult to have bad opinions about database schema

0xB16B00B5
Aug 24, 2006

by Y Kant Ozma Post
normalization is for faggots

0xB16B00B5
Aug 24, 2006

by Y Kant Ozma Post
nah that was pretty easy

syntaxrigger
Jul 7, 2011

Actually you owe me 6! But who's countin?

0xB16B00B5 posted:

normalization is for faggots

syntaxrigger
Jul 7, 2011

Actually you owe me 6! But who's countin?

0xB16B00B5 posted:

nah that was pretty easy

Zizzyx
Sep 18, 2007

INTERGALACTIC CAN CHAMPION

you don't really believe that

0xB16B00B5
Aug 24, 2006

by Y Kant Ozma Post
scalar valued functions are great for formatting your output from your db

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

rotor posted:

insert performance isn't something most yosposters are known for

salted hash browns
Mar 26, 2007
ykrop
nosql more like no girls

syntaxrigger
Jul 7, 2011

Actually you owe me 6! But who's countin?

salted hash browns posted:

nosql more like no girls

no girls.....never girls

Adbot
ADBOT LOVES YOU

Dans Macabre
Apr 24, 2004


syntaxrigger posted:

no girls.....never girls

I never read this thread, just came here to ally oop, find out I'm in it

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply