Cody Sand

Web/Mobile Developer. Software Architect at Cartegraph in Dubuque, IA.

Read this first

Specifying ASP.NET Forms Authentication Timeout in Code

Microsoft’s Forms Authentication is the preferred mechanism to get login and security up-and-running on ASP.NET applications. In fact, it comes enabled by default in ASP.NET MVC projects.

Typically, you’d configure the timeout via IIS, or by directly editing the web.config for the application.

<!-- Example Web Config --> <authentication mode="Forms"> <forms name=".ASPXAUTH" loginUrl="Login.aspx" protection="All" timeout="1" path="/" slidingExpiration="true" /> </authentication> 

By default, your MVC application calls FormsAuthentication.SetAuthCookie(), which sets a cookie using the timeout declared in your web.config file. This is good for setting a default timeout, but there may be certain cases where you’d like a longer timeout per user role or some other criteria.

In these cases, you can use a FormsAuthenticationTicket object to specify your own expiration...

Continue reading →

So Do You Need jQuery or Not?

There’s been a lot of talk lately about the necessity of tools like jQuery for web applications in 2014. This is a result of a link that was posted on Hacker News this past week, fueling a large debate with parties from each side defending their position on going without tools like jQuery.

Proponents for these tools argue that some of the examples on the You Might Not Need jQuery site are misleading by making assumptions that you already have handles to certain elements you might otherwise be retrieving by jQuery selector, or overly basic examples that don’t accurately reflect real-world usage.

On the other wise of the argument, I generally agree with the sentiment that developers who are writing a reusable framework that doesn’t involve much DOM manipulation should make attempts to refrain from including jQuery as a dependency.

jQuery’s biggest selling point was its ability to...

Continue reading →

Simulate Mobile Network Latency, Delay, and Packet Loss in OS X and iOS Simulator

Recently, our team at work has been running into very intermittent issues with the sync process for our applications. Our users are sometimes working in rural areas, on mobile data networks, and we have reason to believe that our issues might be because of an intermittent or low-quality data connection. After a bit of searching, I came across a StackOverflow post that referenced Apple’s ‘Network Link Conditioner’. This utility allows you to simulate a variety of delays, network speeds, and levels of packet loss, allowing you to more realistically test how your app might perform on these networks.

Of course, you can always manually disconnect from your network to simulate a complete loss of connectivity, but being able to simulate packet loss and latency is a much more accurate test of what your users will experience when using real-world data networks. On top of that, installing the...

Continue reading →

Learning Objective-C, OS X, and iOS Programming

Since switching to a Mac last year, I’ve been determined to learn as much as I can about Objective-C and native OS X and iOS development. Typically, when I’m looking to learn a new language or subject, after I’ve exhausted the free online materials, I head straight to books from O'Reilly, Manning, or Addison-Wesley for a more in-depth look at the topic. This time around, I was very surprised to find dozens of very high quality programming guides and reference documents for developing on Apple platforms. To be honest, I was blown away by the quality of this documentation, and have yet to pick up a Cocoa or Objective-C book as I would have done in the past.

For starters, Programming with Objective-C is Apple’s official Objective-C language documentation. I started with this document, as I had never worked with Objective-C before and figured this was as good a starting place as any. Once...

Continue reading →

Sink or Swim and Taking the Plunge

When I finished college in 2010, I had already secured a job with Cartegraph by the time I graduated. Fresh off a COBOL internship with another company, working with C# and .NET 4 was a huge breath of fresh air.

When I first started, I was working on a project that would eventually allow us to create platform applications based on UML diagrams. It was on this project that I finally realized that I actually was a competent programmer and was eventually able to overcome the imposter syndrome that had my anxiety peaking as graduation approached.

About a year later, Cartegraph started development of their new flagship web application. We began constructing the server in ASP.NET MVC 3, and things began scaling quickly. I eventually found my way to the client-side, as the web-app had grown into a single-page web application, and we needed a more dynamic client with each passing day. Outside...

