Quantcast

Joel Nagy .com

web technology is a way of life

Chrome is Afraid of Google

Short URL

Commonly I ignore typing www. at the beginning of a URL. Today I came upon a little issue that Google has with their servers; they didn’t set up google.com/adsense to redirect to www.google.com/adsense.  At first I thought I had mistyped the URL as I received the red screen of insecurity.  Made me at least happy to know that Google didn’t program any specific google.com references into the browser to automatically assume any safety for their servers.

google.com/adsense

Based on an earlier post about short URL issues I decided to update my blog to support it’s own short URL using the wordpress post ID.  So now any post on my site can be referenced via a shortURL, this one in fact is http://joelnagy.com/p176.

In order for this to work I added this line to my .htaccess file in the root of my site to set it to redirect the short URL to the actual page (you need the full domain in the rule since WordPress works based on the REQUEST_URI) :

RewriteRule ^/?p(\d+).*$ http://example.com/?p=$1 [QSA,L]

This code is for use in header.php to create the <link> tags that will identify your page’s shorturl. First at the top of the page:

<?php
$this_ID = this_ID();
$shortlinkid = ($this_ID != ''? $this_ID: (isset($_REQUEST['p']) && $_REQUEST['p'] != ''? $_REQUEST['p']: ''));
$uri =  $_SERVER['REQUEST_URI'];
if ($uri != '/blog/' && $shortlinkid != '')
	$shortlinkid = "/p{$shortlinkid}";
else if ($uri != '/blog/')
	$shortlinkid = $uri;
header("Link: <http://example.com{$shortlinkid}>; rel=\"shortlink\"");
?>

Then inside the <head> (near other <link>s):

<link rel="shorturl" href="http://example.com/<?php echo $shortlinkid; ?>" />
<link rel="shortlink" type="text/html" href="http://example.com/<?php echo $shortlinkid; ?>" />
<link rev="canonical" rel="self alternate shorter shorturl shortlink" href="http://example.com/<?php echo $shortlinkid; ?>" />

Here is the this_ID() function that needs to be added to functions.php:

function this_ID($force = false) {
global $wp_query;
	if (count($wp_query->posts) == 1 || $force)
		return $wp_query->post->ID;
	return '';
}

You can also add this code for tweeting the short URL (via chuchcrunch.com):

<!-- This is a link to tweet the post using the new short URL -->
<a rel="nofollow" target="_blank" href="http://twitter.com/home/?status=Just Read : <?php the_title();?> : http://example.com/p<?php the_ID(); ?>">Tweet This Post!</a>

As much as I’d love to give cable the boot (especially in light of the recent Time Warner and Cablevision issues with carrying and paying for Fox, Food Network and HGTV) I still see roadblocks ahead for TV over the Internet.  YouTube and Hulu have changed the game and made major in roads into original and re-broadcasted content.  And this will only serve to bring new entertainment into more homes.  An article from wired.com today about the upcoming CES talks about Boxee Box,  a set top Internet Video box like your cable box but delivering video to your TV without your computer.  Boxee Box looks like an amazing device, it incorporates social networking as a means to find videos, but I still see big issues.

The Guide. The onscreen guide on your cable box or TiVo brings you an extremely easy way to find content, people are accustomed to using this system to scroll through channels and find shows.  If Boxee Box or other Internet TV boxes can reproduce this simplicity for finding quality video content then they’ve solved a big part of the problem.

Multiple Episodes. Finding, sorting and viewing multiple episodes of a show is key.  It’s built into TiVo if you record a season of a show.  It’s of course built into DVD and Blu-Ray when you pop in a disc. But right now it’s hard to find the second video in a series on YouTube sometimes; it’s not always in the related videos module (or the 5th video in the series is there, but not the second) and you become forced to click around to the user’s upload page and search for the video.  So once the all of the various video sources have clean standard feeds that the set top boxes can read then finding the next video in a series may become an issue if someone already didn’t create a playlist.

Quality Content. Despite all the funny viral videos that spam the net and waste your time every now and then, most people still watch TV for quality content.  Some stations such as TBS and Cartoon Network are deploying full length video of previously aired shows (albeit with a little difficulty in listing them in order).  And Hulu gathers lots of once-on-tv programming into a single space and could help change the landscape of TV once they provide access to that content.

