Author Archive for ‘ Matt Sposato’

Matthew Sposato – Upcoming Presentations

Posted Friday, July 31st, 2009 by Matt Sposato

This fall I will present at the following events:

  • October 3rd – Richmong Code  Camp
  • October 8th – Roanoke Valley .NET User Group
  • October 15th – Charlottesville .NET User Group

Hope to see y’all there. Thank You

Presented to the Richmond Software Craftsmanship Group – 07/30/09

Posted Friday, July 31st, 2009 by Matt Sposato

Last night I had the pleasure of presenting ASP.NET Dynamic Data to the Richmond Software Craftmanship Group. Dynamic Data is a rich scaffolding framework that instantly web enables a database. As you might expect, it creates a database centric website. That was my first demo. My second demo showed how a Dynamic Data website can be customized and extended to become more user centric, perhaps following the user’s normal workflow. The slides and demo projects can be downloaded from my blog. The group discussedsome useful ways to apply Dynamic Data, such as simple reporting site, as a temporary application or perhaps to demonstrate a database.

Recent Teaching Demonstration

Posted Friday, March 13th, 2009 by Matt Sposato

Recently I gave a teaching demonstration at a local community college. This was part of the process of becoming an adjunct instructor/professor. If all goes well, I’ll start as early as the coming summer semester. I’m not sure what I’ll be teaching yet, most likely an established, introductory computer science class. Some of these classes teach the use of common applications like spreadsheets and word processing. By the end of the semester the students are doing some advanced stuff. Or I may teach an introductory programming class – using java of course. After a little experience, I will propose some .NET classes, either C# or ASP.NET. I’m excited to have the opportunity, wish me luck. I knew all those graduate CS classes would come in handy.

Here’s a link to the lecture I demonstrated: Object Oriented Programming – Encapsulation, Inheritance and Polymorphism.

Add Search to any Drupal Block

Posted Monday, March 9th, 2009 by Matt Sposato

 

I recently needed functionality to search a Drupal site, but the Drupal search block was already being used in the header section. And, unless I’m mistaken, the Drupal block admin page only allows a block to be placed in one section. Also I wanted a search that looked only in a specific content type, in my case a content type called “osc_news”.

My solution was to add html/php code to the body of a block I created. This code uses the existing search functionality, which is way easier than creating my own search functionality. I started by viewing the page source of the Drupal advance search form, which does allow the user to select a specific content type to search. This gave me the base html to add to my block. I had to add calls to the Drupal functions which create unique element ids: md5(uniqid(mt_rand(), true)). Then to search in a specific content type I added an hidden form element. I had to use attribute values which Drupal recognized and the “checked” attribute. Of course, this is not a standard element for a hidden element. But it did cause Drupal to search only in the specific type.

Click the link below to view the html/php code I added to my block. This code can probably be used in any user created block.

addsearchtodrupalblock

 

Client Side (JavaScript) Implementation of the Haversine Formula

Posted Friday, February 13th, 2009 by Matt Sposato

Given two points on the surface of a sphere the Haversine Formula can be used to find the shortest distance between the points. Well what do ya know, the Earth is a sphere. Well not really it’s a spheroid, the poles are a bit flattened. Even that does not account for the various irregularities in the Earth’s shape. A geodesist can tell you more. To get really precise a calculation would need to use the datum from the World Geodetic System of 1984 (WSG84). But that’s another post.

Here’s a link to the page: Haversine Calculation. Obviously, you can then use your browsers “view source” functionality to check out the source code. Turns out that posting the source code here really freaks out wordpress.

Drupal Webforms – Controlling the Submit Button

Posted Friday, February 13th, 2009 by Matt Sposato

The definition of frustration should be something about expecting a task to be short and simple but instead it takes a really long time. So it was with centering the submit button on a Drupal webform. Now, I don’t want to give you the wrong impression, because the Drupal webforms module is fantastic. Right out of the box it did 95% of what I needed. Another 4% was fairly easy to accomplish by adding code to the ‘Webform advanced settings’ -> ‘Additional Processing’ section. The last 1% was a bit trickier to figure out, which was controlling the position and layout of the submit button.

An implicit assumption is that most websites want to ‘brand’ or customize their buttons. Is this a fair assumption? Here’s the default submit button of a Drupal webform.

 

 

 

 

 

 

 

 

 