Continue reading →

Why I Left Facebook

Yesterday, I made the decision to deactivate my Facebook account. This is something I’ve done once or twice in the past, but this time I’m hoping to go without Facebook for a significant period of time (the entire year would be nice, forever would be even better).

Too Much To ‘Like’

My primary complaint with Facebook is the abundance of mundane things that people can 'Like’ and the resulting notifications that end up in my several news feeds. The promoted stories are especially more intrusive than anything you’ll find on Twitter, and Facebook just allows too much junk into the news feeds in general. The stuff I want to see never seems to be at the top, and the stuff I couldn’t care less about always appears front-and-center.

People I Don’t Want to Friend

Recently, co-workers and others I’d rather not let into my personal life have requested my friendship. I don’t have anything...

Continue reading →

Learning Fundamental CSS Selectors


This past January, I gave a presentation at work on CSS selectors, reviewing the basic CSS selectors and introducing our team to a number of selectors they hadn’t yet used, in order to ensure the everyone had been made aware of CSS’s more powerful selectors

This is an adaptation of that presentation.

This article assumes that you’re already familiar with constructing simple ID (#someId) and class (.someClass) selectors, and covers more advanced selectors that may be created when combining these simple selectors.

Table of Contents

  1. Hierarchical Selectors
    1. Descendant
    2. Child
    3. Adjacent
    4. Sibling
  2. Attribute Selectors
    1. Has Attribute
    2. Attribute Equals
    3. Attribute Contains
    4. Attribute Starts With
    5. Attribute Ends With

Hierarchical Selectors

Hierarchical selectors allow elements to be selected depending on how it is positioned in relation to another element.

Descendant Selector


Continue reading →

Book Review: JavaScript Web Applications by Alex MacCaw

I began developing in JavaScript just over a year ago. The company I’m working for had announced a brand new product that was to be web-based, and with not a single web developer on our team, I took the initiative to completely immerse myself in web application architecture. I started, like many others, with JavaScript: The Good Parts. After devouring that, it was time to understand how large-scale JavaScript applications might be constructed. It was around that time that I discovered JavaScript Web Applications by Alex MacCaw.

The book begins with a primer on the MVC pattern and how it applies to JavaScript, and takes the reader through a pretty easy read on other important topics like events, models, state, client-side templating, dependency management, and other very relevant topics.

What I like most about this book is the author’s willingness to include examples from a variety of...

Continue reading →

Staying Focused While Using The Internet

As software engineer, I use a computer every day. Seven days a week. It’s no secret either that a growing number of careers are requiring workers to use computers as a part of their job. Of course most, if not all, of these computers they’ll be using are internet connected. This means that companies are asking their employees to use the same machine and technology they use to check their facebook, send email, and watch YouTube to perform meaningful work. For serious internet users, this is sometimes easier said than done, especially with my next task unclear.

It’s been said before: everybody procrastinates. Even the people with the most detailed of organizational systems struggle with procrastination, usually for fear of even having to look at that seemingly endless to-do list. Life can get overwhelming, as we all know, but it’s during those times that its most important to remain...

Continue reading →

The Hidden Stress of Procrastination

When I get home after a long day at work, I sometimes find myself frustrated and in a bad mood. Sometimes it’s hard to pinpoint the exact cause of this stress, as your inability to concentrate renders your ability to figure out what’s wrong with yourself useless. Too often when this happens, it continues all night and I end up wasting the entire night sitting online or watching TV.

What about the other days? What is different about them? How do we one day fall prey to frustration and laziness, yet other days get back on track and feel better about ourselves. What if nobody’s around to cheer you up? I’ve spent many a night lying in bed, regretting the hours of the time I just lost, only to repeat my same actions the next day.

I’ve found that very often I feel this way after work when something I wanted to get done that day is not being taken care of. Maybe I needed to stop at the...

Continue reading →