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
jony neuemonic
Nov 13, 2009

Thermopyle posted:

As I've posted in this thread many times, you can write fine code in PHP.

It's just that there's no reason to pick PHP outside of external factors like it's what your boss wants, your infrastructure only supports it, you want to write WP plugins, etc.

That really sums it up, in my opinion.

Modern PHP isn't nearly as bad as its reputation would suggest: 5.4+ cleaned up a number of syntax warts, PHPUnit means unit testing and TDD are available if you want them, the Framework Interop Group has improved the available frameworks, and Composer lets you (finally) manage dependencies per-project like every other language. Unless you're working with legacy code (or just a masochist), the days of spaghetti PHP and mysql_real_escape_string are gone. Working with something like Laravel 4 isn't that far off from Rails or (I assume) Django.

That being said, there's no getting away from the fact that PHP has a history of poor design choices. There's not really any reason to make it your first choice if you're picking the platform.

Adbot
ADBOT LOVES YOU

Mortanis
Dec 28, 2005

It's your father's lightsaber. This is the weapon of a Jedi Knight.
College Slice

fidel sarcastro posted:

There's not really any reason to make it your first choice if you're picking the platform.

My boss really wants ease of finding replacements and ease of moving sites to other servers. My job security is excellent - iron clad, really - but it leaves me in the position of never taking time off and being the only coder for long stretches. We both want to fix that. He's open to choices, as he has no idea about what's out there beyond what buzzwords he comes across, so it's up to me to make suggestions. He's set on PHP now just because he knows about how prevalent it is, but his mind can be changed with facts.

We do a lot of site maintenance, so being able to go back in and add functionality without screaming at the last coder is good. I'd like to find a balance between my boss's need to be able to outsource or bring in outside help if needed and doing it "right" - or as right as I can manage if I'm able to re-design our business from the ground up.

If not PHP, what should I research? I really do like C#, though my only current experience is purely using MVC3 and not basic ASP.NET. It needs to be able to do everything from Mom and Pop sites on up through decent sized commerce.

kedo
Nov 27, 2007

Mortanis posted:

If not PHP, what should I research? I really do like C#, though my only current experience is purely using MVC3 and not basic ASP.NET. It needs to be able to do everything from Mom and Pop sites on up through decent sized commerce.

Stick with PHP in my opinion. Two of the best (again, imo) CMSs out there are written in PHP – WordPress and Drupal – and can easily cover everything from Mom & Pop sites to huge, complex, corporate endeavors.

LP0 ON FIRE
Jan 25, 2006

beep boop
I'm using the html5 video tag, and having issues with a green vertical line showing up on the right side of the video when using Chrome. It doesn't happen with Safari. It's an mp4 in a mov container, and I can't figure out the exact encoding to use to prevent this.

I'm using javascript to change a div's insides like so:

code:
document.getElementById('videoContainer').innerHTML = "<video controls id='videoPlayer' width='854' autoplay>
<source src='"+videoName+"' type='video/mp4'>Your browser does not support HTML5 video.</video>";
The result in Chrome looks like this:



I tried Googling around and all I can find is stuff unrelated about a horizontal green line. I could put it inside another div and get rid of two pixels, but that seems a little unnecessary if there's something about the video I can fix itself. Any ideas?

excidium
Oct 24, 2004

Tambahawk Soars
Try setting your video width to 852.

quote:

After conversion green line - Make sure your video dimensions are divisible by 4. If not you'll see the green line as the codec tries to interpolate the pixels.

LP0 ON FIRE
Jan 25, 2006

beep boop

excidium posted:

Try setting your video width to 852.

