Tag

.net Archives - Falafel Software Blog

On Sitefinity Custom Widget Caching

By | .NET, ASP.NET, C#, MVC, Sitefinity | No Comments

Sitefinity is Caching too Hard! If you’ve done software development for any length of time, you’ve likely run into a caching issue. Caching is difficult to get right, but it is so beneficial that we work with it in nearly everything we do. In the case of Sitefinity, it performs caching all over the place. As a result, many aspects of the Sitefinity experience are greatly improved. If you disabled caching for a Sitefinity site altogether, the site would slow down immensely. Sitefinity, by its nature of being a Content Management System, stores the bulk of its content in the…

Read More

Dynamic Content Detail Widget Templates in Sitefinity

By | .NET, ASP.NET, C#, Sitefinity | No Comments

Getting to Dynamic Content Data in Custom Code Behind In a previous post, I went over how you can easily create a custom code-behind C# class for any Widget Template in Sitefinity. Give that post a quick once-over, as this post builds upon that one. For built-in Sitefinity content items, accessing the data is pretty straightforward (see the previously-linked post): You grab the container, iterate over the items (even in the case of a single detail item), and then work with the data to make customizations to the page. For Dynamic Content Detail Widget templates, however, things work differently. You…

Read More
Google-Cloud-Platform-Authorize-User-Account

Authenticating Your C# Application for the Google Cloud Platform – Part 2

By | Cloud Platform | No Comments

This is post 5 of 17 in the series “Google Cloud for the .NET Developer” Now that we understand how to authenticate a C# application to work with your own project’s GCP resources, let’s take it a step further. In this post, we’ll look at how we can combine that connectivity with end user data, via three-legged OAUTH authorization, to perform operations on user content, with their permission of course. For this example, I’ve created a very simple ASP.NET MVC project that logs a user in, gets their profile image, and uploads it to a specific bucket. Let’s take a…

Read More
Google-Cloud-Platform-Nuget-Pacakges

C# Support for the Google Cloud Platform

By | Cloud Platform | One Comment

This is post 3 of 17 in the series “Google Cloud for the .NET Developer” At the end of the day, like most APIs you encounter in the wild, Google services are exposed as standard REST endpoints. If you know how to create, authenticate, and issue an HTTP request, you have everything you need to add Google’s extensive list of services (including the Google Cloud Platform) to your applications. However, most developers prefer to spend their time focused on the implementation of their application, and would rather skip mucking around with boilerplate code to create raw HTTP requests, serialize requests and…

Read More

Read/Write data from/to USB thumb drive on a Windows IoT Core device

By | .NET, Blogs, C#, Fun, IoT, Microsoft, Multi-Device, News, Raspberry Pi, Visual Studio, Windows Universal Apps | One Comment

Currently, universal apps are sandboxed to the point of blocking you from reading/writing data files to a removable USB drive on Windows IoT Core devices. This post will show you a work around if you really need to do this. Now, understand that this is not for store apps. If you submit an app using this work around, it will likely get rejected. However, for internal projects, it will definitely work, and work well. This is a great way of reading application initialization data and writing log data in a test apparatus and laboratory setting. Particularly when a network or…

Read More

Why Organizations should choose GCP – A Business Perspective

By | Cloud Platform, Google | No Comments

Cloud services reduce the effort needed to manage infrastructure, provision servers and configure networks. Today the cloud market is primarily dominated by Amazon Web Services, followed by Microsoft Azure. As the new kid on the block, GCP is the newest entrant to a highly profitable and competitive landscape. In this blog series, the team will discuss GCP services and implementation differences between GCP, AWS, and Azure. This post explores GCP from a business point of view — what to consider when making an informed decision for your organization.

Read More

C# Windows IoT Core Serial Communications with an ESP8266

By | Blogs, C#, ESP8266, git, Hardware, IoT, Microsoft, Multi-Device, News, Raspberry Pi, Visual Studio, Windows Universal Apps | No Comments

Windows IoT Core is great for connecting single board computers such a Pi2 to an ESP8266, via a serial link. The hardware for such a link can be found in my previous post here. The details for a basic serial communication C# framework are detailed in this post. If you have an ESP8266, there are numerous ways of communicating with them such as LuaLoader. However, I needed to communicate with my ESP8266 through a Pi2 running Windows IoT Core. This is part of a larger automated test project for an upcoming consumer project we’re developing. In this post, I’ll cover…

Read More

Multilingual Publishing in Sitefinity

By | C#, Sitefinity | No Comments

