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
Munkeymon
Aug 14, 2003

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



nexus6 posted:

What genius at Wordpress thought it was a great idea (and still is) to store absolute URLs in the database? How are you supposed to set up a separate staging/test/preview site without doing a search and replace on the entire database?

Is their development philosophy "gently caress it, we'll do it live"?

PHP sooooooooooo yeah

Adbot
ADBOT LOVES YOU

fuf
Sep 12, 2004

haha

nexus6 posted:

What genius at Wordpress thought it was a great idea (and still is) to store absolute URLs in the database? How are you supposed to set up a separate staging/test/preview site without doing a search and replace on the entire database?

Is their development philosophy "gently caress it, we'll do it live"?

yeah it's annoying.

But even if there were no absolute URLs in wordpress core you'd probably still have to do a search replace because a bunch of plugins use absolute URLs.

Be careful doing a manual search replace on the DB: wordpress stores a bunch of stuff in serialized arrays so if your new url has more or fewer characters than your old url then everything breaks.

wp-cli makes that stuff a lot easier. You can just do "wp-cli search-replace oldurl newurl" and you're set.

Spatulater bro!
Aug 19, 2003

Punch! Punch! Punch!

If you have a little money to spend, WP Migrate DB Pro makes syncing development/production databases trivially simple.

DICTATOR OF FUNK
Nov 6, 2007

aaaaaw yeeeeeah

nexus6 posted:

Is their development philosophy "gently caress it, we'll do it live"?
well see the solution is simple you just need to have a sql sanitization script that runs every time you do a push to a branch in bitbucket i suggest you set up an ansible server and tie the github api int:suicide:

Forgall
Oct 16, 2012

by Azathoth

nexus6 posted:

What genius at Wordpress thought it was a great idea (and still is) to store absolute URLs in the database? How are you supposed to set up a separate staging/test/preview site without doing a search and replace on the entire database?

Is their development philosophy "gently caress it, we'll do it live"?
Could you try something with the hosts file in your test environment?

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane

nexus6 posted:

What genius at Wordpress thought it was a great idea (and still is) to store absolute URLs in the database? How are you supposed to set up a separate staging/test/preview site without doing a search and replace on the entire database?

Is their development philosophy "gently caress it, we'll do it live"?

Well, you see, it's because WordPress is a heinous piece of crap made of piss and poo poo and garbage.

See also: the reason why version control doesn't exist in stock WordPress, which I would consider to be a crucial part of any content MANAGEMENT system.

The Dave
Sep 9, 2003

Well to be fair there is version control for the content in the UI.

nexus6
Sep 2, 2011

If only you could see what I've seen with your eyes

caiman posted:

If you have a little money to spend, WP Migrate DB Pro makes syncing development/production databases trivially simple.

Ah yes, not only do you have to edit the database but it's not even offered as default functionality

My Rhythmic Crotch
Jan 13, 2011

Has anyone here ever integrated google services like Calendar?

Chrome is doing something weird to client.js and I cannot figure it out. So you load client.js like this:
code:
<script src="https://apis.google.com/js/client.js?onload=callback"></script>
And then you eventually need to authenticate like this:
code:
gapi.auth.authorize(
                {
                    'client_id': CLIENT_ID,
                    'scope': SCOPES.join(' '),
                    'immediate': true
                }, self.handleAuthResult);
After viewing and loading the page with no issues for some time, suddenly I'm getting "gapi is not defined". If I open the page in an incognito tab, the problem goes away.

When I get into a state where gapi is not defined, I can manually load client.js from the console with $.getScript, and still, gapi is not defined.

I've been googling and searching, and I don't see anybody having this problem. I don't think it could be caused with interactions from my app, because I can get this failure to happen with the quickstart.html posted in the documentation.

I've experimented with changing the onload parameter in the script tag, no luck there either. Any ideas? I'm pretty drat baffled.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

nexus6 posted:

Ah yes, not only do you have to edit the database but it's not even offered as default functionality

I just did this a couple weeks ago when I went from my dev environment to live. It wasn't actually that big a deal; most of the "stock" WP stuff was smart enough to keep URLs out of the serialized arrays, only one plugin was storing URL info in them. As for the absolute URLs, you can mostly avoid them when authoring, but it takes a lot of effort (e.g. manual linking /buttes/fartes/ instead of using the editor's "link to existing pages" tool). But I'm not defending either practice really, it's a big pain in the rear end. If I didn't know enough to SQLize out the few exceptions I'd have been peeved.

As far as I can tell (for anyone else doing this) you can ignore the absolute URLs in the GUID column of wp_posts. Doesn't seem to actually do anything except be unique.