No dice. :( I made the changes and cleared the cache and it didn't go away.

Edit: I'm going to get someone to convert the source videos to 852, and maybe that will work. They are all 853x480 which seem a bit strange, but I don't know much about standard video sizes.

Edit2: Just found out I wrote "Nice dice" instead of "No dice" :downs:

LP0 ON FIRE fucked around with this message at 15:20 on Oct 18, 2013

jony neuemonic
Nov 13, 2009

Mortanis posted:

My boss really wants ease of finding replacements and ease of moving sites to other servers. My job security is excellent - iron clad, really - but it leaves me in the position of never taking time off and being the only coder for long stretches. We both want to fix that. He's open to choices, as he has no idea about what's out there beyond what buzzwords he comes across, so it's up to me to make suggestions. He's set on PHP now just because he knows about how prevalent it is, but his mind can be changed with facts.

We do a lot of site maintenance, so being able to go back in and add functionality without screaming at the last coder is good. I'd like to find a balance between my boss's need to be able to outsource or bring in outside help if needed and doing it "right" - or as right as I can manage if I'm able to re-design our business from the ground up.

If not PHP, what should I research? I really do like C#, though my only current experience is purely using MVC3 and not basic ASP.NET. It needs to be able to do everything from Mom and Pop sites on up through decent sized commerce.

The question I'd be asking is how easy is it to find good replacement PHP developers. I don't really have the experience to say one way or the other, but I'm sure someone else will weigh in.

Personally, I'd look into the two things you've already thought about (PHP, C#) as well as Python and Ruby. That should give you a feel for a few good options. But if portability is a major concern, or if you want to take advantage of a pre-built CMS like kedo mentioned, you could do a lot worse than PHP on LAMP.

Oh My Science
Dec 29, 2008
Do you have active .net, ruby, php, or python user groups? What are other companies looking for in the area?

I think .net isn't as sexy as it used to be, so you may have issues finding people. That could be true of any language dependant on your location.

Mortanis
Dec 28, 2005

It's your father's lightsaber. This is the weapon of a Jedi Knight.
College Slice
North of Seattle. You'd think we'd be swimming in C# programmers, but they're pretty good at hiding. On the flip side, there's a flood of PHP programmers, and so many of them are bottom barrel. My boss decided a while back that if we couldn't find ColdFusion programmers, we'd create one. The most promising PHP coder we found at the time was adamant that we'd need to enable Register Globals for his examples to work. It wasn't that he was unaware, he just didn't want to update his precious system.

We opted not to hire that year. Maybe it's just this area.

I'm not sure that portability is a major concern, but my boss is seriously entertaining getting out of the hosting business, and our ColdFusion sites are making that a nightmare. The idea of nice and easy PHP + MySQL sites being able to go up just about anywhere on the planet makes him very happy. So does interchangeable employees that can pick up coding when another is sick or out, which probably removes the use of any beneficial frameworks right off the bat.

On one hand, it's great that he's going down a path that might open a lot of options for me, but it's creating an entirely different set of problems for me in new areas. So as it is with code, so as it is with my job I guess. I'll have a frank discussion with him on PHP and ASP.NET and see where it goes I suppose. Thank you all.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



ASP MVC 3 people seem pretty rare in my area, too, so I view it as a good thing to get on the resume if you like getting paid pretty well :)

Munkeymon posted:

Thanks - that's much closer than I got using table layout trickery, but I was lazy about getting my repro right and it doesn't represent the behavior I need for when the container is vertically smaller than the video element. It's fixed here: http://jsfiddle.net/TGg94/1/ I'll try to get yours working from here http://jsfiddle.net/dEcZ7/2/ but I just had another idea that would require some JS setup, but there's a bunch of that going on anyway in the real thing, so it wouldn't be a huge deal.

Came up with a CSSy description of what I'm trying to do: make a div behave like a centered background image positioned with contain. Unless I'm missing something, I'm pretty sure a table-based layout (meaning display: table) won't respect a set height, so I don't think that's workable.

Right now, all I can think of is creating an overlay by using a canvas to draw it, and then making the result the contain-positioned background of an overlay div. That seems somewhat hacky, but at least I'd really get to know my 'friend', the canvas.

Kobayashi
Aug 13, 2004

by Nyc_Tattoo
I was inspired (by Ghost) to try to sniff URLs on paste. If the URL is a Twitter status URL, grab the tweet and show it in the preview area. From what I can tell, the Twitter 1.1 API doesn't allow anonymous connections, and Javascript security doesn't allow whatever authentication magic needs to happen, so the only solution is to proxy the request through a server. Is that right, or am I overlooking something?

wwb
Aug 17, 2004

Nope, they broke all that unauthenticated stuff though patching it through a server isn't hard so long as you don't get into hundreds of requests per minute and have to start thinking about throttling and such.

Kobayashi
Aug 13, 2004

by Nyc_Tattoo

wwb posted:

Nope, they broke all that unauthenticated stuff though patching it through a server isn't hard so long as you don't get into hundreds of requests per minute and have to start thinking about throttling and such.

Thanks for the confirmation. I know the server stuff isn't that big of a deal, but in case you were wondering, I'm just a designer, so I do little prototypes like this mainly as communication tools. It's much easier for me to throw up a self-contained, strictly client-side HTML page on a random FTP server than to find a suitable hosting environment. Granted we're talking maybe an hour's difference, but it's enough of an impediment to justify the question.

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
Let's talk obnoxious emails. I've noticed that MailChimp/Mandrill offer the ability to store templates in their system and offer their own templating system. The advantage is that your backend doesn't have to hold onto these assets and regular humans can customize and create templates at their whim without having to bother you. Also takes care of injecting the various "unsubscribe" links. Seems like a good deal. Any thoughts?

On a related note, how do you guys handle email triggers in your systems? For example, if user has signed up but hasn't added required data to account after 3 days, send reminder email etc. Mixpanel seems to support pretty fancy querying there, so it seems like one way of handling it rather than having a background process loop through your dataset at all times and check for different conditions.

DreadCthulhu fucked around with this message at 22:59 on Oct 17, 2013

DaveP
Apr 25, 2011

LP0 ON FIRE posted:

Nice dice. :( I made the changes and cleared the cache and it didn't go away.

Edit: I'm going to get someone to convert the source videos to 852, and maybe that will work. They are all 853x480 which seem a bit strange, but I don't know much about standard video sizes.

Work to a standard horizontal width rather than vertical -most decoders and players are much better suited to shoving letter boxing (black bars on top and bottom) on than messing with the horizontal size of a video, as height is the most interchangeable value in video with different aspect ratios. 640x360 or 960x540 will suit your needs, perhaps 1280x720 if you want to go low-end hd

The first website I made just made the long-list for an award, super stoked (Distance to Mars on http://bit.ly/1aqNImc)

Oh My Science
Dec 29, 2008
Mailchimp and Mandrill are awesome. That is all.

Edit: Just because I love the man and nearly anything he says here is another presentation by Mike Monterio.

Oh My Science fucked around with this message at 22:55 on Oct 17, 2013

Kobayashi
Aug 13, 2004

by Nyc_Tattoo

Kobayashi posted:

Thanks for the confirmation. I know the server stuff isn't that big of a deal, but in case you were wondering, I'm just a designer, so I do little prototypes like this mainly as communication tools. It's much easier for me to throw up a self-contained, strictly client-side HTML page on a random FTP server than to find a suitable hosting environment. Granted we're talking maybe an hour's difference, but it's enough of an impediment to justify the question.

Just to follow up, this actually took me a couple of hours. I'm glad I did it, though. Again, since I'm a designer, I like to stick with what I know, which is a little Javascript. I've been toying around with Node for a while, and wrote a super simple server a while back that serves up anything in the app/ directory.

To get this working, I had to *cough cough* "design" a simple little REST API to talk to (/tweet/:id) and figure out how to hook that up in Express. Then I spend some time looking for a Node module to handle the Twitter API. I don't really know what OAuth is and this was not the project that I wanted to learn it. This actually took a while, because most of the modules I saw were written for the old 1.0 API. I guess Twitter really pissed off the developer community.

Next I wasted a lot of time working with the wrong API resource. I was working with "statuses/get/:id" when what I really wanted was "statuses/oembed." After that, I got back to the real goal of the project, which was to continue learning Ember. I managed to hack a similar example I found online, replacing a YouTube lookup/player with a tweet lookup/embedder. Finally, I got some exposure to the Ember run loop, because I needed to find a way to tell re-run the Twitter widgets script after Ember was done updating the DOM with the tweet embed code.

All that work, and I still have:

  • No error checking/validation on the tweet search field
  • An array controller with one model instead of a regular controller because I don't know how Ember templates work that well :(
  • No error checking on the client-side "API" call
  • No error checking on the server-side API call to Twitter
  • No caching on the server, as called for by Twitter
  • Messy-rear end spaghetti code

Respect to people who do this on a daily basis. poo poo's hard.

Oh My Science posted:

Edit: Just because I love the man and nearly anything he says here is another presentation by Mike Monterio.

Mike is awesome. He's hilarious on Twitter too, if you have the right politics for it.

fuf
Sep 12, 2004

haha

DigitalOcean now have a ghost droplet image. I played around with it yesterday - it's pretty cool.

If I use bootstrap to make a site, is there something that will go through bootstrap.css and strip out everything that doesn't get used?

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

fuf posted:

If I use bootstrap to make a site, is there something that will go through bootstrap.css and strip out everything that doesn't get used?

How come you would want to do this? Seems like it would just make it a pain for maintenance and development of new stuff down the road.

Oh My Science
Dec 29, 2008

fletcher posted:

How come you would want to do this? Seems like it would just make it a pain for maintenance and development of new stuff down the road.

Maybe, but bootstrap doesn't have the smallest footprint in the world. Plus you could always keep the full version in your dev environment and just strip it down in production.

fuf
Sep 12, 2004

haha

Oh My Science posted:

Plus you could always keep the full version in your dev environment and just strip it down in production.

Yeah I was hoping to do something like this.

It's a really basic one-page site, but I'm still using bootstrap because I'm bad at css. It pains me to think of all that extra unused bootstrap code getting loaded for no reason.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Munkeymon posted:

Came up with a CSSy description of what I'm trying to do: make a div behave like a centered background image positioned with contain. Unless I'm missing something, I'm pretty sure a table-based layout (meaning display: table) won't respect a set height, so I don't think that's workable.

Right now, all I can think of is creating an overlay by using a canvas to draw it, and then making the result the contain-positioned background of an overlay div. That seems somewhat hacky, but at least I'd really get to know my 'friend', the canvas.

This is the working demo if anyone cares: http://jsfiddle.net/gmD9h/8/

spiritual bypass
Feb 19, 2008

Grimey Drawer

Oh My Science posted:

bootstrap doesn't have the smallest footprint in the world.

It's pretty big in terms of CSS, but it's still only 100k minified. It gets cached by the browser the first time the user hits a page on your site, so it's not really such a burden. Removing a single pointless "share" widget would do as much for site performance.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

fuf posted:

It's a really basic one-page site, but I'm still using bootstrap because I'm bad at css. It pains me to think of all that extra unused bootstrap code getting loaded for no reason.

I wouldn't bother if it's a one-page site. Your browser will cache the file so it won't be loaded every time you visit the site, and if you're browsing a single page application the CSS will only be parsed on the first page load so you're not really losing performance.

Ethereal
Mar 8, 2003

fuf posted:

DigitalOcean now have a ghost droplet image. I played around with it yesterday - it's pretty cool.

If I use bootstrap to make a site, is there something that will go through bootstrap.css and strip out everything that doesn't get used?

If you really wanted to you could write some code to parse through your HTML for all the classes on your elements (assuming you don't dynamically add/remove classes as well) and then strip out anything that's unneeded...it's more work than it's worth. I'd use a CDN for your bootstrap resources that would give you a higher probability of a cache hit like http://cdnjs.com or something.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

Ethereal posted:

If you really wanted to you could write some code to parse through your HTML for all the classes on your elements (assuming you don't dynamically add/remove classes as well) and then strip out anything that's unneeded...it's more work than it's worth. I'd use a CDN for your bootstrap resources that would give you a higher probability of a cache hit like http://cdnjs.com or something.

I've only used it once so I may be misremembering it, but I'm pretty sure Chrome has an optimizer built in that will tell you what CSS classes aren't being used.

Oh My Science
Dec 29, 2008

Bognar posted:

I've only used it once so I may be misremembering it, but I'm pretty sure Chrome has an optimizer built in that will tell you what CSS classes aren't being used.

It does! I think there are a few sites that do the same thing and spit out optimized code. Forget what they are and I'm too sick to look it up.

Alligator
Jun 10, 2009

LOCK AND LOAF

Kobayashi posted:

I was inspired (by Ghost) to try to sniff URLs on paste. If the URL is a Twitter status URL, grab the tweet and show it in the preview area. From what I can tell, the Twitter 1.1 API doesn't allow anonymous connections, and Javascript security doesn't allow whatever authentication magic needs to happen, so the only solution is to proxy the request through a server. Is that right, or am I overlooking something?
For future reference something like https://foauth.org/ might have helped here.

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
For server-side templating and assuming no javascript, is there a different paradigm out there for browser CRUD on a list of db entries than what Rails traditionally does? You know what I'm talking about.. the /new /edit pages, and read/delete all done from the main listing page. With JS you have all sorts of options, from hand-written spaghetti callbacks to using a framework to sync the DOM against the backend, but what about when you don't use JS?

Flaggy
Jul 6, 2007

Grandpa Cthulu needs his napping chair



Grimey Drawer
Odd sort of occurrence, after switching to a CDN my companies website's images stopped being indexed as much. We have about 1000 images that have been crawled with only 59 showing up in organic search. The alt tags, image names and files names are good but wondering what happened. Didn't know if this was the right place to ask.

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb
What do you guys do to keep your CSS organized?

lunar detritus
May 6, 2009


fletcher posted:

What do you guys do to keep your CSS organized?

SASS + imports. It makes dividing the CSS by sections incredibly easy.

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

gmq posted:

SASS + imports. It makes dividing the CSS by sections incredibly easy.

I'm using LESS with imports...but I'm still not quite sure how I should be dividing things up. Right now I basically have a separate file for each widget.

Pollyanna
Mar 5, 2005

Milk's on them.


w3's tutorials on CSS mention predefining the margins and padding due to something something IE doesn't work. Is there a shortcut for this so that I don't have to write "body{margin:0; padding:0;}" for each file I make? Or do I just make a .predef class for HTML/body?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

fletcher posted:

What do you guys do to keep your CSS organized?

LESS. One file for reset / normalization, one file for variables, one file for "base" typography, one file for everything else, with an optional file for responsive rules if having it in the "everything else" file makes it too big.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Pollyanna posted:

w3's tutorials on CSS mention predefining the margins and padding due to something something IE doesn't work. Is there a shortcut for this so that I don't have to write "body{margin:0; padding:0;}" for each file I make? Or do I just make a .predef class for HTML/body?

Do you mean "every CSS file"? Then no, you only have to do it in a single file. Most people have a standard reset or normalize file they include in every single site they make which has the basics in it, and is included before everything else. Then the "real" CSS goes in a file (or files) that are specific to that project.

pipes!
Jul 10, 2001
Nap Ghost

fletcher posted:

I'm using LESS with imports...but I'm still not quite sure how I should be dividing things up. Right now I basically have a separate file for each widget.

The SASS Way has a writeup on how they structure their projects, but it's abstract enough that it should work with LESS. I use something similar.


Pollyanna posted:

w3's tutorials on CSS mention predefining the margins and padding due to something something IE doesn't work. Is there a shortcut for this so that I don't have to write "body{margin:0; padding:0;}" for each file I make? Or do I just make a .predef class for HTML/body?

You want a CSS reset, declared at the beginning of your external, linked CSS stylesheet before any other author-written styles. Normalize and Eric Meyer’s Reset are the current favorites, I believe, although Normalize is less a "zero out everything" approach and more one that provides sensible cross-browser considerations.

E: efb

fuf
Sep 12, 2004

haha

Lumpy posted:

One file for reset / normalization

Lumpy posted:

Most people have a standard reset or normalize file they include in every single site they make which has the basics in it, and is included before everything else.

Any chance you could expand on this a bit (or post a link)? What kind of stuff goes in there?

e: nm pipes posted some links :)

The March Hare
Oct 15, 2006

Je rêve d'un
Wayne's World 3
Buglord

fuf posted:

Any chance you could expand on this a bit (or post a link)? What kind of stuff goes in there?

Check the post directly above yours!

Adbot
ADBOT LOVES YOU

Kobayashi
Aug 13, 2004

by Nyc_Tattoo

fletcher posted:

I'm using LESS with imports...but I'm still not quite sure how I should be dividing things up. Right now I basically have a separate file for each widget.

Next time I work on a substantial project, I think I'm going to try atomic CSS design. The metaphor is quarks (raw tags), atoms (abstract components), and molecules (larger components), plus utilities (resets, etc). Seems like it could be a neat way of doing things. Probably a bit overkill, though.

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