Saturday, 21 February 2015

drupal views link to another view

I have a view which shows a list of a content type. When the content is clicked I want to show another view of that content.

The reason is I want to make use of the css layout I've already made with a views slideshow, and I would like to duplicate it with another view of just one item.

I have found this question, which is answered linking to these places about arguments.

I worked it out in the end. Although I did have trouble to begin with because I got all the settings correct and it still didn't work. But on creating a new view with the same settings it worked. It might have been due to the url having several 'layers' to it.

  1. Sort out your page
  2. add 'contextual filter'
    1. I did a taxonimy term.
  3. test out in preview panel.

Thursday, 12 February 2015

Blender render farm - built in Network renderer

Well, I tested this last year, but I can't believe it, I can't find any mention of me doing it. It either means I forgot to write it up, or didn't write it up in this blog! Oh well, here's a new writeup:

The only files I have to go from are two files named:

Basically, these files have presets in them, so whichever machine opens them either becomes the master or the slave.

Here's a document I found which has 'slave.blend' mentioned in it, looks very promising.

  1. First thing is to load blender, and load the Network Renderer plugin. Go to:
    1. File > User Preferences > Render > Network render > tick:
  2. Up the top, next to File, Edit menus, there is a dropdown usually on "Scene". Select "Network Render":
  3. On the far right you should see the Network Render settings:
  4. Click Master on the machine you want to control jobs. Make sure it's a machine which is always on, perhaps with storage space which can be shared to other machines (not worked out where rendered files are stored)
    1. Click Start Service
  5. You can now view the jobs and clients connected to the master by browsing to the webpage:
    1. http://ipAddressOfMaster:8000:
      1. I had trouble with this, but found it was because I was on the master machine and so had to type:
        1. http://localhost:8000/
      2. There is also a newer jquery interface: /html/newui#interface:
  6.  Now start another machine as a slave
  7. On the final machine, load up a nice file and click "Send Job":
  8. The systems so good, the end files end up where-ever you said for the output (at the bottom of the client list). You can even download renders from previous jobs!!

Now that I got it all working, the plan was to save a master.blend file and a slave.blend file and have them load up when the machines are started, from command line. Here it goes:

 To run the master:
/Applications/Blender\ 2.73a/ -b /Users/Shared/master.blend --addons netrender -a -noaudio -nojoystick

The slave:
/Applications/Blender\ 2.73a/ -b /Users/Shared/slave.blend --addons netrender -a -noaudio -nojoystick 

Seems to work very nicely. One thing to note is that the IP address of the master has to be saved in the slave.blend file. I don't know how to add this through the command line.

The next thing is to get the slave.blend command to launch at system startup, and run as root.

Found this question and answer in stackoverflow 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">
    <string></string> <!-- org.mongodb.mongodb perhaps? -->



            <string>/Applications/Blender 2.73a/</string>

Sunday, 8 February 2015

jquery pullout slide animation

This is my first lesson in jquery.

Basically what I want is a slider which is mostly hidden on the left, and when you hover over it pulls out to reveal all.

After going on W3CSchools for 30 mins I botch'd up this code:

$(document).ready(function(){$("#square").hover(function(){ $("#square").animate({ left: '+=100px' }); }, function(){ $("#square").animate({ left: '-=100px' }); }); });

Saturday, 7 February 2015

Drupal views slideshow image as css style background

Thought I'd document this as I will probably do this in future developments.

I wanted a views slideshow, with the images appearing full screen with text ontop. It appears simple at first but actually required more digging.

Backstretch does not work with views slideshow, as it applies the image background to elements not within the slideshow.

I found a slightly helpful article which suggested a fix, but later found the forum from where more helpful information was taken.

to sum it up, you need views to output the url of the image for the field, and then use a views template override to get this url and 'render' it inside a html element as the background-image style.

To do this:

  1. Get views to output the url of the image
    1. in the views view, add a Relationship
      1. this needs to be a 'File Usage: file'
    2. next add a field '(file) File Path
      1. in this field, tick the box titled:
        1. Display download path instead of file storage URI
  2. Now to render this URL inside a HTML element you need a template override
    1. In views veiw, go to 'Other' > 'Theme' > 'Information'
      1. find the template override for the field
      2. create a new file with that exact name and place it in your theme
    2. inside this file paste this:
      1. <div class="mainImage" style="background-image:url('&lt;?php print $output;?&gt;');">&lt;!--<img src="&lt;?php print $output;?&gt;"style="visibility:hidden; "></img>--&gt;</div>
    3. Done
You can now style this .mainImage div as:
.mainImage {
position: fixed;
height: 100%;
width: 100%;
top: 0px;
left: 0px;
z-index: -2000;
background: no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;


It now changes with the views slideshow.