Archive for Blog

Setting up Subversion on Dreamweaver

This tutorial shows you how to setup Subversion on Dreamweaver using Google Code. I’m using CS6, but it likely applies to earlier versions.

  1. Create an account on Google Code: http://code.google.com
  2. Create a new project: http://code.google.com/hosting/createProject
    Create Project
  3. Click “Source” and you should see something similar to:
    Login Info
    You’ll need the following information.
    Server address: lil-josh-demo.googlecode.com (replace with yours)
    Repository Path: /svn/trunk
    Username: JoshFromIU@gmail.com (replace with yours)
    Password: You can find your password by clicking googlecode.com password.
  4. Open your site in Dreamweaver. From the dropdown click Site -> Manage Sites and double click your site to open it.
  5. Click the Version Control tab from the left.
  6. Enter your Google code information from step 3. For example:
    Dreamweaver Settings
  7. Click Test and then Save if everything worked.
  8. I’d recommend watching this video to get a quick overview of the Dreamweaver’s Subversion features: http://tv.adobe.com/watch/learn-dreamweaver-cs5/working-with-subversion-and-dreamweaver/ (skip to 1:40)

I spent a lot of time trying to figure out how to setup a subversion server, and found that Google Code was the easiest solution. If you have any feedback or questions feel free to leave a comment. Thank you and enjoy!

Replace Function Workaround in XSLT 1.0

I came across a problem where I wanted to display HTML code on a page using XSLT, but I needed to replace all ‘<’ and ‘>’ characters with the HTML entity ‘&lt;’ and ‘&gt;’. With XSLT 2.0 this would have been super simple using the built-in replace() function. However, I was stuck with XSLT 1.0. My solution was to use jQuery to select the element I wanted to display and then replace all the mentioned characters within it. Here’s an example:

$(document).ready(function() {

var body = $("body").html();
body = body.replace(/</g, "&lt;");
body = body.replace(/>/g, "&gt;");
$("body").html(body);

});

Build a jQuery Twitter Feed

Copy and paste the code below into a post, page, widget, or your HTML code. Be sure to replace the screen_name on line 4.

<div class="twitter" id="jstweets"></div>
<script>
$.ajax({
  url: 'https://api.twitter.com/1/statuses/user_timeline.json?screen_name=jolamar&count=5&callback=?',
  dataType: 'json',
  success: function(data){
    $.each(data, function(i,item){
      ct = item.text;
      // include time tweeted - thanks to will
      mytime = item.created_at;
      var strtime = mytime.replace(/(\+\S+) (.*)/, '$2 $1')
      var mydate = new Date(Date.parse(strtime)).toLocaleDateString();
      var mytime = new Date(Date.parse(strtime)).toLocaleTimeString();
      ct = ct.replace(/http:\/\/\S+/g,  '<a href="$&" target="_blank">$&</a>');
      twitterURL = "http://twitter.com/";
      ct = ct.replace(/\s(@)(\w+)/g,    ' @<a href="'+twitterURL+'$2">$2</a>');
      ct = ct.replace(/\s(#)(\w+)/g,    ' #<a href="'+twitterURL+'search?q=%23$2" target="_blank">$2</a>');
      $("#jstweets").append('<div>'+ct + ' <small><i>(' + mydate + ' @ ' + mytime + ')</i></small></div>');
    });
  }
});
</script>

NOTE: You will need jQuery for this to work. If this isn’t working, try including the following library at the beginning of this code.

<script src="http://code.jquery.com/jquery-latest.js"></script>

3D Facebook Button WordPress Plugin

I’ve developed a new plugin that allows you to use a shortcode to create a Facebook logo that falls open when you hover, revealing how many likes your site has. The plugin can be found at:

http://wordpress.org/extend/plugins/3d-facebook-button/

My future plans are to allow users to like the site when the button is clicked and make a better non-WebKit browser (Firefox, IE) version. Let me know what you think!