Displaying your Photospheres on your website

View the example page View the Source on Github Download the Library

To simplify adding a photosphere to your website, I created the “Photosphere” library found in the above github repository.
Start by linking the required libraries in the following order

<script type="text/javascript" src="lib/three.min.js"></script>
<script type="text/javascript" src="lib/Detector.js"></script>
<script type="text/javascript" src="lib/OrbitControls.js"></script>
<script type="text/javascript" src="lib/Photosphere.js"></script>

Next you’ll need to style the element containing the photosphere, it will have the ID #canvas-photosphere.

<style type="text/css">
#canvas-photosphere {
  position: fixed;
  top: 0;
  left: 0;

Setup the detector to alert users with incompatable browsers.

<script type="text/javascript">
if (!Detector.webgl) {

After the close of the if statement, you’ll add the photosphere initalizer.

<script type="text/javascript">
if (!Detector.webgl) {

A quick tip to improve your results, rescale the photosphere into a square where the width and height are a power of two using Photoshop. I recommend 4096×4096. This isn’t required at all, as the software will automatically rescale, but it will improve loading speed and gives you have control over the rescaling method.

Why SOPA will have Zero effect on Piracy

SOPA Blacklisted domains will be blocked by denying DNS requests. DNS (Domain Name System) is essentially a phone-book relating easy to remember words, to static Internet addresses. Just like in a phone-book, if you deny access to a record the web site’s IP address (phone number) will still work. The IP address will still continue to work without a DNS record. If users just use a different phone book, or write the address down somewhere else; they could still access the blocked websites like nothing has happened.

As a user you can write your own “phonebook” that is SOPA safe by editing your operating system’s hosts file. It’s essentially the same as writing a name and phone number down on a sticky note.
In windows this is in C:\windows\system32\drivers\etc\hosts
In Linux & Mac OSX it’s in /etc/hosts

Knowing this

  1. SOPA only affects DNS systems that the US Government can control.
  2. DNS is not required to access other machines across the Internet.
    – DNS is used as a human friendly way to get the address to a server’s location, and to choose a particular service on that server.
  3. While DNS names are required to access many web services using shared IP addresses, it doesn’t matter where you get an IP address for a DNS name just as long as that IP address is correct.
    – For SOPA blocked sites, a user can edit their hosts file to include the domain name and correct IP address.
  4. The users of the site could switch to an alternate DNS provider outside of SOPA’s control.
    – This is an easy 3 minute process that can be done to any OS or common household router. Here’s a guide from google, it can be adopted for any DNS provider.
  5. P2P Software systems used for piracy do not directly rely on DNS.
    – While DNS names may be used to connect to trackers, it’s not a requirement. Nearly all systems just use IP address to interconnect users, completely bypassing DNS.

While initially this will thwart some forms of piracy,  these pirates will very quickly move to alternative pre-existing SOPA safe methods that do not rely on DNS. Some of these include offshore USENET, IRC + DCC, Bittorrent, WASTE, and Freenet

The only people who will be hurt by this legislation are those who are not actually involved with piracy.

Filed under: How To,Random

How to load more content whilst scrolling: like bing image search

This is great for any page that could contain potentially an large to infinite amount of data. When a user scrolls to the bottom of the page, in the background a javascript-server connection will feed more data to the page.

User facing page

<!DOCTYPE html>
<title>Scroll Forever</title>
border: 1px solid black;
padding: 10px;
border: 1px solid black;
padding: 10px;
background-color: green;
marquee-style: slide;
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
index = 0; //The current position of the index
perPage = 40 - 1; //The count per page, we minus one because arrays start at zero.
contentSelector = "#content"; //The CSS selector for the content block
postSelector = ".bump"; //The CSS selector for each post
loadingSelector = ".loading"; //The CSS selector for the loading block
handle = "handle.php"; //The php file to get the JSON data from

function loadData(i,p,clear){
$(loadingSelector).show(); //Show the loading screen
a = typeof(clear) != 'undefined' ? clear : false; //Set to clear the page as false as the default.
$.getJSON(handle, //jQuery function to get JSON data.
"index": i, //The index
"max": p, //The maximum posts per load
function(data){ //Take the JSON data
var html = "";
var postId = 0;
while(postId < data.length){
html += "<div class='bump'>" + data[postId] + "</div>"; //Do something with it
if(clear == true){
html += "<div class='loading'>Loading...</div>";
index = index + perPage; //Advance the index to match the new data.
} else {
index = index + perPage; //Advance the index to match the new data.


loadData(index,perPage); //Initially load the data

var w = $(window); //Saving the context to a shorthand variable.
w.scroll(function(){ //When we scroll
if(w.scrollTop() + w.height() == $(document).height()){ //Check if the position is the bottom of the page
loadData(index,perPage); // If so, then we will load more data.
<body>The idea of this demo is to be able to continuously scroll through data.

For the demo, the javascript will grab new JSON data from a php file that just gives a larger and larger number.

<div id="content">

Back end (save as handle.php)

Handle.php - Part of the Continueous Scroll demo.
Spits a continueously larger and larger number in an array.

if(isset($_REQUEST['index']) && isset($_REQUEST['max'])){
$start = $_REQUEST['index'];
$max = $_REQUEST['max'];
$i = 0;
$data = array();
while( $i <= $max ){
$data[$i] = $i + $start; //Heres a random note. I found that if you don't know how much you're expecting to get, it's eaiser to just start the array at zero. You can put a unique ID within a sub level array.
} else {
$data = array(
"Error" => "Please post with the index and max argument",
echo json_encode($data);

One idea for a modification, is to begin loading when the user is scrolled halfway through the newly loaded content. This way even newer content is loaded before the user even sees the end.

Click here to see it in action

Filed under: How To,Web Development

Removing or Modifying svn client passwords

For how common this task is, it’s incredibly hard to find on Google. You’ll need to remember this for anytime you want to change your user account, password, or just delete your account from your subversion client. This works in Netbeans, RabbitVCS, and a majority of other subversion clients that just connect with the svn package.

  1. Open a terminal (This can be done in a file manager’s search tool, but I’ll show you how in a terminal so you get a better idea of how it works)
  2. enter the command
    grep -r "<HOSTNAME>" ~/.subversion/auth/

    (Replace <HOSTNAME> with the SVN’s hostname, so for instance http://svn.vincentprime.com/applepie/svn would be svn.vincentprime.com) Grep searches inside files for whatever you put in the ” “. The -r makes it recursive, so it will look through all the files in all folders deeper than where it was directed to at the end of the line.

  3. You will get a line that looks something like this
    /home/vincent/.subversion/auth/svn.simple/888c928072e9643a13b38ea43532896d:<http://svn.vincentprime.com:80> My Projects

    You want the path before the “:”

  4. Now just enter
    rm /home/vincent/.subversion/auth/svn.simple/888c928072e9643a13b38ea43532896d

    to remove the file, and have subversion forget your account credentials.

  5. Next time you run your subversion, you will be asked for your username and password again.

Filed under: How To,Linux
Tags: , , , ,

Writing a script to toggle a pointing device in linux

I recently purchased a new laptop, and installed Ubuntu Linux. There’s one major problem with the laptop; the trackpad is too sensitive and resting your palm will click the mouse. The computer includes a shortuct (FN + F9) to disable the trackpad, but natrally from linux this doesn’t work.

Here’s how you can solve this:

  1. You need to get the name of the pointing device that you wish to disable, so open a terminal and type “xinput list”. (Note: if you have a second pointing device plugged in, unplug it before running this command to prevent confusion.)
    Example: The trackpad that I wish to disable is called “PS/2 Logitech Wheel Mouse”
  2. Create a new empty document someplace where you will remember the location (I recommend placing this in it’s own folder), and both you and whoever else that may use the script has write access to the containing directory. Name the document “togglemouse.sh”. (I like to put helpful scripts within a “scripts” folder in my home directory, but if you have a multi-user machine then you could put it in a shared drive or directory.)
  3. Open the new document with a text editor, and paste the following script.
    if [ -e $mouse ]; then
    xinput set-int-prop "PS/2 Logitech Wheel Mouse" "Device Enabled" 8 1
    rm /tmp/mymouse
    xinput set-int-prop "PS/2 Logitech Wheel Mouse" "Device Enabled" 8 0
    echo 1 > /tmp/mymouse
  4. Change where it says “PS/2 Logitech Wheel Mouse”, to the name of the pointing device that you found in step 1. Then save.
  5. Now to disable the pointing device, you just need to run the script. The script will check the temp directory for a file called mymouse, if the file exists then it will enable the mouse and delete the file, if the file doesn’t exist then it will disable the mouse and create the file.
    • If you’re using Ubuntu, you can create a keyboard shortcut to run this script by going to
      System > Preferences > Keyboard Shortcuts
      Select “Add”, write a descriptive name for the shortcut, place the location of the script in the command, hit ok, click the right column next to the new shortcut and press the keys desired for your new shortcut.

EDIT: Moved the location of the mouse disabled file into the temp directory (/tmp/mymouse), so it goes away on reboot.

How to make Lenticular Images in Secondlife

Found an article on Sculpt Blender where the author Murgy has discovered a neat effect in the second life viewer that allows for Lenticular Images (the images that change depending on what angle you view it). He goes into a bit of detail on how he discovered it, I’m going to give you a step by step process and provide you with the sculpted texture.

I’m assuming you understand the basics of creating objects in secondlife.

Step 1 – Creating the prim
Upload this sculpted texture, and name it something useful to you.
Create a new prim,  a cube works. Open the object tab, change the building block type to “sculpted”. Select the uploaded texture. Then change the stitching type to “Plane”. Open the texture tab, and change the transparency to 1 or higher.

You now have the basics of a lenticular lens, if you move the viewer from left to right you will see the texture change a little.

Step 2 – Creating the texture
Create a texture in photoshop, the maximum height for textures is 1024 in secondlife.
If you want a 4:3 aspect ratio for the images, set width as 341px and height to 1024px .
Viewing from Left to Right the first image is going to be on the bottom.
Set a guide for Y axis 770px, under this guide you can put your first image. This will be a bit shorter than the second image.
Set a guide for Y axis 370px, above this guide you can put your second image.
The middle, it’s best to leave clear or a color that matches the border of your images.
Here’s a .PSD with guides already set.
Now you can upload your texture to secondlife and apply to the prim, then rotate the texture -90 degrees and set the transparency to at least 1. Now check out your new Lenticular image!

Filed under: How To,Secondlife
Tags: ,