posting code, a warning (Greg B.)

I’ve just noticed there is a problem with code that has been dropped into posts. If you copy and paste directly from the post, for some reason, depending on the syntax of the code you may lose important bits. For example “while ()” appears as “while ()” but thats not what it is! Click on edit and see for yourself! You will not have this problem if you go to the edit post page and copy from there. Also and this may just be the text editor I use but some commented line were broken into multiple lines which did not have ‘#’.

There has to be a better way to host code here but I don’t know what it is. Any ideas?

How to post – code (Dan E.)

We have a problem sharing code via RLR.

The Problem

Unfortunately WordPress has a list of acceptable file types that it allows to be uploaded to our media library and none of the useful coding file types are on that list. The list is simply a list of acceptable file extensions. This means if you write a useful R script (or perl or python) script and save it with a standard file extension, like .R or .pl, WordPress will not allow you to upload it to the RLR media library so that you can share it via a post.

The Solution

The list of acceptable file extensions can be hacked and I might give it a try but, until I do, you will have to do one of these things:

  • Change the file extension. If you save your script as a .txt file it will upload fine. You should make it clear in your post what kind of script it is and then people who download it can change the .txt extension to whatever they want.
  • Put the code in your post. If your script is not too long you can simply copy and paste the code from your text editor into the post editor. The formatting of the code will remain true to the original so users can simply copy and paste it back out into a text editor or R-Studio or wherever. See Rose’s post about plotting STRUCTURE results for an example of this.
  • Compress your script file. If your script is big you can try zipping it and then uploading the compressed file. Users can then just download and unzip it. [As of November 2011 this hasn’t been tested.]

Dan E.

How to post- Continue reading-> (Dan E.)

Hi All.

Greg B has shown me a very useful HTML trick that will make the RLR Home page more user friendly if we all use it.

If you are just looking for the code so you can copy it, here it is:
<!--more-->

UPDATE (Jan2012): I just noticed that there are two other, easier, ways to get the “Continue reading →” feature into your post.

  1. Keyboard shortcut: alt+shift+t.
  2. WordPress post editor button: There is an “insert more tag” button among the buttons at the top of the post editor. In my editor it is on the top row 4th from the right – beside the link and unlink buttons.

It is very simple to post to RLR such that your post is displayed on the Home page as an opening paragraph or two followed by a “Continue reading →” link that takes the reader to the full post when followed.

Just like this . . .
Continue reading

Intellectual Property and RLR (Dan E.)

Hello all.

In an effort to prevent some potential problems I want to present some ideas about intellectual property and posting on RLR right now at the beginning.

I hope that RLR will help people in the lab. The idea is simple – that we will benefit from the expertise of others. The Rieseberg lab has a lot more expertise than any individual member does and all of us have skills and information to share. In order to promote this sharing lab members need to feel that the give and take that happens via RLR is fair – not too takey. Users of RLR need to feel that they are not contributing substantially more than others and that their contributions are not being unfairly exploited. With this in mind I’ve come up with three ideas about intellectual property as it pertains to posts on RLR. They are listed below and on the About page.
Continue reading