Please, someone correct me if I’m mistaken, but I could not find a way to control the appearance and layout of the submit button in the webforms admin interface. Which was kind of surprising, because the webforms module is feature rich. I was expecting a way to designate an image for the button and perhaps basic position settings (left, center, right). Again, to be fair, Drupal module development is open source developed, so I could contribute instead of casting stones, no?

Anyhow, a quick peek at the page source of a form created with Drupal webforms shows this HTML for the submit button:

 <input type=”submit” name=”op” id=”edit-submit” value=”Submit” class=”form-submit” />

Which is inside this form tag:

<form action=”/all_your_base”  accept-charset=”UTF-8″ method=”post” id=”webform-client-form-3257″ class=”webform-client-form” enctype=”multipart/form-data”>

The good news here is that both these elements have a class attribute. Again kudos to webforms team for doing this. So CSS to the rescue. Here’s the CSS I’m using to theme the submit button

.webform-client-form .form-submit {

  background: url(‘/site/images/submit.gif’); 

  background-color:transparent;

  border:medium none;

  cursor:pointer;

  padding:0;

  width: 100%;

  height:32px;

  background-repeat:no-repeat;

  background-position:center;

}

As you can see, I’m using a background image, centering that image within it’s block and not repeating it. So here it is:

 

 

 

 

 

 

 

 

Two problems remain. Notice the text “submit” on top of the button image. As you’ve guessed, “submit” is the default text of the button. The workaround to get rid of the word “submit” is  to put a single space (‘ ‘) in the ‘Webform advanced settings’ -> ‘Submit button text’. Kudos to my colleague Youssef Chaker for finding this work around. An additional setting such as upload image button or url to button image would have been nice. Here is the final look of the submit button.

 

 

 

 

 

 

 

 

 

The remaining problem is that the CSS setting “width:100%” makes the entire width of the block clickable, not just the area above the submit button image. It’s not ideal, but getting the button centered was more important. Tradeoffs, such is our world….

 

Actually I found a new definition of frustration – getting this WYSIWSG editor to properly format and position text.

Charlottesville .NET User Group Meeting: Sept. 18th.

Posted Tuesday, September 2nd, 2008 by Matt Sposato

The Charlottesville .NET User Group will meet on September 18th from 6:30-8:30PM at the SNL Headquarters building (One SNL Plaza, Charlottesville VA 22902)

G. Andrew Duthie, Microsoft Corp. will present “Controlling AJAX when you’re out of control”

While implementing and troubleshooting AJAX functionality in an application is rarely easy, it gets even harder when you don’t have complete control over the site where you have to implement it. Shared hosting environments, blog accounts on large blog sites, etc. are situations where you may have only limited control over where and when your javascript gets loaded and executed. In this talk, Microsoft developer evangelist G. Andrew Duthie will walk you through some examples of how you can overcome limitations on such sites, and how to troubleshoot some of the inevitable issues you may run into. Some basic understanding of javascript and AJAX is assumed. Examples will span from simple mouseover image manipulation to implementing controls such as Microsoft’s Virtual Earth and Vertigo’s Slideshow Silverlight photo gallery.

Charlottesville .NET User Group: Thursday July 17th 6:30-8:30PM

Posted Tuesday, July 15th, 2008 by Matt Sposato

This Thursday, July 17th 2008, the Charlottesville .NET User Group will meet from 6:30-8:30PM. Kevin Hazzard will present “Accessing Web Services from Silverlight 2 Beta 2″. The meeting will be held at the SNL Galactic Headquarters: 1 SNL Plaza, Charlottesville, VA 22902 (map).

Agenda:
6:30 – 7:00: Sign In, meet & greet
7:00 – 8:00: Presentation
8:00 – 8:30: Informal discussion, socializing
Description:
Silverlight is a client-side technology. So it’s not really a part of your SOA strategy, right? You may want to think twice about that. SOAP and WSDL support are coming to the web desktop via Silverlight. And Silverlight has good client support for REST+ JSON/POX and RSS/ATOM-based web services, too. During this discussion, we’ll dive into data serialization, security and cross-domain access policy capabilities inside Silverlight 2 Beta 2. We also talk about the nuances and pitfalls of provisioning your web services for an Internet audience. This presentation will be heavy on coding, demonstration and interactive discussion.
There is no charge for this event and everyone is invited. Food and beverages will be provided.