Choose Your Theme
Warren Shea

Archive for the ‘Development’ Category

Tutorial: Converting characters into their HTML entity names

Saturday, January 28th, 2012 at 7:17 pm

Purpose of this tutorial
To convert characters in code into their HTML entity names

What you need to know/have
Adobe Dreamweaver

Note
This tutorial uses Adobe Dreamweaver CS4

Procedure
Step 1: Enter your special characters into Dreamweaver’s source. (Or more likely, it already exists in your document).

Step 2: Select the text you want converted

Step 3: Cut (CTRL + X) it

Step 4: Change the characterset to ascii in the meta tag.

Step 5: Paste your copy into the DESIGN portion of Dreamweaver (this is very important)

Step 6: Change the characterset back to UTF-8 or ISO-8859-1 (or whatever you had before) and save.

My ramblings
I rarely use this on a personal level but I can’t say I haven’t done it many time professionally. Hopefully this tutorial helps save you some time when you’re like “why doesn’t my code work in this browser?”

It’s like describing every freelance web project I’ve ever worked on

Wednesday, January 25th, 2012 at 12:43 am

If you want something produced/designed/created/built you can only have something done:

– Masterfully
– For Cheap
– Quickly

But you can only pick 2, you will never get all three.

This is a quote I read somewhere….I just wanted to post it because I found it very true in most cases….not always true though.
I wanted to remember it…so I just thought I’d post it :) My blog is my notebook/journal/diary

Site Updates – Facebook Status and Recent Comments in the Right Col. –>

Tuesday, January 24th, 2012 at 12:00 am

Wow, when was the last time I did any type of site update?

Anyways, I did some worldofwarren.com maintenance today, first time in a while.

What I did was add 1 Facebook Status to the right column, underneath the 3 Twitter Tweets.
Below that, I added the 3 most recent Comments, underneath the Facebook Statuses.

I didn’t want to display the comments too prominently on my site as it’s not my content, so I make you simply click “See most recent” to see them. I notice that sometimes I get really good or interesting comments on really old posts. It’s very likely no one would read those though…(other than me) and I find that unfortunate. I’d like those voices to be heard/read.

I really hope this doesn’t discourage people from commenting. Comment on this post if you think it’s a bad idea…and it will ironically do what you don’t want it to do! So….basically, I’m saying there’s nothing in it for you.

<Technical Tutorial>
Getting the Facebook Status to work was pretty difficult. There’s a Facebook RSS feed but you can’t just pull from it. But that’s the same as any RSS feed. You have to create a proxy to bypass the cross domain issues. It’s super simple:

proxy.php

<?php header(“Expires:Mon, 31 Dec 2010 05:00:00 GMT”); ?>
<?php
if ($_GET[“type”] = “xml”) {
header(“Content-type: text/xml”);
$page_contents = file_get_contents($_GET[“url”]);
}
echo $page_contents;
?>

and I just call any XML/RSS via URLs like this:

proxy.php?type=xml&url=http://search.twitter.com/search.atom?q=from:warrenshea
proxy.php?type=xml&url=http://www.worldofwarren.com/?feed=comments-rss2

Unfortunately, for some reason, Facebook doesn’t allow this. They have this whole Developer API you have to work with to get the Facebook Statuses. Why? I think that imo, having Facebook Statuses come up as simple RSS feeds for people defeat the purpose of Facebook, as well as they lose money on advertising if you can pull the Facebook Statuses from other sites.

So I had to do something else for Facebook Status. I’m not going to write a tutorial since I didn’t make it. I will say that I got it HERE:
PHP Show Your Facebook Status on your blog/website
</Technical>

Tutorial: CSS3 DIV Shadow

Tuesday, January 17th, 2012 at 2:36 pm

Purpose of this tutorial
To put a nice, subtle shadow just below a DIV. This shadow fades out to the background and is alpha transparent.

What you need to know
HTML and CSS

Note
While this generally works on any website, it doesn’t work too well with my themes, other than Google+ theme. I suggest you use that theme to properly see this.

Example

Code

<style>
  .box_example {
    margin:auto;
    background:#fff;
    border:1px solid #aaa;
    width:100px;
    height:100px;
    border:1px solid #666;
    position:relative;
  }
  .box_example:after{
    content:”shadow”;
    position:absolute;
    z-index:-1;
    bottom:2px;
    left:7px;
    right:7px;
    box-shadow: 0 0 10px #000;
    border-radius:100px / 7px;
  }
</style>

<div class=”box_example”></div>

Explanation
The key things are
.box_example’s position:relative
and…all of .box_example:after‘s CSS.
I guess playing around with the CSS to get the shadow you want. There’s not much else to discuss…lol worst tutorial ever :)

My ramblings
I just found this out through a co-worker and I’m using it everywhere. I think it’s a very simple, subtle way to make an item pop out a little more. FYI he first saw it on LinkedIn, here developer.linkedin.com

One SQL Statement to Destory the World (of Warren)

Wednesday, November 23rd, 2011 at 4:34 pm

^ That’s supposed to be a play on “One Ring to Rule the World”….which is my butchered version of
One Ring to rule them all, One Ring to find them,
One Ring to bring them all and in the darkness bind them

from LOTR.

Anyways.

So I brought my site down today. Well, technically I only brought the blog portion down, but that’s 99% of my site.

This is how it happened.

When I did my migration a month ago, for some reason apostrophes were replaced with an obscure character encoding, probably due to the Database not being the correct coding (ISO-8859-1 instead of UTF-8 or vice versa).

I was trying to do a SQL statement on the wp_posts table to replace all instances of
’ to

This was the SQL command I ran:

UPDATE wp_posts
SET post_title = REPLACE(post_title, “’”, “‘”)
WHERE (post_title LIKE ‘%â%’)

To translate: If there’s an instance of â in the title of the post, find ’ and replace it with ‘

Simple. Anyways, I ran the code and it worked like a charm on all the titles. I next had to replace the content of the post. Easy right?

The SQL command should have been

UPDATE wp_posts
SET post_content = REPLACE(post_content, “’”, “‘”)
WHERE (post_content LIKE ‘%â%’)

But instead, I wrote

UPDATE wp_posts
SET post_content = REPLACE(post_title, “’”, “‘”)
WHERE (post_content LIKE ‘%â%’)

To translate (minus insignificant details): If there’s an instance of â in the content of the post, replace the content of the post with the title of the post.

As a result, all my old posts’ content was replaced with the title of the post. OMG >_< I created a ticket with my hosting provider and they happened to have a backup of the database from yesterday morning (so I was only missing 3 comments from then, of which I obtained through Google Reader/Feedburner + FireBug). I got it restored within an hour or so…. But I still have to fix that apostrophe problem still….but this time, I’m kinda really afraid to do so :'(