Tuesday, March 22, 2011

Using Flash Media Live Encoder 3.2 with Red5 RTMP Server

Live streaming is tricky. But, FMLE + Red5 is a cheap way to do it that gives you even more options than you'd have with with Flash Media Server.

I simply installed Red5 and the oflaDemo application. Then, I fired up Flash Media Live Encoder 3.2. I gave the URL of rtmp:myserver/oflaDemo to FMLE, with a stream name "myownstream".

To test viewing, I used the included Publisher demo application. I specified the "Location" as rtmp:
myserver/oflaDemo and clicked "Connect". Then, I specified the "Name" as "myownstream" and clicked "Play". Magically, it worked!

I hope this simple tutorial can bootstrap you into live streaming with Red5.

Thursday, May 20, 2010

SSL Certificates from the Command-Line

If you've ever wondered how to easily inspect a certificate from the command line, look no further than openssl.

openssl s_client -connect hostname:port

If you ever need to look up several hosts at once and want to report the ones which will expire before a given date, try this script:

hostFile="/tmp/ssl_hostnames"
thresholdDate="June 30, 2010"
(for hostAndPort in $(< $hostFile )
do
  dateStr="\
               $(date -d "\
                              $(echo blah |\
                                 openssl s_client -connect $hostAndPort 2> /dev/null |\
                                 sed "1,/Server certificate/ {d}; /subject/,$ {d;};"|\
                                 openssl x509 -text 2> /dev/null|\
                                 grep "Not After"|\
                                 sed "s/.* : //"\
                                )"\
                  )"
  if (( $( date -d "$dateStr" +%s ) <= $( date -d "$thresholdDate" +%s ) ))
  then
    echo ${hostAndPort%:*}\|$dateStr
  fi
done)| column -s "|" -t

Right now, there's not much error checking in this script. And, I'm not doing any TLS stuff. The hostFile just contains host:port pairs, one host per line.

Friday, May 7, 2010

Moving from MyWeb to Live@Edu

The personal webhosting service offered to all UGA affiliates is called MyWeb. It offers only 200mb of storage. The advantage is that javascript, iframes, etc. are allowed, which is not the case for many free website hosting tools, especially the fancy WYSIWIG ones. So, I haven't convinced you that MyWeb has value? Well, consider redirecting your myweb page to your live@edu profile,Spaces page, or other site that you do maintain. Here's how:

<html>
<head>
<meta http-equiv="refresh" content="0;url=http://YOUR_CID_HERE.profile.live.com/">
</head>
</html>
  • Save the file on your computer with a name of index.html
  • Log into your MyDrive web interface at https://mydrive.uga.edu/NetStorage/
  • Navigate to the Home@UGA->www folder
  • From the File menu on the right, select Upload
  • Click Choose File and select your newly created index.html file
  • Click Upload

You could also choose to only redirect certain directories of your site by adding a similar index.html file in the subdirectories that you desire to redirect.

Making Linux Talk Microsoft live@edu

Overview

Our new mail solution will be Exchange 2010 in the form of Microsoft's Live@edu hosted environment. Sounds swell for Microsoft lovers. But, what about us Linux folk? What clients can we use to have as rich an experience as the Microsoft crowd? What to do? Sometimes, the best or only answer for users of any operating system is to use the web interface. Mostly, we'll explore the thick client options in this article.

Email

Evolution hacks seemed to work against Exchange 2007. But, all webdav has been yanked from 2010. I almost lost hope.

The best solution I've come across is Thunderbird + Lightning + xdata-provider. Lightning adds calendar functionality to Thunderbird. The xdata-provider add-on extends the Lightning to interact with the Exchange 2010 calendar. Thunderbird will speak IMAP to Exchange to fetch mail. Lightning/xdata-provider will handle the calendar.

What you'll need

  • Thunderbird
  • the Lightning add-on (available as the "lightning-extension" package in Ubuntu)
  • xdata-provider add-on for Thunderbird

Caveats

Thus far, I've had trouble editing Exchange calendar events in Thunderbird. Nor have I been able to reply (accept/decline) event invitations. Essentially, it has proven useful only for adding new events. I don't even think it has alerted me

Instant Messaging

Empathy provides Instant Messaging capabilities for your live (MSN) account.

Cloud Storage / Collaboration

As for SkyDrive, the best solution is to forget about it (until a Linux client comes along) and use DropBox. Same goes for Office Live Workspace, which will greet you with an "Windows users only" error anyhow.

A couple nice features of SkyDrive is that you can do light editing on Office documents without downloading them. The other is the SSO (single-sign-on), which saves you a click or two.

Blog / Simple Web Site.

I see no point in using Spaces, since there are better blog tools out there and this tool is in no way branded to affiliate one to UGA or any easier to use because of our agreement. Your spaces account must be unique in the spaces.live.com namespace, which already has millions of users.

Tuesday, April 13, 2010

Update Twitter With PHP

There are many API's to interact with Twitter using a variety of languages. I tried twitterlibphp by Justin Poliey, giving him a vote of confidence just for using git. Plus the documentation is clear. I was up and running within 10 minutes with only three lines of code! Thanks Justin!

