Monthly Archives

September 2012

Windows 8 Unleashed – Mountain View

By | News | No Comments

John Waters is at it again. The Falafel Software President and CTO has been spreading the Windows 8 love all over the country. This Saturday you can catch him teaching the Windows 8 Unleashed event at the Hacker Dojo in Mountain View, California. Windows 8 Unleashed is a free event and a great opportunity for experienced .NET developers and novices alike. You’ll listen. You’ll learn. You’ll build….and you might even win some money in the hack-a-thon. To learn more and register, visit : http://win8unleasheddojo.eventbrite.com/

Read More

Integrating ASP.NET MVC 4 into Existing Web Forms Applications

By | ASP.NET, MVC | No Comments

So you have seen the light and ready to make the jump into ASP.NET MVC. But wait! You are not ready to migrate a million lines of code from your legacy Web Forms application? No problem. You can easily integrate MVC 4 into your existing Web Forms application and gradually phase out the legacy stuff over time. There are many articles and blog posts about this topic. However, most are outdated or take the loooong way. I have a simple, clean solution for you! Here it goes: Upgrade your Web Forms application to .NET 4 (and Visual Studio 2012 if…

Read More

Sitefinity ShadowNav Widget Updated

By | Uncategorized | No Comments

Falafel’s popular Sitefinity ShadowNav Widget has been updated with a few new features and enhancements.   Internationalization Support. If a user with comes to your site and has a matching language code for a page in your ShadowNav, the menu will display in that language. If all your pages are not translated then there’s a possibility to get mixed languages in the ShadowNav.   Here is a sample of how it works and looks.   Pages in the system and their translations Note that the default language is English and some pages have been translated into Spanish.   This is…

Read More

Ajax.BeginForm with MVC 4

By | ASP.NET, JavaScript, MVC, Web | 3 Comments

Using Ajax.BeginForm in your MVC View gives you an easy way of doing a partial postback via an AJAX call.  In its simplest form, our view would look something like this:

The BeginForm method has several overloads which allow you to pass in the name of the Action, Controller, and many other options.  See the full list of overloads here. The AjaxOptions object that gets passed into BeginForm gives us some additional properties we can set.  Here is another example that will POST the form to our api/Person Controller and when the request is complete, it will call the…

Read More

Adding Your Own Scripts and Style Sheets to MVC 4 Bundles

By | JavaScript, MVC, Telerik | One Comment

MVC 4 bundles and minifies scripts and style sheets for best performance.  This clean framework has some great selling points: Automatically uses minified versions when you’re running in production but leaves everything uncompressed and easily readable when you’re debugging. Reduces the markup needed to declare JavaScript and style files. Yet you can still control the order that files load in. Allows bundling by using wild cards and variables. This allows you to load all the “Kendo” JavaScript files, for example. A new MVC 4 app will bundle scripts and styles for jQuery, Knockout and Modernizr automatically, but you can create…

Read More

Building JavaScript Apps using Modular and MVC Patterns

By | Uncategorized | One Comment

In this post, I would like to open your eyes to a new way of developing JavaScript applications. We will be building modular JavaScript code on an MVC architecture while also handling dependencies. With these techniques, you can join a new era of web development and stop coding like it’s 1999! Asynchronous Module Definition (AMD) First, let us get some terminology out the way. The Asynchronous Module Definition, or AMD, is a mechanism for defining modules such that the module and its dependencies can be asynchronously loaded. In other words, JavaScript files and units of code can be loaded via…

Read More

iOS Development for .NET Developers: Using Blocks like Anonymous Delegates

By | .NET | No Comments

Learning a new programming language is a lot of fun, but it can be disorienting to not have all of your usual tools in your mental toolbox, so to speak.  We get used to using our familiar patterns and syntax, and even though the new language may be just as capable, it takes some getting used to in order to have the same level of productivity.  It’s been over a year since I started working on iOS apps in Objective C, and still I sometimes find myself searching for ways to write a block of code that I could write…

Read More

JSONP Simplified

By | Uncategorized | No Comments

JSONP is used to get data from remote web locations without running afoul of web browser security restrictions. Browsers prevent access to methods and properties from other domains, with one exception: the <script> tag.  The <script> tag is allowed to reference JavaScript from anywhere. For example, your browser will have no trouble with this script reference, no matter what domain the page is running: <script src=”//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js”></script> Servers take advantage of this fact by returning JSON data wrapped in a JavaScript function. The link below asks flickr.com for some images in JSON format. Notice the last query parameter “&jsoncallback=flickrCallback”.  The “jsoncallback”…

Read More

Relative paths in MVC Razor

By | MVC | One Comment

Did you know in Razor markup you can do this: <img src=”~/Images/downarrow.gif” /> <a href=”~/somehwere”>Link</a> And it will get auto-resolved on render, such as: <img src=”/MyApp/Images/downarrow.gif” /> <a href=”/MyApp/somehwere”>Link</a> Another welcomed gem in MVC 4 🙂

Read More

How to Obtain the Provider Connection String From an Entity Connection String

By | Uncategorized | No Comments

This technique might come in useful if you find yourself in a situation where you want to be able to execute untyped queries against the DB but don’t want to have to maintain two connection strings. Parse the Provider Name and Connection String Put this code into your partial ObjectContext class: EntityConnectionStringBuilder _builder;private EntityConnectionStringBuilder EntityConnStrBuilder{ get { if (_builder == null) { _builder = new EntityConnectionStringBuilder(Connection.ConnectionString); if (!String.IsNullOrWhiteSpace(_builder.Name)) _builder = new EntityConnectionStringBuilder( ConfigurationManager.ConnectionStrings[_builder.Name].ConnectionString); } return _builder; }} public string ProviderName{ get { return EntityConnStrBuilder.Provider; }} public string ProviderConnectionString{ get { return EntityConnStrBuilder.ProviderConnectionString; }} In a nutshell, this code uses ConnectionStringBuilders…

Read More

How to Restore a SQL Server 2008 Backup to SQL Server 2005

By | Uncategorized | No Comments

In this article, I’m going to walk through the steps necessary to migrate a SQL Server 2008 DB to a server running SQL Server 2005 using only free tools or tools that come with SQL Server. The short description of the process is: Generate a script on SQL Server 2008, then run it on SQL Server 2005. However, there are a few potential pitfalls, and I’m going to show you what they are and how to circumvent them. Generate Scripts on SQL Server 2008 Connect to the SQL Server 2008 server with Object Explorer. Locate the database and right-click on…

Read More

Minify your JavaScript and CSS

By | MVC, Web | No Comments

When building a full-featured MVC web site (or any web site), it is likely that you will have lots of JavaScript and CSS resources.  In addition, when you are using 3rd-party libraries, you can often get “minified” versions of the files, but you may end up with a handful or even dozens of separate js files.  It is important to reduce the load times of these files as much as possible.  There are a few concepts that help speed up page loads: Minify files: remove unnecessary spaces and line breaks so the file size is as small as possible. Combine…

Read More