Archive

Archive for December, 2009

Yahoo Picture Plugin for WordPress.

December 30th, 2009 Jimmy No comments

Today I released my YahooPics plugin for WordPress. The plugin lets you display pictures from Yahoo’s Picture search engine on your blog. You can display the pictures in a single post, on the sidebar, or anywhere you can edit your blog template. Currently I only support either 1 picture, or a 3 column set.

To get an idea of what this looks like, check out this page here. You can see the 8 pictures below my post content. My plugin went to Yahoo Pictures and grabbed & linked those pictures into my blog post. I use the Custom Field options built into WordPress to customize the keyword for each post.

The plugin page is located here: http://www.jimmyburnett.com/jb_yahoopics

Check out more of my projects here: http://www.jimmyburnett.com/projects

Forwarding a PHP website from one domain to another.

December 28th, 2009 Jimmy No comments

Forwarding a PHP website from one domain to another.If you are planning on moving a website from one domain name to another you’ll probably want to forward all your traffic from your old site. Many people just forward the actual domain name to point to the new domain name but this won’t help people who land on specific pages. If your links stay the same and it’s just a domain name change this can be done with just a few lines of code. If your linking structure has changed, you’ll need to do some additional work. Below is the code for a domain name change where the new site links are the same as the old site links with the obvious exception for the domain name.

This would be a good example of what you could do if you were running a CMS or Blogging system such as PHPNuke or WordPress. This code checks to see which page is being requested and then builds a new link to forward the user to. It also lets any search engines know your page has moved with the 301 header tag.

<?php
$uri = $_SERVER['REQUEST_URI'];  //Get the incoming URL request not including the domain name....
header("HTTP/1.1 301 Moved Permanently"); //Tell the requester this page has moved.
header('Location: http://www.new-website.com' . $uri);  //Concatenate the requested URL onto our new domain name and forward the requester.
die?>

If your new site contains a different linking structure than your old site you may want to forward your most popular pages to the newly formatted URLs.

<?php
$uri = $_SERVER['REQUEST_URI'];  //Get the incoming URL request not including the domain name....

$oldSiteLinks =  array("/contacts.html","/products.html","/chatforums/");
$newSiteLinks = array("http://www.newsite.com/aboutus.php","http://www.newsite.com/newproducts.php","http://forums.newsite.com");

//Make sure the two above array are aligned. Each element should be alligned to the corrisponding "oldUrl / newUrl" format.
//Element 0 in oldSiteLinks should forward to element 0 in newSiteLinks!

if(in_array($uri,$oldSiteLinks))
{
  //If the requested URL on the old site is one of the links I wanted to forward ($oldSiteLinks) then lets redirect that page...
  $idx = array_search($uri, $oldSiteLinks); //get the index for the oldsite link.
  $newURL = $newSiteLinks[$idx]; //Get the new link from the corresponding link array.
}else{
  //If we don't find a page in the $oldSiteLinks array just forward them to the new domain.
  $newUrl = "http://www.new-site.com";
}