Having a simple guided access to episodic lists of quality content will be the key to Internet Video on TV.

Till then I’ll be happy with my TiVo, upset at Cablevision, and hoping that Hulu works on delivering their content (especially to TiVo.)  And Tivo, if you’re listening, check out Boxee Box as competition despite it’s lack of a coax interface.

After many many efforts to to figure out how to get Photoshop to render colours properly when using “Save for Web & Devices” I believe I have the definitive answer (but please try it out and feel free to comment if does or doesn’t work for you or you have a better solution).  I read blog after blog and scoured froums and tried every setting in Photoshop that everyone recommended with no success.  Then after discovering iunformation about gamma settings and OS X and various color management tools I found the ColorSync Utility which solved my issues.  Open up this application and select the Devices tab.  Then go into Displays and set all available to use /System/Library/ColorSync/Profiles/sRGB Profile.icc as their Profile (click on the down arrow next to Current Profile to find it.) and your screen will change to match the new profile.  You might find it a little odd at first since you’ve been using a different one for a while, but now when you save an image for web in Photoshop it will look exactly like your PSD.

colorsyncutility

Short URLs are great, they make sharing blog posts and YouTube videos easy for things like Twitter and old school email programs that love to break URLs into multiple lines causing frustrated users to cut and paste humpty dumpty URLs.  They do however have a lot of down sides.  They may not point where you think they do, and can be easily spammed around and provide for some pretty effective trojan horses.  These tiny locators usually don’t include your own domain name, so trackbacks for blogs, statistics or Google Page Rank don’t work (Although I’m sure Google has a plan in the works for this.)  Many sites implement their own sharing tools that let you save and share links to their site.  Many of the free externally hosted tools use their own URL shortener or own of the major players like bit.ly (recently acquired by Twitter.)  This still adds just more URLs out there that you don’t control.  You can solve this by having your own inhouse service (homegrown or bought using a whitelabel service) that will use yor own domain which will help with your own stats, trackbacksGoogle Page Rank.  But if the visitor of you your site doesn’t know how to easily get this URL they won’t use it.  The most common place to get the URL is of course from the Address Bar and people will cut and paste it or use a plugin to autosubmit the URL to a shortener or to a Twitter service.

I think a solution can lie within the page and camn be consumed by the browser and other services.  For browsers it could work as either a built in feature like the common favicon.ico or via a plugin for now till things catch. When a browser knows that a page has a short URL it could provide an option to copy that or allow for it to be passed easily to other plugins when requested.  When services such as Twitter post a link and wish to shorten it, they can check the page for the existenence of the shorturl and use that over one they would use by default.  This does however mean that the service has to retrieve the page or it’s headers to get this info and then check that the shorturl does in fact meet their length requirements.  The other issue is if the page lies and links to something false.

In thinking about the use of the <link> tag for an in-page solutiuion I came across someone that had a similar idea: <link rel=”shorturl” href=”http://example.com/12345″ />

I don’t know what would suffice as the perfect solution, but I think it can only be solved via the community at large.

Reblog this post [with Zemanta]

News, Twitter Style

Short URL

Twitter is obviously a huge part of people’s lives, not many of these people, but many.  I for one see it as a great medium for learning news and interacting with my “real world” friends and even finding new ones.  It’s even a great resource for marketing oneself and helping to locate new jobs as well.

Twitter is akin to email where the basis for it is ver simple, it’s a transportaion layer for information.  This information is only limited by 140 characaters.  This still leaves the layer quite open.  The idea of distributing news via Twitter is among the many ways that illustrate the powerful nature of their simple transportation layer.  Riding on top of that layer is RiotFeed which has a few dozen or so Twitter accounts where they aggregate and categorize news on various topics such as Technology, Green Living, and Trends and Culture.  They collect news from other Twitter accounts and the web and put it into a single use news feed.  I do wish they would attribute Twitter resources with the @ sign, but that’s a small gripe.  The concept and the follow through are well done.

Even with Twitter being a single access point, the plethora of clients provide for a personalized way to retrieve the news.  I’m not going to go to Facebook for news, and with a limited number of alternative facebook clients and because of Facebook’s complex user interface you really need to go to the site to get the most of it. This shows where Twitter really shines.

Reblog this post [with Zemanta]

