Search Amazon.com:
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 $3,400 per month for bandwidth bills alone, and since we don't believe in shoving popup ads to our registered users, we try to make the money back through forum registrations.
  • Post
  • Reply
KARMA!
Jan 22, 2006

I NEED THAT GOD DAMN TWIG!!


Lord Uffenham posted:

You should try Smalltalk.

Surprisingly this applies to a lot of different problems sh/sc-ers have.

Adbot
ADBOT LOVES YOU

KARMA!
Jan 22, 2006

I NEED THAT GOD DAMN TWIG!!


fletcher posted:

How do you ask a senior developer about the formatting of their code without offending them?

It's so hard to read when it's 5,000 lines of:

code:
function getAccRes()
{
if (something) {
              doThis()
}
else
{
      doThat()
}}

Auto-format as you come across them? As long as everyone agrees on the format auto-format generates, you're golden

KARMA!
Jan 22, 2006

I NEED THAT GOD DAMN TWIG!!


shrughes posted:

Many of the people here learned programming with nothing more than the TI-83 manual and trial and error.

How many of us are out there...

KARMA!
Jan 22, 2006

I NEED THAT GOD DAMN TWIG!!


Learning english just comes with the territory. Almost all useful support is in english, the language itself is english and most code is written with english speakers in mind.

KARMA!
Jan 22, 2006

I NEED THAT GOD DAMN TWIG!!


pokeyman posted:

The way I see it, if you're trying to make a living writing code, most of what you write will eventually be either written in C, call into something written in C (the OS, the language runtime, some library you're using), or run on something written in C (a virtual machine, an interpreter). It's really hard to ignore.

And yet you never have to touch any of it! Amazing.

KARMA!
Jan 22, 2006

I NEED THAT GOD DAMN TWIG!!


Suspicious Dish posted:

A large amount of the patterns in GoF feel like they're just workarounds for the lack of first-class functions. A large number of them also don't feel notable.

I've never heard patterns described like this but it makes perfect sense.

Doctor w-rw-rw- posted:

Flash isn't a dying platform, it's an undead platform, because it 's still around (of course it's still everywhere), and isn't going away - but it's not particularly alive, either.

So like java? :that emoticon tef uses all the time:

KARMA!
Jan 22, 2006

I NEED THAT GOD DAMN TWIG!!


Actually you should be using something more akin to notepad but since you're following a class isn't there a teacher you can ask class-specific questions like this?

KARMA!
Jan 22, 2006

I NEED THAT GOD DAMN TWIG!!


jjttjj posted:

Is it acceptable to not model the various image sizes for a given image in the database? Like, to just basically have the image filename as an attribute for Image, and then organize the image sizes in the file system with a different directory for each image size, with the directories set via config variables? And then I could maybe just have a function that gives me the appropriate image path for a given image and filename. This would also mean I don't have to store the actual full image path with the image metadata, just the filename. Is there any reason that I'm missing that this is a bad idea?
Yes, this is reasonable. Not, this is not a bad idea. Only save such information in a db when availability changes per entry (in this case, a Thing). Even then, you'd only add boolean columns, one for every size. But remember, don't invent problems! If you don't need it now, don't put it in.

jjttjj posted:

Would it be better to relate Images to another table Image_Sizes in a many:many relationship so that I could be able to tell if an image size exists without having to do file stuff? Would this be necessarily or strictly better only if some images will not be available in all sizes, or is it a good idea in general to add flexibility to the app in the future?
This is dumb. See above.

jjttjj posted:

Lastly, let's say there's another entity User which will also have a couple images associated with it. Should these images be stored in the same exact manner and in the same table as the Thing Images? Or should there be separate image tables for each? Should all images for all entities be stored in one table?

3 tables.

Entity : all the columns you need for entities, plus id
Images : all the columns you need for images, plus id, plus filename
EntityImages : A junction table that has both entity_id and image_id, plus any specific columns that relate to the entity (example: ordering for albums, which image is the avatar, etc.)

Then you can decide in your code whether to save all images in the same folder, a folder per entity, whatever.

KARMA!
Jan 22, 2006

I NEED THAT GOD DAMN TWIG!!


rolleyes posted:

If you don't want duplicates then, as you've recognised, you can't just generate 6 random choices. One way to approach it is to rephrase the problem as taking the first 6 images from a randomly ordered set. This could be achieved by performing a Fisher-Yates shuffle on your list of images and then selecting the first 6 results from the resulting shuffled list.

Do this.

rolleyes posted:

If you don't want to be performing the shuffle every time you reload the page (for example, if you have a very large list of images) you could store the shuffled list some manner and keep an offset into it which is incremented by 6 whenever the page is loaded. When offset + 6 > listSize, you reshuffle the list, store it again and set the offset back to zero.

Don't do this. Shuffling a list is laughably easy work for a browser.

KARMA!
Jan 22, 2006

I NEED THAT GOD DAMN TWIG!!


Google spreadsheet.

Adbot
ADBOT LOVES YOU

KARMA!
Jan 22, 2006

I NEED THAT GOD DAMN TWIG!!


tarepanda posted:

Is lambda syntax consistent across languages?

What languages?

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