Heskie
Aug 10, 2002

nexus6 posted:

What genius at Wordpress thought it was a great idea (and still is) to store absolute URLs in the database? How are you supposed to set up a separate staging/test/preview site without doing a search and replace on the entire database?

Is their development philosophy "gently caress it, we'll do it live"?

You can override the Database values with WP_HOME and WP_SITEURL.

Use something like phpdotenv and you can set these as environment variables, or use seperate config files per environment.

Better yet, take a look at roots/bedrock, which is about as good as WordPress allows in terms of a sane project structure.

22 Eargesplitten
Oct 10, 2010



I asked this in the Java thread but didn't get a response, so I'm hoping it will get one here. I'm having a lot of trouble installing Spring Roo on Windows. I've been doing exactly what several different sets of instructions on the spring.io site say. I've unzipped it to a location, set ROO_HOME to that location, added %ROO_HOME\bin to the user and system Path variables, because I wasn't sure which one it needed to be in. I also tried %ROO_HOME%\bin. I even put the ROO_HOME variable into both user and system variables.

This document says that adding the variable is all you need to do. I'm completely lost here. I'm making a new directory, going in there, and trying to start roo. Do I need to have an existing java project with a pom.xml and everything? If I start the roo.bat file, it works just fine, but I can't do anything from the command line.

I also installed Spring STS in hopes that adding the Spring Roo extension would work for command line, no luck.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

