You are seeing a limited-style version of this site. Please upgrade your browser to view the site as it was meant. You can try Firefox, Google Chrome, or even Safari.

Brandon Martinez

Posts Tagged ‘Programming’

 

Clearing Floats With WordPress

Posted in: Technology | , , , , ,

Using a “float” in a web design is fairly common these days; it is used to float images for wrapping text, as well as being one of the easier, standard-compliant methods to achieve columns. For example, if you want to have a content column, with a sidebar column floating to the right, you would probably have something similar to this (example after the jump):

Continue Reading…

 
 
 

Cisco Clean Access + Mac OS X = Headache

At Ferris State University, the network implements a system called Cisco Clean Access (CCA). This is a system designed to keep all Windows-based computers up-to-date, secure, and authorized to use the network. On the Windows-side of things, it works decently. All that is truly required is the installation of Clean Access Manager, Norton Antivirus, and setting up your Windows Update settings to point to FSU’s Windows Update Server.

This is totally different if you use a Mac (or Linux, or any other OS). While there is technically a Mac client for CCA, it does not work as well as the Windows-based client. Luckily, there is still a backup plan for other operating systems: CCA will redirect you to a web-based login page, you fill in your user credentials, and bam! you’re on the network. Only a few caveats:

  • If you disconnect from the network for any reason (i.e. you’re using a laptop and you close the lid) for more than 5 minutes, you will have to re-login
  • Occasionally there are issues with computer identification and DHCP: I have run into issues where I was logged in, closed my laptop for 15 minutes, and was given an “IP in use” error. This has happened on more than one occasion, and not only to me, but a few of my classmates.
  • It’s just a hassle to have your web session interrupted by a Java app (and on that point, why is it a Java app? I’m pretty sure a standards-compliant web form would suffice) asking you to login

To get around most of these issues, I came up with a script to automatically login with my iMac. Essentially, it’s just a shell/bash script that is executed by launchd (you could use Cron on *NIX) every 5 minutes.

Continue Reading…

 
 
 

Git, Capistrano, SSH, and WordPress: An Awesome Combination

Posted in: Technology | , , , , , , ,

I’m not going to lie: lately I’ve been on quite the WordPress-kick. I love being able to create a design, cut it up into HTML-ready chunks, and then use a standard WordPress template to get it into production and on the web ASAP! Generally, my workflow looks like this:

  1. Create the design
  2. Cut it up for a web layout
  3. Create a sample web layout and test across browsers
  4. Cut the HTML up into a standard WordPress template
  5. FTP the design to a WordPress install (into the wp-content/themes directory)

Continue Reading…

 
 
 

Sanitizing Phone Numbers With C#

Posted in: Technology | , , ,

An extension method to remove all but digits from a phone number. This should be useful for sanitizing input to put into your database.

using System.Text.RegularExpressions;

namespace CustomStringMethods
{
	public static class PhoneNumber
	{
		#region Class Methods

		public static string StripAllButDigits(this string s)
		{
			return (s == null) ? string.Empty : Regex.Replace(s, @"\D", string.Empty);
		}

		#endregion
	}
}

Obviously this can be used for more than just phone numbers.

 
 
 

C# Interfaces: Under (No) Construction?

Posted in: Technology | , ,

Why can’t C# allow for a constructor definition in an Interface? For example, say you have this interface:

namespace ValidationServices.Customers
{
  public interface ICustomer
  {
    // Properties
    ValidationRequest Request{ get; set;}

    // Methods
    ValidationResponse ValidateOrder();
    //....
    // and so on
    //....
  }
}

Continue Reading…

 
 
 

XMLUrlResolver: Using Embedded XSLT Resources in C#

Posted in: Technology | , , ,

Over the last week or so, I have been searching for a method to properly include XSL files via xsl:include within a .NET embedded resource. Apparently, using GetManifestResourceStream() (via an Assembly) wasn’t good enough (it wouldn’t follow the xsl:includes, simply ignoring them). Luckily, I came across a (semi-)working solution over at Signs on the Sand. Now, the concepts behind this were right, it just wasn’t working for my particular situation. Here’s the scoop:

Continue Reading…

 
 
 

What I’ve Learned So Far

Posted in: Technology | , , ,

So far, my internship has been going great! I’ve had many opportunities to work in a new environment, and I’ve been able to tap into one of my more underused skills: programming. Since I’ve been working for Independent, I’ve been able to learn a lot of new concepts; not only in programming, but in some of the operations of a business. Here is a brief overview of some of the things I have learned, or am learning.

Continue Reading…