Posting issues

Hi,

apologies if wrong forum, but couldn’t see other places to post this.

I experienced more than once that when trying to wrap snips of code it does not work properly, and all the time, I have to redo it, or go in delete some white, or trailing space to make it work.

Also I just opened a new thread, and upon saving I got this message:

Unknown error saving post, try again. Error: 502 Bad Gateway

But it seems it went thru as I can see it on the forum
[Form to write in csv messed up][1]

Thank you
[1]: Form to write in csv messed up

This is the right place to post.

Discourse has its own way of doing things, which takes a bit of getting used to. You’ll find help on things like formatting code in these topics:
Discourse Cheat Sheet
Forum Posting Basics

The 502 errors have been occurring over the last couple of days, since an upgrade to the system. I agree they’re a complete pain. They have been reported, so hopefully a fix is not too far away. In the meantime, our apologies for the inconvenience.

(See http://www.sitepoint.com/community/t/very-strange-502-error-still/119454)

Thank you.

In the meantime, our apologies for the inconvenience.

No need at all, I only have to be thankful for the excellent site.

I read thru the links you provided, but either I didn’t get it, or I have not explained the issue well.
I have used the forum, and posted with code using </> after selecting the code snip, sometimes however, it just would not display correctly in the preview, like I have not selected, and used the </>.
So that I need to edit the text in the left pane to make it appear as code in the preview pane, basically not always the </> seems to do what it’s supposed to.

Oh, sorry, I misread that. I find the </> button awkward to use, so I never bother; I prefer to use backticks which I can easily type in. But I’m aware that option isn’t available to everyone, as some European keyboards don’t have a backtick key.

I’ll report the issue with the </> button, and see if others have noticed it.

I’ve had that problem too.

1 Like

Same. I resorted to using ticks since that 100% always works.

1 Like

Which browsers/OS are you guys using? @keneso, @chrisofarabia, @RyanReese

I’m wondering if that might be a factor.

Chrome 41.0.2272.118 m / WIN7(work) / chromebook(home)

That’s my work computer and I can only assume the same version on my home chromebook.

1 Like

It depends where I am to a degree. At work it’s IE9, but I don’t paste code from there. At home, I’m using Firefox (37 I think), Chrome 41, or Safari on iOS, but on the latter I wouldn’t be pasting code. Generally, it’s going to be Chrome or Firefox.

1 Like

Oh well, that sounds sufficiently varied to probably rule out browser as a factor.

If you like, when I get back home, I can try a range of options and see what happens.

If you find yourself at a loose end, by all means do that. If we could narrow down what causes the issue, it would help considerably in getting it fixed. It apparently doesn’t affect everybody, so I’d like to know what triggers it.

Confirming on firefox, and chrome.

Correct, I don’t have the backticks on my keyboard.

1 Like

The problem is that it doesn’t happen all the time, but randomly; like in the last thread I used it, I needed to post two snips, and the first one did not work, I kept typing and when got to the second snip it worked fine, then I went back, and “fixed” the first snip.

Can you think of any factor that was different between the two? Was one typed in and the other copied and pasted? Or were they copied from different sources? Anything at all - I’m clutching at straws here.

That’s for you with an English keyboard. I don’t use them because in my Spanish keyboard they don’t work well

Okay, I can only recreate this one way, it is a bit hard to explain, so here it goes:

Let’s say you have the following post (in pre tags so you can see it unhighlighted):


This is my post, here is the code that isn't working.
$fp = fopen('/pathto-the-file/data.csv', 'a');
fwrite($fp, $name . ',' . $lastname . ',' . $address . ',' . $city . ',' . $country . ',' . $birthday . ',' . $email . ',' . $phone . ',' . $room . ',' . $gender . ',' . $comment . ',' . PHP_EOL);
fclose($fp);

Now, when I highlight the code and press the code button, it should do three things. 1) add a new line between the text and the code and 2) indent the code part by 4 spaces on each line, 3) add a new line after the code.