Initially Publish your Content in a Non-Default Language Sitefinity has great multilingual publishing capabilities. From the perspective of an end-user / content manager, the backend offers up a myriad of methods to create content items both in the site’s default language as well as any other languages activated/enabled in the site itself. They’re all usually just one click away, and provide a good experience. But what about the development side of things? Say we have a custom widget that creates a content item, but the language either must be something apart from the default, or is user-selectable before creation occurs?…

Read More

Widget Template Code Customized the Easy Way

By | .NET, ASP.NET, C#, Sitefinity | One Comment

Sitefinity’s Widget Templates provide a quick and easy way to change how Sitefinity renders widgets, both for built-in content types as well as custom ones. In the backend, it’s just a hop, skip, and a jump away to Design > Widget Templates to access a majority of the templates where you can manipulate the HTML used to render them. Oftentimes, though, you have to do more. Let’s say that, when iterating over a list of news items in the “Titles only” template you want to add a CSS class to some of the items, but not others. This goes beyond…

Read More

Using HandleUnknownAction in MVC Widgets

By | .NET, ASP.NET, C#, MVC, Sitefinity | No Comments

Sitefinity’s MVC widgets are fantastic. They allow untold amounts of customization and enable you to create an MVC framework as complex or as simple as you need. There is a caveat to using them, however: Because the controllers are typical ASP.NET MVC controllers, going to particular pages on your site might make them disappear! There is a simple workaround for this problem, and with this information you can ensure that your Sitefinity MVC widgets consistently display no matter what current state your web site is in. The Problem Say you have a simple custom MVC widget that has a single…

Read More

Accessing Sitefinity Roles in Code

By | .NET, C#, Sitefinity | No Comments

When developing custom solutions in your Sitefinity application, you may need the ability to work with Sitefinity roles. As a developer, you would reach out to the RoleManager that Sitefinity provides, and access the roles from there. However, you may run into an issue where some roles, verified to be a part of your site, are not represented when working with the RoleManager. This post goes into this issue, and shows how to access all Sitefinity roles to work with. Basic Role Access Let’s say you want to list all available Sitefinity roles on your web site. The natural idea…

Read More

A Simple Natural Sort

By | .NET, C# | 5 Comments

If you’ve ever had to sort alphanumeric data, you’ve probably encountered the issue of sort order when letters and numbers are mixed. Here is a quick example:

The first set is using a standard ASCII sort which is sorted correctly, but not what most people expect–shouldn’t a2 come BEFORE a11? What they want is a natural sort which treats letters as letters and numbers as numbers rather than treating everything as an individual ASCII character. There are PLENTY of natural sort solutions out there and some may work better for your particular situation, but I came up with a simple natural…

Read More

Working with Hybrid Forms in Sitefinity Widgets

By | .NET, C#, MVC, Sitefinity | No Comments

Throughout the course of web development, you often find yourself in a situation where you need data input from your user. Scenarios range from a simple contact form, to something as complex as a multi-part job application. In either case, Sitefinity offers multiple solutions. The easiest solution, for the simpler forms such as the aforementioned contact form, is to use Sitefinity’s built-in Forms capabilities. Much like with their pages, Sitefinity Forms provide a very simple, powerful way to create and customize even more complex forms for your site. The resulting data is then stored in Sitefinity, and can be set…

Read More

Relating Data in Sitefinity Content

By | .NET, C#, Sitefinity | No Comments

In my previous post discussing properties on custom content, I delved into some of the more complex types that can be properties, including classifications and related media. This post will get into the most complex type to work with: Related Data. This is taking existing custom content types and allowing other content types to have a property that relates one to the other. Relating data can happen with built-in content types (e.g. News), extend across other module builder modules, and even be self-referential! On top of all that, you can even create a custom content type that is the parent…

Read More

Complex Custom Properties for Sitefinity Content

By | .NET, C#, Sitefinity | No Comments

In my previous post I talked about basic access of custom properties in Sitefinity. Namely, strings and numbers. Those alone cover a lot of what you’d use when it comes to custom fields on built-in content types and custom content types. In this post, however, we’re delving into some of the more complex custom properties that can be associated with Sitefinity content. Like in the previous post, we’ll cover both how to query by a complex property (where applicable) and how to fetch the content of the complex property. Classifications (Tags, Categories, Custom) Fetching Tags and Categories within Sitefinity are…

Read More

Valid Polygons and Ring Orientation with SQL Spatial

By | .NET, Entity Framework, SQL Server | No Comments

SQL Server spatial types make it easier to work with geographical data, but it is important to understand ring orientation or “handedness” when working with polygon data. On a recent project, I was building a web-based tool for users to draw a polygon to define an area that would be used for finding points within its bounds. Each click captures the coordinates which is combined into a WKT (Well-Known Text) Polygon. Everything was working great until I drew a polygon that returned this error when I tried saving the DbGeography object: 24205: The specified input does not represent a valid geography instance because it…

