Allowed File Types At RLR – you can now upload scripts with their usual file extensions

Hello All,

Many of us have been annoyed by the restricted file types that WordPress allows to be uploaded to RLR. It’s especially annoying because all WordPress is doing when it permits or denies an upload is checking the file extension against a list of allowable extensions. {Even the most malicious code could be uploaded to our blog as long as it had a .txt file extension. Whether that code could then be made to execute, however, is far beyond my web-programming grasp – WordPress would treat it as plain text so it may be impossible.}

We’ve been sharing code via RLR by sidestepping the file extension rules and uploading scripts as .txt text files or by compressing files into zip archives or just putting the code itself into posts. Admittedly these were simple solutions, but now it’s even simpler – I just added some of the relevant file extensions to the list that RLR will allow for upload.

I added: “.pl”, “.py”, “.sh”, “.R”, “.r” and “.kml”.

Any file with one of those extensions will upload as plain text, i.e. WordPress will treat it as a text file.

If I’ve omitted something useful let me know.

Please remember that code can simply be copied into the body of a post and that will often be the best way to share it. But, in addition to that presentation, and especially for long scripts, you can now upload the script with its file extension to the RLR media library and put a link to it in your helpful post explaining what it does.

Dan.

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

If you edit a post – comment on it too! (Dan E.)

Hello all,

Sebastien and Rose have already come across the scenario where a one RLR user has something to add to a post written by another and the sensible thing to do seems to be to edit the post.

This is fine. Editing posts is obviously the right thing to do in some situations.

The problem is that the act of editing a post is not an obvious one to anyone other than the editor. You could make a really significant contribution to a post about something very useful to the lab but this contribution might not be at all obvious to any other RLR user.
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