Google Maps Sidebar Widget for Wordpress (Per Post)

01.05.2010 0

My friends at Moss Creek Media had an idea.  They wanted to put a Google map of where a picture was taken next to the image.

I looked at all the plug ins and could only find one that added a Google map to a sidebar.  This was great! Something existed so I didn't have to build it but, it only supported one location (defined globally for every instance of the widget) and  what I needed to do was set the location according to the currently displayed image.

Modification time

The original plug-in google-map-v3-for-idn created by Raphael Berrhoun was very easy to modify. I created a new shortcode called gps that you insert into each post where the sidebar widget is displayed.

 [gps latitude="43.62132" longitude="-71.629517" description="<strong>House of Goodness</strong><br/>31 Main St<br/>Oakland, CA 12334"] 

Next all I had to do was modify some of the javascript to read the values passed in by the shortcode (should they be available). If the values were not present then it defaults to the normal values.

function makeMap() {
                        var lat = '".$lat."';
                        var lng = '".$lng."';
                        var info ='';
                        if ( (document.getElementById('gps-latitude')!='undefined') && (document.getElementById('lng')!='undefined') ) {
                             lat = document.getElementById('gps-latitude').innerHTML;
                             lng = document.getElementById('gps-longitude').innerHTML;
                             info = document.getElementById('gps-description').innerHTML;
                        }

Usage

You can download my modified the version of the plug-in. All that you will need to do is add the GPS line to your post and make sure you have installed the widget into your sidebar and populated the Google Maps API key. (Under settings in the control panel)

  mod_google-map-v3-for-idn.zip (14.3 KB, 54 hits)

Directory Monitor

20.04.2010 0

Monitor Types

  • File Created
    This gets kicked off when a file is created in the directory.  It will not wait for the fileto finish being created before the process starts.
  • After File Created
    This gets kicked off when a file is created in the directory and waits for it to finish.
  • File Deleted
    This gets kicked off when a file is deleted.

Threading

Wherever possible the program runs in a single thread environment with the exception of waiting for a file to complete.

Command-line

Two command-line options are available. -autostart and -minimize

These will automatically start the monitoring process and minimize the application to the tray.  The commandline options will
only function using the last settings you ran the program with (saved settings).

ex. dirmon.exe -autostart -minimize

Extensions

There are no periods in front of the extensions, its just a list separated by spaces, EX. bat gif jpg

  DirMon.zip (548.3 KB, 871 hits)

Javascript Curvy Corners Mootools Version

01.04.2010 1

What is CurvyCorners?

A free JavaScript library for creating gorgeous rounded corners for HTML block elements i.e. DIVs. Supports anti-aliasing, borders and background images.

Currently Firefox, Safari and Chrome have limited support for the proposed CSS3 border-radius selector.

This is an awesome library, simply include the script tag and code your css with CSS3 rounded corner properties and it automatically detects IE and rounds the corners for you.

Script tag:

<script src="js/curvycorners-moo.js" type="text/javascript"></script>
Sample CSS:
.navbar {width: 980px; border: 1px solid #555; -moz-border-radius:3px; -webkit-border-radius:3px; }

For more information please see the authors home page: http://www.curvycorners.net/

Mootools Version

There is an addEvent inside the Curvy Courners JS module, I replaced this with Mootools code so it no longer causes a conflict.

  curvycorners-moo.zip (30.4 KB, 109 hits)

Projects of Intrest

14.02.2010 0

PhoneGap is an open source development tool for building (compiled) fast, easy mobile apps with JavaScript.  (iPhone, Android, Palm, Symbian and Blackberry)

http://phonegap.com/

MooTools is a compact, modular, Object-Oriented JavaScript framework designed for the intermediate to advanced JavaScript developer.

http://mootools.net/

MooLego UI is a small, minimal & extensible, Object-Oriented JavaScript User Interface Framework based on Mootools.

http://ui.moolego.org/

Plupload allows you to upload files using HTML5 Gears, Silverlight, Flash, BrowserPlus or normal forms,

http://www.plupload.com/

APE is a full-featured OpenSource solution designed for Ajax Push.  (Uses mootools for its server-side JavaScript)

http://www.ape-project.org/

Weather Lookup

12.02.2010 0


Lately, I have been exploring the Silverlight technology.  I wanted to share with you the application I wrote with this interesting technology.

The application is another weather forecaster, you type in your zip code and it goes out to Weather Underground and grabs the data to build the page.

Download the source: HERE
Preview the app: HERE

Getting Weather Information from Yahoo Web Services in C#

09.02.2010 0

I wrote an article sometime back on The CodeProject that dealt with Geolocation. I wrote this back in 2005 so I figured I would update my post here and add a new twist.

The new code still uses YAHOO’s web services, however this time I am writing it in LINQ and C#. So lets dive right in shall we? This is a simple console based program, you can re do it as a webapp or a forms program, but the concept is the same.
using System;
using System.Linq;
using System.Xml.Linq;

namespace YahooWeather
{
    class Program
    {
        public string appid { get; set; }

        public Program(string appid)
        {
            this.appid = appid;
        }
    }
}

It starts off as any program does with a basic namespace deceleration, as you can see there is one property called appid that gets set when you create an instence of this class.

        public string GetWoeid(string Zipcode)
        {
            string query = String.Format("http://where.yahooapis.com/v1/places.q('{0}')?appid={1}", Zipcode, this.appid);
            XDocument thisDoc = XDocument.Load(query);
            XNamespace ns = "http://where.yahooapis.com/v1/schema.rng";

            return (from i in thisDoc.Descendants(ns + "place") select i.Element(ns + "woeid").Value).First();
        }

This function loads up http://where.yahooapis.com/v1/ and grabs the XML stream with LINQ then returns the woeid. The woeid is a unique number that identifies your location

Next, we have to get the weather RSS feed from Yahoo using your woeid

        public void GetWeather(string Zipcode)
        {
            string query = String.Format("http://weather.yahooapis.com/forecastrss?w={0}", GetWoeid(Zipcode));
            XDocument thisDoc = XDocument.Load(query);
            XNamespace ns = "http://xml.weather.yahoo.com/ns/rss/1.0";
            var results = (from i in thisDoc.Descendants(ns + "forecast") select i);

            foreach (var thisResult in results)
                Console.WriteLine("{0}, it will be {1} with a low of {2} and a high of {3}", thisResult.Attribute("date").Value, thisResult.Attribute("text").Value, thisResult.Attribute("low").Value, thisResult.Attribute("high").Value);
        }

This function prints out the current weather conditions. In the same way we got the woeid (parsing xml/rss), we are getting the weather results. All thats left now is the main procedure.

        static void Main(string[] args)
        {
            Program thisYahoo = new Program("<strong>YOUR KEY HERE</strong>");

            Console.Write("Enter your zip code please: ");
            thisYahoo.GetWeather(Console.ReadLine());

            Console.Write("Press Enter...");
            Console.ReadLine();
        }

View the Yahoo GeoPlanet API documentation | View the Yahoo Weather API documentation | Get a Yahoo application ID

  Weather.zip (736 bytes, 131 hits)

Redirect Blogengine Links to Wordpress (running on a Rackspace Cloud)

26.01.2010 1

Problem

I used to have a web server running IIS and BlogEngine.  When people come to my new site looking for an article they will get a nasty error.  For one the site is now PHP.  I wanted to remap all the files from the old URL’s to the new URL’s.

Old URL
http://www.devclarity.com/blog/post/topic.aspx

New URL
http://www.devclarity.com/index.php?s=topic

I figured I would just put a redirect in .htaccess, but little did I know that the web server sees the .aspx extension of the old URL and processes it on the IIS server.  Thanks a lot Rackspace Cloud :-)

Solution

I created a Web.Config file to send all errors to a page called Redirect.aspx.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.web>
		<customErrors defaultRedirect="redirect.aspx" mode="On">   
		    <error statusCode="500" redirect="redirect.aspx" />
		    <error statusCode="404" redirect="redirect.aspx" />
		    <error statusCode="403" redirect="redirect.aspx" /> 
		</customErrors>
    </system.web>
</configuration>
Then, redirect.aspx takes the URL and modifies the aspx extension to a html one and redirects the new link back to the page.
<%
	Dim ASPXPath as String
	
	ASPXPath = Request.QueryString("aspxerrorpath") 
	ASPXPath = ASPXPath.Replace("aspx", "html").replace("-", "+")
%>
<html>
<body>
	<h3>Please wait, your content has moved</h3>
	
	<script>
		window.location='<%=ASPXPath%>';
	</script>
</body>
</html>

Old URL:
http://www.devclarity.com/blog/post/topic.aspx

New URL:
http://www.devclarity.com/blog/post/topic.html

So now, the only thing was setting up the .htaccess file to handle the old url.  What this rule does, is it takes the topic out of the passed URL and reroutes it to the Wordpress search engine.
RewriteRule ^blog/post/([\w-\+]+)\.html$ /index.php?s=$1 [R=permanent,L]

Result

http://www.devclarity.com/blog/post/Backup-Mover.aspx now takes you to the remapped Backup Mover page on the Wordpress site.

(Of course, this post is new so if you use the old backup-mover link you will see this page first with the backup mover article under it :-( )

Batch resizing of multiple images in multiple sizes

23.07.2009 1

Multiresize About

Introducing MultiResize
Great for web developers or anyone who needs to create multiple or single sizes of any image(s). Have a photo gallery and need to create multiple images in multiple sizes? Create as many sizes as you want, process as many images as you want and name them however you want.

Features
High quality bi-cubic resizing algorithm
Supports for any amount of files
Supports for any number or resizing jobs
Saving and loading of jobs for repetitive tasks
Image aspect ratio maintained

Requires Microsoft .Net v2

Usage
Step 1: Click on the “Add Images” to select the images you wish to process.
Step 2: Click on “Configure Jobs” to setup the resize jobs for each file.
Step 3: Click on “Process Images” to render the images

The resulting images are created in the same folder as the source images.

Screen shots

Multiresize Jobs

Multiresize Jobs

Multiresize Main

Multiresize Main

Nag Screen
One when you start the application, another when you start processing your file(s) and lastly when you finish processing your file(s).
You can process an unlimited number of images and preform an unlimited number of jobs with this demo.  When you register the nags go away.

Purchase for $10.00 | Video tutorial (from DownloadTube)

  MultiResize-Setup.msi (574.5 KB, 86 hits)

Awards:

Hosted On:

Gallery extension for BlogEngine

04.06.2009 0

Paul Tumelty wrote a very nice BlogEngine component that creates a page of Lightbox 2 links dynamically from a directory of images.

I have added to this extension, you can now pass in a “SetName” to define a set of images.  Defining a set of images in lightbox allows you to use the built in Previous and Next capabilities of Lightbox 2.

I also noticed an error with thumbnail generation, it was hard coded to a value of 75, that has been fixed as well.

Get the Lightbox JS here
Get the Gallery extension here

Download the update

  Blogengine-Lightbox.zip (3.4 KB, 78 hits)

I also had an issue with Prototype interfering with lightbox (making the application appear not to work).  If this happens to you simply update the blog.js file in your installation root directory of BlogEngine to correct this error.

Vista Sidebar Gadget

23.11.2007 0

There is an observatory close to where I live called the “Mount Washington Observatory” (http://www.mountwashington.org/). It just so happens to be located on top of Mount Washington who would have thought it? Anyway, they post pictures every 15 minutes from the five different public cameras located across on the property. I thought it would be cool to make them into a Vista slide show gadget, while adhering to bandwidth conservation. The images the gadget uses are pulled from a mirror site (I mirror them on this server, http://devclarity.com/MWO) so not to choke MWOs bandwidth. The images will cycle often (configurable) but will only be updated every 15 minutes, there is also a time each day where no new images will be processed (9pm to 3am, the cams have trouble seeing in the dark :-) ).

Updates
Nov 26 2007: Minor Bug Fixes
Dec 20 2008: Fixed image overflow

Credits
My friend Kirk for doing up the graphics and Mount Washington (of course) for posting the images in the first place.

Screen shot (It’s dusk so the image is dark, you can zoom in by clicking on the image)

Download Link

This gadget is defunt, the image mirror no longer exists.

  MtWashington.gadget (204.7 KB, 85 hits)