Read More

.NET: Shared App Settings

By | .NET, News | No Comments

I recently needed to write a couple of console applications to perform some tasks on an Azure Search Service.  I wanted both of the applications to be in a single .NET solution along with a common class library project for code shared between both console applications.  Easy enough, right?  Along the way I found myself duplicating the Azure Search configuration variables in both console applications.  Since the DRY principle is something I try diligently to practice, I started looking for a way to have shared app settings in the shared/common assembly and then reference them in the individual console applications….

Read More

Running Resource Intensive Jobs Using Azure Batch

By | .NET, Azure, Batch Processing, Microsoft, Visual Studio | No Comments

This is post 29 of 31 in the series “A Cloudy 29 Days of Microsoft Azure” Running Resource Intensive Jobs Using Azure Batch Azure Batch Services provide a framework for resource or computationally expensive jobs. When I say “computationally expensive”, think 3D rendering for Pixar, engineering stress analysis, or calculations for fluid dynamics. The DIY approach starts with “I’ll add a ‘for’ loop and kick off some background executables”. But once you start to scale in any direction, then you’re off to the races building infrastructure to handle generic plumbing needs like… Install apps and dependencies. Dispatch, queue and start…

Read More

Migrating from Mobile Services to Mobile Apps, when you should consider it

By | .NET, Android, Apps for Office, Azure, Microsoft, Mobile, News, node.js, Office365, Visual Studio, Web, Web & Mobile | 4 Comments

This is post 13 of 31 in the series “A Cloudy 29 Days of Microsoft Azure” In this column we are going to discuss the difference between Mobile Apps and Azure Mobile Services,. Azure Mobile Services allows you to add a cloud-hosted scalable backend to your connected apps within minutes. Whether you’re building apps for Windows 8, Windows Phone, iOS or Android you can take advantage of the Azure cloud to streamline your data and provide a robust, reliable and cost-effective platform to support your application. Mobile Services has been around since 2012 when it was in preview, and has seen many version updates and…

Read More

Retrieving Simple Custom Properties from Sitefinity Content Items

By | .NET, C#, Sitefinity | No Comments

Sitefinity offers many extension points to its core content types, as well as letting you create completely customized content types of your own via the Module Builder. You can add custom fields to existing types like News and Events, or add as many fields as you like to custom content types. Working with these custom properties in code can seem a little daunting at first: How do you do it? What data types do you work with? Which methods do you call on your objects? There are several ways of accessing certain kinds of properties, while others you have to…

Read More

What to love and hate about Azure’s DocumentDB

By | Azure, C#, Data & Storage, JavaScript, Microsoft, News | 8 Comments

This is post 4 of 31 in the series “A Cloudy 29 Days of Microsoft Azure” Azure DocumentDB is Microsoft’s fully-managed document-oriented NoSQL database service that is built to work within the Azure Cloud ecosystem much like SQL Azure, SQL Storage, Azure search, etc. DocumentDB is relatively a new player in the NoSQL world (it was released for general availability in April 2015). It comes with an impressive list of features and has gone through several version updates. It also has its limits (the list hasn’t been updated for a while so make sure you read the comments section). In this post we are…

Read More

How to Upload Files to your Sitefinity Document Library Asynchronously

By | .NET, ASP.NET, C#, JavaScript, Sitefinity, Web API | 2 Comments

Sometimes, it is necessary for users of your site to be able to upload files to Document Libraries in an asynchronous manner. They could be creating user-generated content and require a space to upload a file to reference in their content, for instance. Using some JavaScript and an ASP.NET WebAPI controller, we can accomplish this fairly simply. The HTML The first thing we’ll need is an input that allows users to select a file. This’ll be a simple HTML input the “file” type. You can put this HTML (along with the associated JavaScript) anywhere on the page, either via Content…

Read More

Heart Rate Display with a Photon and a Microsoft Band

By | .NET, Blogs, C#, Fun, IoT, Microsoft Band, Mobile, Multi-Device, News, Photon, Visual Studio, Windows Phone | 4 Comments

Those who know me, know I love sensors, and doing things with sensors. I’ve published many posts on accessing the various sensors on the Microsoft Band: Accelerometer & Gyroscope, Ultraviolet, Skin Temperature, and Galvanic Skin Response. One subject that I haven’t gotten to is the heart rate sensor. I’ve also started to publish a few IoT posts. For this post, I thought it would be fun to integrate the Band’s heart rate sensor with a Particle Photon so you can visualize your heart rate with an RGB LED. The LED pulses at the same rate as your heart and will shift…

Read More