This is my post, here is the code that isn't working.
$fp = fopen('/pathto-the-file/data.csv', 'a');
fwrite($fp, $name . ',' . $lastname . ',' . $address . ',' . $city . ',' . $country . ',' . $birthday . ',' . $email . ',' . $phone . ',' . $room . ',' . $gender . ',' . $comment . ',' . PHP_EOL);
fclose($fp);

Output:


This is my post, here is the code that isn't working.
$fp = fopen('/pathto-the-file/data.csv', 'a');
fwrite($fp, $name . ',' . $lastname . ',' . $address . ',' . $city . ',' . $country . ',' . $birthday . ',' . $email . ',' . $phone . ',' . $room . ',' . $gender . ',' . $comment . ',' . PHP_EOL);
fclose($fp);

Okay, so far so good. If I remove the newline between the text at the top of the code and the code, like so, the highlighting will fail (it seems that new line is very important).


This is my post, here is the code that isn't working.
    $fp = fopen('/pathto-the-file/data.csv', 'a');
    fwrite($fp, $name . ',' . $lastname . ',' . $address . ',' . $city . ',' . $country . ',' . $birthday . ',' . $email . ',' . $phone . ',' . $room . ',' . $gender . ',' . $comment . ',' . PHP_EOL);
    fclose($fp);

Output:


This is my post, here is the code that isn't working. $fp = fopen('/pathto-the-file/data.csv', 'a'); fwrite($fp, $name . ',' . $lastname . ',' . $address . ',' . $city . ',' . $country . ',' . $birthday . ',' . $email . ',' . $phone . ',' . $room . ',' . $gender . ',' . $comment . ',' . PHP_EOL); fclose($fp);

I should note that you can remove the optional ending newline without any issue.


This is my post, here is the code that isn't working.
$fp = fopen('/pathto-the-file/data.csv', 'a');
fwrite($fp, $name . ',' . $lastname . ',' . $address . ',' . $city . ',' . $country . ',' . $birthday . ',' . $email . ',' . $phone . ',' . $room . ',' . $gender . ',' . $comment . ',' . PHP_EOL);
fclose($fp);

Output:


This is my post, here is the code that isn't working.
$fp = fopen('/pathto-the-file/data.csv', 'a');
fwrite($fp, $name . ',' . $lastname . ',' . $address . ',' . $city . ',' . $country . ',' . $birthday . ',' . $email . ',' . $phone . ',' . $room . ',' . $gender . ',' . $comment . ',' . PHP_EOL);
fclose($fp);

You can even put text immediately after the last indented line of code


This is my post, here is the code that isn't working.
$fp = fopen('/pathto-the-file/data.csv', 'a');
fwrite($fp, $name . ',' . $lastname . ',' . $address . ',' . $city . ',' . $country . ',' . $birthday . ',' . $email . ',' . $phone . ',' . $room . ',' . $gender . ',' . $comment . ',' . PHP_EOL);
fclose($fp);

More text can be here without any issue.


Output:


This is my post, here is the code that isn't working.
$fp = fopen('/pathto-the-file/data.csv', 'a');
fwrite($fp, $name . ',' . $lastname . ',' . $address . ',' . $city . ',' . $country . ',' . $birthday . ',' . $email . ',' . $phone . ',' . $room . ',' . $gender . ',' . $comment . ',' . PHP_EOL);
fclose($fp);

More text can be here without any issue.


By chance on the times it failed, was the newline between your opening text and your code block removed (or not inserted)?

1 Like

I…don’t remember deleting the newline but it’s certainly possible since I do try and clean up my posts that contain code (to make the preview look nice.)

I WANT to say it’s the newline not inserting but it’s also equally likely it’s my fault for deleting it.

Well, next time it happens if you can post the content of your “initial” post in pre tags here for me and tell me what browser you were using, maybe, just maybe, I can confirm it. I spent 15 minutes playing with it and couldn’t get it to misbehave. Doesn’t mean the problem isn’t real, just I can’t find a better way of causing the issue right now.

I’ll try - although as I said I do use the ticks now since it’s so reliable.

1 Like