This is a general question that isn't quite in any one discipline so I figured I'd ask here. I've a client who wants to embed a panorama 360 noscope picture on their site. I've taken the picture with my Nexus 6p, and it looks pretty sweet, but it seems like there's a lot of ways to do this, including:
- A wordpress plugin (it's a wordpress site) such as: https://wordpress.org/plugins/tags/panorama
- Hack together something with Google Maps: http://www.labnol.org/internet/design/embed-large-pictures-panoramas-web-pages-google-maps-image-viewer/2606/
- A prettier hack of the above: http://streetview-embed.appspot.com/
- Embed a Google+ post as per (looks lame) http://photography.tutsplus.com/tutorials/how-to-embed-google-photo-spheres-on-your-blog-or-website--cms-24980
- Use yet another JS include/library as per the bottom of here: http://www.labnol.org/internet/embed-panorama-images/25510/

The problem being, this is a panorama I've taken on my phone; it doesn't live in Google maps, and I'm not sure I want it to. Do any of you guys have any experience want to chime in what the "best" method is?

Sedro
Dec 31, 2008

22 Eargesplitten posted:

I asked this in the Java thread but didn't get a response, so I'm hoping it will get one here. I'm having a lot of trouble installing Spring Roo on Windows. I've been doing exactly what several different sets of instructions on the spring.io site say. I've unzipped it to a location, set ROO_HOME to that location, added %ROO_HOME\bin to the user and system Path variables, because I wasn't sure which one it needed to be in. I also tried %ROO_HOME%\bin. I even put the ROO_HOME variable into both user and system variables.

This document says that adding the variable is all you need to do. I'm completely lost here. I'm making a new directory, going in there, and trying to start roo. Do I need to have an existing java project with a pom.xml and everything? If I start the roo.bat file, it works just fine, but I can't do anything from the command line.

I also installed Spring STS in hopes that adding the Spring Roo extension would work for command line, no luck.

The environment variable syntax on windows is %ROO_HOME% not %ROO_HOME

You probably need to restart explorer.exe (or logout/reboot) for environment variables to stick, although it depends on the version of windows.

You can shift-right click on the new directory, "Open command window here", then type "echo %PATH%" and see if the value is correct

Anony Mouse
Jan 30, 2005

A name means nothing on the battlefield. After a week, no one has a name.
Lipstick Apathy

Scaramouche posted:

This is a general question that isn't quite in any one discipline so I figured I'd ask here. I've a client who wants to embed a panorama 360 noscope picture on their site. I've taken the picture with my Nexus 6p, and it looks pretty sweet, but it seems like there's a lot of ways to do this, including:
- A wordpress plugin (it's a wordpress site) such as: https://wordpress.org/plugins/tags/panorama
- Hack together something with Google Maps: http://www.labnol.org/internet/design/embed-large-pictures-panoramas-web-pages-google-maps-image-viewer/2606/
- A prettier hack of the above: http://streetview-embed.appspot.com/
- Embed a Google+ post as per (looks lame) http://photography.tutsplus.com/tutorials/how-to-embed-google-photo-spheres-on-your-blog-or-website--cms-24980
- Use yet another JS include/library as per the bottom of here: http://www.labnol.org/internet/embed-panorama-images/25510/

The problem being, this is a panorama I've taken on my phone; it doesn't live in Google maps, and I'm not sure I want it to. Do any of you guys have any experience want to chime in what the "best" method is?


My first impulse was to use three.js somehow but that's just me.

22 Eargesplitten
Oct 10, 2010



Sedro posted:

The environment variable syntax on windows is %ROO_HOME% not %ROO_HOME

You probably need to restart explorer.exe (or logout/reboot) for environment variables to stick, although it depends on the version of windows.

You can shift-right click on the new directory, "Open command window here", then type "echo %PATH%" and see if the value is correct

Well, now I got it on the path variable, and if I type %ROO_HOME%\bin\roo, it starts roo, but just entering roo in the command line by itself like I would java or mvn doesn't work.

This seems kind of out of the realm of development, is there a thread where this would fit better or should I just open a Haus of Tech Support thread?

22 Eargesplitten fucked around with this message at 19:43 on May 31, 2016

Pollyanna
Mar 5, 2005

Milk's on them.


Is there any particular requirement for my application to specifically follow a RESTful API setup, and have every operation a user might want to do be related to a particular resource? For context, I'm making an application that's basically a directory for internal assets (brochures, documents, images, etc.), where each asset can have many tags, and you can filter by a particular set of tags. Nothing too complicated, but it's not a plain data store where every data model has the same set of CRUD operations. There's a modicum of complex user behavior and interaction involved.

The typical "generate REST resources" workflow with frameworks like Rails helps me get the data models down, but I'm wondering if I actually need full CRUD operations on every single models, like for tags - I'm not sure in what case I would need to PATCH a /tag/:id endpoint or GET a /users endpoint. Basically, I've only ever been taught to make web apps that line up directly to REST operations, and I'm not sure how to approach them for anything that has non-REST functionality (search, filtering, etc.). Any tips?

Depressing Box
Jun 27, 2010

Half-price sideshow.
Generally, I see things like searching/filtering handled in the query string. So something like filtering posts by tag would be GET /posts?tags=foo|bar, searching would be GET /posts?search="Lorem ipsum.", etc.

Depressing Box fucked around with this message at 20:24 on May 31, 2016

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

Pollyanna posted:

Is there any particular requirement for my application to specifically follow a RESTful API setup, and have every operation a user might want to do be related to a particular resource? For context, I'm making an application that's basically a directory for internal assets (brochures, documents, images, etc.), where each asset can have many tags, and you can filter by a particular set of tags. Nothing too complicated, but it's not a plain data store where every data model has the same set of CRUD operations. There's a modicum of complex user behavior and interaction involved.

The typical "generate REST resources" workflow with frameworks like Rails helps me get the data models down, but I'm wondering if I actually need full CRUD operations on every single models, like for tags - I'm not sure in what case I would need to PATCH a /tag/:id endpoint or GET a /users endpoint. Basically, I've only ever been taught to make web apps that line up directly to REST operations, and I'm not sure how to approach them for anything that has non-REST functionality (search, filtering, etc.). Any tips?

REST is like the Pirate Code. They are more guidelines than rules.

Pollyanna
Mar 5, 2005

Milk's on them.


So should I just be handling tag search with nothing but a /tags endpoint, and the front-end doing the search/filter poo poo?

I'm probably overthinking this.

Depressing Box
Jun 27, 2010

Half-price sideshow.

Pollyanna posted:

So should I just be handling tag search with nothing but a /tags endpoint, and the front-end doing the search/filter poo poo?

I'm probably overthinking this.

If you want assets filtered by multiple tags I think querying the /assets endpoint would make more sense. A lot of it boils down to:

Skandranon posted:

REST is like the Pirate Code. They are more guidelines than rules.

There's not a fixed solution like "tags always/never get an endpoint", it's more about building internally consistent APIs with a logical hierarchy. On that note, Apigee's Web API Design is a pretty good introduction to thinking about APIs. Again, these aren't unbreakable rules, just useful questions to ask along the way.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

Skandranon posted:

REST is like the Pirate Code. They are more guidelines than rules.

/TheBlackSpot?userId=460508729

Rubellavator
Aug 16, 2007

I like to call our stuff RESTish because I don't actually know enough about what "proper" REST is to actually tell you if it is. I just know that it's a thousand times better than what I was doing before which was writing really ugly JSF applications. The important thing is that your server isn't storing client state and that your services are doing logical things given the path/params/verb that they're called with.

Munkeymon
Aug 14, 2003

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



If you try to define a universal REST interface you end up with OData. That can be good or bad, depending on your preferences :)

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?
So I wanted to use small caps in a webpage. When I use font-variant: small-caps; Chrome uses "fake" small caps (scaled down forms of the regular caps) even though the font I'm using has actual small caps characters. Firefox correctly uses the real small caps. So I googled around and found font-feature-settings: "smcp" on;, which does indeed work on Chrome as well as Firefox. However, the MDN page says

quote:

Note: Whenever possible, Web authors should use the font-variant shorthand property or an associated longhand property, font-variant-ligatures, font-variant-caps, font-variant-east-asian, font-variant-alternates, font-variant-numeric or font-variant-position.

This property is a low-level feature designed to handle special cases where no other way to enable or access an OpenType font feature exists.

In particular, this CSS property shouldn't be used to enable small caps.

So, what's the best approach here? Is there anything actually wrong with font-feature-settings: "smcp" on; (MDN doesn't really say what's wrong with this, just says don't do it).