Twitter Trending Topics are a very cool thing and it is interesting to see how information spreads through Twitter.  An example that’s relevant today is the #IranElection.  But if you look at the current results (and since Twitter search is real time you may or may not see it) there are quite a number of ReTweets very often.

So It makes me think about how much is something really a “trend”.  So that means you need to define trend or at least define it for yourself or the twitterverse.  For me I’m more interested in seeing real content that is relevant to me.  So that means true conversations and discussion of a topic.  And a retweet as helpful and nice as they are, are not nessecarily real content when they reach a mass large enough to be a trend.  So I would like to see an option to the Trending Topic search that removes retweeting from the results.

Since retweets are not standard I’m sure it wouldn’t be perfect but I figure that by removing tweet results that start with “RT ” or “retweet ” or ones that have ” via @” near the tail of the tweet could constitute a retweet.  I’m sure there are a few others as odd apps like to come up with their stnadards (like “RT:”)  So another means either in conjunction or by itself is to remove tweets that are 95% similar to other tweets.  If you said the same thing as someone else then that data is not nessecarily as important in most cases.

Now I don’t propose that this option be a default unless it’s perfected but that like I’ve said that it is at least an option to help weed out the results to get decent content.  Since in the end the real reason to search is to find.

Reblog this post [with Zemanta]

Why do tracking/analytics companies want their code placed at the top of the page (meaning below the opening tag) to be properly tracked? If a user exits quickly they should not be tracked.  It seems quite duplicitous to track a user that has exited a page before it has even finished loading.   Granted if you have a site that takes a bit to load you shouldn’t wait till everything on the page loads, otherwise you’d never realize that your page load time results in lost visitors.  But if a user exits a page or clicks away very quickly that visit doesn’t really count.  It would be like Nielsen tracking every channel I skip when I surf TV using the channel up button.

I also simply can not believe it when a tracking company claims that their code will not be guaranteed to work if placed in the <head> of the document or if the code is wrapped inside a generic tracking function.  If your code can’t be wrapped or placed in the <head> what did you do wrong in the first place, or what kind of tricks are you trying to pull? I don’t like to always use the exact code provided by these companies when working on a client website.  Your client’s needs for analytics may result in them changing tracking companies and then the developer would be forced to make widespread changes across a site to deal with such change.  Granted this type of change is not all that frequent, but it does happen and being prepared is far easier than redoing work.

I’m also not convinced that the analytics provided by many companies is accurate enough.  I’ve seen on many occasions that raw stats provide disparaging numbers when put against 3rd party companies and even between multiple 3rd party tracking companies when used together on the same page.  When the numbers of hits you receive on your site is the means for convincing ad placement or other financing I think that accuracy is quite important.

Reblog this post [with Zemanta]

There’s a basic issue with placing floating <div>s or any floating element for that matter in a parent <div>, the parent looses all sense of height and becomes essentially invisible.  The parent can now no longer have a background, border or any defining style that would show up behind and around the children elements.  But with a bit of CSS you can remedy that situation. Look at how the Example After heading is pushed around because the <div> isn’t cooperating nicely.

HTML:

<div id="Footer">
	<a href="/blog/">Home</a>
	<a href="/blog/contact/">Contact</a>
</div>

CSS:

#Footer {
	background: yellow;
	border: 1px solid blue;
}
#Footer A {
	float: left;
	width: 100px;
}
#Footer:after {
	content: "";
	display: block;
	height: 100%;
	clear: both;
}

Example Before:

Example After:

MODx Math

Short URL

Just found my self needing to implement an <iframe> into a MODx site, and since I wanted to have the <iframe> be part of the template I felt it would be best to have the src, width and height be template variables making the <iframe>’s appearance based on the content and not fixed. For my particular needs I was wrapping everything in a <table> that then needed to have a width slightly larger than the <iframe>. For this I came up with a simple snippet that evals a little equation forcing it to an integer to be safe:


<?php
// eg: [[math?math=[*iframeWidth*]+34]]

if (isset($math)) {
     eval("\$math = (int) ". $math .";");
     echo $math;
} else
     echo "0";
?>

So if [*iframeWidth*] is set to 550 and I have <table width=”[[math?math=[*iframeWidth*]+34]]“> in the template then the rendered HTML will be <table width=”584“>

Reblog this post [with Zemanta]

In Other News...