This code will update my status:
<?
require_once("twitterlibphp/twitter.lib.php");
$twitter = new twitter("screen_name","password");
$xml = $twitter->updateStatus("test at " . time(),'556');
//$xml = $twitter->destroyStatus(12120224745);
echo $xml;
?>
The reply you'll get (by default) looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<status>
  <created_at>Tue Apr 13 20:05:23 +0000 2010</created_at>
  <id>12121728569</id>
  <text>test at 1271189121</text>
  <source>&lt;a href=&quot;http://apiwiki.twitter.com/&quot; rel=&quot;nofollow&quot;&gt;API&lt;/a&gt;</source>
  <truncated>false</truncated>
  <in_reply_to_status_id></in_reply_to_status_id>
  <in_reply_to_user_id></in_reply_to_user_id>
  <favorited>false</favorited>
  <in_reply_to_screen_name></in_reply_to_screen_name>
  <user>
    <id>132618355</id>
    <name>UGA Status Page</name>
    <screen_name>uga_status</screen_name>
    <location></location>
    <description></description>
    <profile_image_url>http://s.twimg.com/a/1271107021/images/default_profile_2_normal.png</profile_image_url>
    <url></url>
    <protected>false</protected>
    <followers_count>0</followers_count>
    <profile_background_color>9ae4e8</profile_background_color>
    <profile_text_color>000000</profile_text_color>
    <profile_link_color>0000ff</profile_link_color>
    <profile_sidebar_fill_color>e0ff92</profile_sidebar_fill_color>
    <profile_sidebar_border_color>87bc44</profile_sidebar_border_color>
    <friends_count>0</friends_count>
    <created_at>Tue Apr 13 18:43:15 +0000 2010</created_at>
    <favourites_count>0</favourites_count>
    <utc_offset>-18000</utc_offset>
    <time_zone>Eastern Time (US &amp; Canada)</time_zone>
    <profile_background_image_url>http://s.twimg.com/a/1271107021/images/themes/theme1/bg.png</profile_background_image_url>
    <profile_background_tile>false</profile_background_tile>
    <notifications>false</notifications>
    <geo_enabled>false</geo_enabled>
    <verified>false</verified>
    <following>false</following>
    <statuses_count>1</statuses_count>
    <lang>en</lang>
    <contributors_enabled>false</contributors_enabled>
  </user>
  <geo/>
  <coordinates/>
  <place/>
  <contributors/>
</status>

To delete that new status update, run:
<?
require_once("twitterlibphp/twitter.lib.php");
$twitter = new twitter("screen_name","pass");
$xml = $twitter->destroyStatus(12121728569);
echo $xml;
?>

The return XML looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<status>
  <created_at>Tue Apr 13 20:05:23 +0000 2010</created_at>
  <id>12121728569</id>
  <text>test at 1271189121</text>
  <source>&lt;a href=&quot;http://apiwiki.twitter.com/&quot; rel=&quot;nofollow&quot;&gt;API&lt;/a&gt;</source>
  <truncated>false</truncated>
  <in_reply_to_status_id></in_reply_to_status_id>
  <in_reply_to_user_id></in_reply_to_user_id>
  <favorited>false</favorited>
  <in_reply_to_screen_name></in_reply_to_screen_name>
  <user>
    <id>132618355</id>
    <name>UGA Status Page</name>
    <screen_name>uga_status</screen_name>
    <location></location>
    <description></description>
    <profile_image_url>http://s.twimg.com/a/1271107021/images/default_profile_2_normal.png</profile_image_url>
    <url></url>
    <protected>false</protected>
    <followers_count>0</followers_count>
    <profile_background_color>9ae4e8</profile_background_color>
    <profile_text_color>000000</profile_text_color>
    <profile_link_color>0000ff</profile_link_color>
    <profile_sidebar_fill_color>e0ff92</profile_sidebar_fill_color>
    <profile_sidebar_border_color>87bc44</profile_sidebar_border_color>
    <friends_count>0</friends_count>
    <created_at>Tue Apr 13 18:43:15 +0000 2010</created_at>
    <favourites_count>0</favourites_count>
    <utc_offset>-18000</utc_offset>
    <time_zone>Eastern Time (US &amp; Canada)</time_zone>
    <profile_background_image_url>http://s.twimg.com/a/1271107021/images/themes/theme1/bg.png</profile_background_image_url>
    <profile_background_tile>false</profile_background_tile>
    <notifications>false</notifications>
    <geo_enabled>false</geo_enabled>
    <verified>false</verified>
    <following>false</following>
    <statuses_count>0</statuses_count>
    <lang>en</lang>
    <contributors_enabled>false</contributors_enabled>
  </user>
  <geo/>
  <coordinates/>
  <place/>
  <contributors/>
</status>

Friday, April 9, 2010

Creating Favorite Icons For Your Website

Usually, I have so many browser tabs open that I only see the icons. And, my server logs fill with "favico.ico not found" errors. So, for the sites I manage, I want custom icons for easy identification. But, creating icons is a pain, right? Today, I was fed up with locating a couple of my sites which do not have icons. I thought, "I wonder if Linux's convert tool will make one for me without much effort." Sure enough:

convert --resize 16x16 cribbed_sqare_image.png favicon.ico

scp favicon.ico myserver:/docroot

Done!