Munkeymon
Aug 14, 2003

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



HappyHippo posted:

So I wanted to use small caps in a webpage. When I use font-variant: small-caps; Chrome uses "fake" small caps (scaled down forms of the regular caps) even though the font I'm using has actual small caps characters. Firefox correctly uses the real small caps. So I googled around and found font-feature-settings: "smcp" on;, which does indeed work on Chrome as well as Firefox. However, the MDN page says


So, what's the best approach here? Is there anything actually wrong with font-feature-settings: "smcp" on; (MDN doesn't really say what's wrong with this, just says don't do it).

Use a small caps font. https://www.google.com/fonts/specimen/Alegreya+SC https://www.google.com/fonts/specimen/Playfair+Display+SC https://www.google.com/fonts/specimen/Alegreya+Sans+SC

IAmKale
Jun 7, 2007

やらないか

Fun Shoe
I'm running into a strange...issue...while working with Cloudfront URLs. Basically, when I enter a Cloudfront URL to an image into my address bar and then hit Enter, the image downloads. What tells the browser to automatically download the file? Is there a way to get the image to show up in the browser window as though I were linking to a static asset hosted on a webserver?

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?

What if the font I want doesn't offer small caps separately?

Ghostlight
Sep 25, 2009

maybe for one second you can pause; try to step into another person's perspective, and understand that a watermelon is cursing me



IAmKale posted:

I'm running into a strange...issue...while working with Cloudfront URLs. Basically, when I enter a Cloudfront URL to an image into my address bar and then hit Enter, the image downloads. What tells the browser to automatically download the file? Is there a way to get the image to show up in the browser window as though I were linking to a static asset hosted on a webserver?
The content-type for the files hasn't been set on the server so as far as the browser is concerned it's getting information it isn't designed to display and falls back on simply downloading so you can open it with an appropriate program.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

Any of you guys doing anything with the AMP thinger? Google has a section about it in Webmaster but I haven't looked into it. Just another kind of microformats/rich snippets?

IAmKale
Jun 7, 2007

やらないか

Fun Shoe

Ghostlight posted:

The content-type for the files hasn't been set on the server so as far as the browser is concerned it's getting information it isn't designed to display and falls back on simply downloading so you can open it with an appropriate program.
You were exactly right, someone hardcoded 'application/octet-stream' as the ContentType of every file being uploaded. After I changed that to pass the file's actual ContentType then everything started working as expected. Thanks!

Munkeymon
Aug 14, 2003

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



HappyHippo posted:

What if the font I want doesn't offer small caps separately?

Then you're stuck with hoping those CSS properties are supported or making your own web font. The advice on MSDN is there because implementers get lazy around features that aren't heavily used, as you've seen. It's probably OK to just do it in CSS if you're not super picky about your smallcaps looking perfect everywhere (and don't mind if some people just don't see smallcaps at all).

The Merkinman
Apr 22, 2007

I sell only quality merkins. What is a merkin you ask? Why, it's a wig for your genitals!
Anyone have a lot of experience with jQuery Valdation?
I'm trying to do a thing where it'll clear a certain field if that field has a certain error. I'm not sure if that's even possible. I might be able to get away with always clearing a certain field if there is any sort of error.
I tried seeing about invalidHandler but when I put that in validate() nothing happens except the whole validation no longer runs on submit claiming TypeError: validator.numberOfInvalilds is not a function.
code:
$("#myForm").validate({
		invalidHandler: function(event, validator){
			var errors = validator.numberOfInvalilds();
			if (errors){
				$("#newPassword").val('');
			}
		},
		rules:{
			email:{
				required: true,
				email: true
			},
			password:{
				required:true,
				minlength:8
			},
			password2:{
				required:true,
				minlength:8,
				equalTo: "#newPassword"
			}
		},
		messages:{
			email: {
				required: "Please enter your email address.",
				email: "Please double-check your information and try again."
			},
			password: {
				required: "Please create a new password between 8 and 16 characters.",
				minlength: "Please create a new password between 8 and 16 characters."
			},
			password2:{
				required: "The passwords entered do not match. Please try again.",
				minlength: "The passwords entered do not match. Please try again.",
				equalTo: "The passwords entered do not match. Please try again."
			}
		}
	});	

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane

The Merkinman posted:

Anyone have a lot of experience with jQuery Valdation?
I'm trying to do a thing where it'll clear a certain field if that field has a certain error. I'm not sure if that's even possible. I might be able to get away with always clearing a certain field if there is any sort of error.
I tried seeing about invalidHandler but when I put that in validate() nothing happens except the whole validation no longer runs on submit claiming TypeError: validator.numberOfInvalilds is not a function.
code:
$("#myForm").validate({
		invalidHandler: function(event, validator){
			var errors = validator.numberOfInvalilds();
			if (errors){
				$("#newPassword").val('');
			}
		},
		rules:{
			email:{
				required: true,
				email: true
			},
			password:{
				required:true,
				minlength:8
			},
			password2:{
				required:true,
				minlength:8,
				equalTo: "#newPassword"
			}
		},
		messages:{
			email: {
				required: "Please enter your email address.",
				email: "Please double-check your information and try again."
			},
			password: {
				required: "Please create a new password between 8 and 16 characters.",
				minlength: "Please create a new password between 8 and 16 characters."
			},
			password2:{
				required: "The passwords entered do not match. Please try again.",
				minlength: "The passwords entered do not match. Please try again.",
				equalTo: "The passwords entered do not match. Please try again."
			}
		}
	});	

You have a typo on the third line. It should probably be numberOfInvalids instead of numberOfInvalilds. There may be other problems as well, I'm not sure, but that's definitely causing the error.

The Merkinman
Apr 22, 2007

I sell only quality merkins. What is a merkin you ask? Why, it's a wig for your genitals!

PT6A posted:

You have a typo on the third line. It should probably be numberOfInvalids instead of numberOfInvalilds. There may be other problems as well, I'm not sure, but that's definitely causing the error.
:doh: I could have sworn I used copy/paste to avoid this issue!

Munkeymon
Aug 14, 2003

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



The Merkinman posted:

:doh: I could have sworn I used copy/paste to avoid this issue!

Could be wrong in their docs or maybe their reference docs... which are somehow different? I'm saying their site blows, but I can't find 'numberOfInvalilds' on it

IAmKale
Jun 7, 2007

やらないか

Fun Shoe
Is it possible to use CSS to center-align the contents of a <p> until there are multiple lines of text, at which point left-justify all the text? I'm not even sure how I'd accomplish this via Javascript.

Edit: I figured it out, I ended up with something like this: https://plnkr.co/edit/QlZ0vfv2uYxYpRTG3lz9?p=preview

IAmKale fucked around with this message at 23:26 on Jun 2, 2016

awesomeolion
Nov 5, 2007

"Hi, I'm awesomeolion."

Working on a jewelry page on a Shopify store where you drag and drop charms into a locket using matter.js: Shopify page.

Everything is working (couple styling issues) except I am getting the dreaded CORS error:

code:
assembler-concave.js?7903474003597431401:443 Uncaught SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
This was working at one point in the past but now not so much. All images are hosted on Shopify's intrepid asset servers. Any tips on things I can try would be much appreciated! Reaching out to Shopify with anything other than the most trivial questions results in helpful "please pay for a Shopify Guru" suggestions.

v1nce
Sep 19, 2004

Plant your brassicas in may and cover them in mulch.
Are the Shopify servers actually sending CORS restricted headers, or is it just the Canvas throwing a wobble?

From what I can see, the ACAO header looks like it shouldn't cause you any problems: Access-Control-Allow-Origin:*

Could be specific to the Canvas security. Stack overflow, she say:

quote:

var img=new Image(); img.crossOrigin="anonymous
<img crossOrigin="Anonymous"></img>

Tried that?

Adbot
ADBOT LOVES YOU

substitute
Aug 30, 2003

you for my mum
Speaking of WordPress, has anyone used Bedrock with success? Looks to solve several WP annoyances.

https://github.com/roots/bedrock

substitute fucked around with this message at 01:26 on Jun 5, 2016

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