header("HTTP/1.1 301 Moved Permanently"); //Tell the requester this page has moved.
header('Location:  $newURL);  //Redirect the requester to the new URL. The newSiteLinks array items contain the domain name so no concatenation is required.

There are of course more ways you can do this however this has been the easiest method I’ve come up with. Moving to a new domain name and new site all together with all new links is always challenging but with a few minutes of work you can at least forward your popular pages and sections of your old site to your new one.

Categories: Programming Tags:

Linux GUI Programming with GTK#, Hello World.

December 24th, 2009 Jimmy No comments

Today I was sitting next to a nice warm stove up in Vermont looking at some Linux Application code I’ve developed in the past. I thought, what a good time to make a quick and dirty “Hello World” GTK# tutorial. GTK# is the equivalent in Linux as Visual Studio is to Windows and both use C#(c-sharp) as their programming language. The drag and drop component interface works much like Visual Studio, but there are a few differences which are easy to get used to. GTK# works with containers a lot more than Visual Studio traditionally does, almost forcing to he user into dynamic GUI development. Visual Studio has more of the static method where Forms do not scale depending on the windows size of the application. GTk# does have a “fixed” static container that lets you drag and drop a component anywhere on your form much like Visual Studio. In this mini-tutorial I drag the “fixed” container to my form to let me build my GUI in a free-form-like fashion.

Now that we have dragged a “Fixed” container to our form we can draw a button and entry (textBox) component to our Form. Drag and Drop the component to your Form, then resize the component once it’s dropped on the Form. Read more…

Categories: Programming Tags: , ,

UNIProgrammer – Programming Forums

December 21st, 2009 Jimmy No comments


If anyone is interested in joining a professional programming forum check out uniprogrammer.com. I created this site with the idea of making it a close-nit community of programmers. The site is virtually spam free due to the strict review of memberships. All memberships are reviewed for approval before being allowed to access the site. The site has forums for all the popular programming languages, a section dedicated to database programming and a section for the new programmer type.

This site is sponsored and developed by Jimmy Burnett.

Categories: General Tags:

Creating a directory system for WordPress.

December 20th, 2009 Jimmy No comments

Have you ever wanted to post some resources but didn’t necessarily want them to be on your blog’s front page? I post lots of resources but I don’t want to bog my readers down with tons of RSS feed updates and posts on my frontpage, so I created a few PHP scripts for WordPress to help me do this. This is all done using native WordPress API functions. In fact, you don’t even need to make or install any plugins to get this working. The following examples shows you how to make a directory for WordPress just like I have here on my site.

Some prep-work to be done.
We’ll be working in your templates folder for the whole project. The first thing you need to do is create a new parent category for your directory root. For me I simply created a resources category. After creating a parent category you’ll need some sub (child) categories as well. I chose a few typical ones for my case such as Programming Tools, GIS Programming, and a few others. Now go add a few posts under those categories to get them rolling.

Read more…

Categories: Programming Tags:

Show thumbnails from a directory on your web server.

December 20th, 2009 Jimmy No comments

The following PHP code will display a set of jpeg files from a folder on your webserver. This code can be used to generate a list of thumbnails provided that the thumbnails are already resized. This code simply outputs the images “img” html tag with the “src” already in place. I would recommend putting this inside a “<div>” tag so that you can control the height and width of the images together. Creating CSS for your image can also control the actual size of the image, or you could just add a width or height to the img tag for auto-scaling.

&lt;?
$directory = opendir(&quot;/home/jimbob/www/htdocs/mypics&quot;);
while ($file = readdir($directory)) {
        if (preg_match(&quot;/\.jpg/&quot;,$file)) {
           echo &quot;&lt;img src=\&quot;drawthumb.php?http://somewebsite.com/mypics/$file\&quot; border=1&gt;&quot;;
           echo &quot;&amp;nbsp;&quot;;
        }
}
closedir($directory);
?&gt;
Categories: Programming Tags:

MapServer – A free GIS engine for everyone.

December 20th, 2009 Jimmy No comments

I’ve done a bunch of GIS development in my past programming days. Almost all of my experience was with the openSource GIS engine MapServer. MapServer is mainly a set of cgi-bin programs that let you read and display various map data such as ESRI Shape files, TIFF & geoTifff, and even ESRI ArchSDE data stored on remote servers. There is a scripting subset of MapServer called MapScript which lets you integrate GIS features into your PHP, Microsoft .NET, Perl, Python and Java based applications.

Around 2003 I was able to make a fully function PHP based GIS system which loaded ESRI Shape files, displayed them as a jpeg on a website and let users zoom in and out, and even select polygons for displaying the underlying geoData. Eventually I was even able to add a geoTIFF layer to display aerial photos.

I highly recommend this free GIS engine to anyone that is interest in integrating GIS features into their web based or even desktop based applications.

Features:
Support for popular scripting and development environments
PHP, Python, Perl, Ruby, Java, and .NET

Cross-platform support
Linux, Windows, Mac OS X, Solaris, and more

Support of numerous Open Geospatial Consortium (OGC) standards
WMS (client/server), non-transactional WFS (client/server), WMC, WCS, Filter Encoding, SLD, GML, SOS, OM

A multitude of raster and vector data formats
TIFF/GeoTIFF, EPPL7, and many others via GDAL
ESRI shapfiles, PostGIS, ESRI ArcSDE, Oracle Spatial, MySQL and many others via OGR

Categories: General Tags:

Quanta Plus, an HTML, CSS and PHP IDE for Linux

December 20th, 2009 Jimmy No comments

Quanta Plus is a web development IDE for Linux. QP is loaded with awesome features such as auto completion (even with Object Oriented PHP), SFTP and FTP connections, color syntax highlighting, local PHP preview, local Apache integration and more. I’ve used Quanta Plus for a long time and it’s one of my favorite Web Development Environments for Linux.

Categories: General Tags:

Limit RSS to certain categories in WordPress.

December 19th, 2009 Jimmy No comments

If you’re like me, you may once in a while have something to write about that isn’t necessarily related to your overall blog topic. Take me for example. My blog is mainly about internet and application development (programming) however sometimes I find a really cool tip or trick that isn’t necessarily related, such as a howto for example. Using this code I can exclude those posts from my RSS feeds. That way my main RSS subscribers don’t get caught reading off-topic posts, but they are there if they want to read them on the site. I then include just the headlines of those posts on my extended recent posts sidebar widget.

Anyways enough of the blabbing on onto the code. This code excludes categories 35 and 45 from my RSS feeds. You can get the category ID’s on your category admin page in your WordPress dashboard.

add_filter('pre_get_posts', 'filterRSSQuery');
function filterRSSQuery($query) {
    if ( $query-&amp;gt;is_feed ) {
        $query-&amp;gt;set('cat', '-30,-45');
    }   

    return $query;
}
Categories: Programming Tags: , ,

Mono, .NET for Linux,

December 14th, 2009 Jimmy No comments

mono .NET for Linux
Mono is a Novell and Microsoft sponsored effort to bring the .NET framework to Linux. Microsoft has partnered with Novell to provide the tools and libraries necessary for .NET development on the Linux platform. Currently the Mono project supports the .NET framework 3.5 to include WinForms 2.0. Some of the new technologies such as Silverlight and WPF have yet to make it into the Mono stable releases but the mono team told me that they are tracking Silverlight 3.0 and 4.0.

Hello,

No, you do not need to get any licenses for your customers if you develop with Moonlight.

Yes, Moonlight is tracking Silvelright 3 and 4.

On Fri, Dec 11, 2009 at 4:51 PM, wrote:
Sender: jimburnettva@…….

Message:

Do I need to get a license for my customers websites if I develop in Moonlight. Also, will Moonlight support SilverLight 3.0 and 4.0?

Thanks
-Jim