Getting Counts for Twitter Links, Facebook Likes/Shares, and Google (+1) PlusOnes in C# or PHP

June 7, 2011 | .NET, JavaScript, PHP | 81 Comments

I am working on a project where I need to know the number of social shares on Facebook, Twitter, and Google +1 (plusone). Facebook and Twitter make this easy with a simple URL that returns clear JSON data, but Google has not offered an official way to do it yet. However, I found someone who tracked down how to do it using Google’s JSON-RPC API, and I’ve repackaged them together in ASP.NET and PHP for anyone who wants to give it a try. Continue Reading…

bib.ly – ASP.NET MVC Url Shortener for Bible References

April 1, 2011 | .NET, Bible Tools, JavaScript | 60 Comments

Last week, I turned a URL shortening website called bib.ly which is a play on the word “Bible” and the popular URL shortener bit.ly. It has two main functions: A Bible URL shortener and a Bible version popup detector for any website. Continue Reading…

Purple CMS – Now on Github

May 7, 2010 | .NET | 2 Comments

A few months ago, I put out a preview of a ASP.NET 4.0 CMS called “Purple” (named for the official color of Dallas Theological Seminary). 

I’m now pushing updates to Github, so if you’re interested go grab a copy here

http://github.com/johndyer/purple

About Purple

Purple is a CMS that uses .NET’s URL Routing to quickly create a website using normal .NET tools like Masterpages and ASCX controls. It has versioning controls for every page and allows you to edit in page rather than through a backend editing area and stores everything in either XML or SQL for rapid development.

Purple CMS – Super Early Alpha (0.1)

March 3, 2010 | .NET | 4 Comments

A few years ago, I built a CMS for Dallas Theological Seminary that has served us pretty well. It has some features we really wanted, but to get them I had to hack up the ASP.NET 2.0 page life cycle to get it to work. With ASP.NET 4.0, a lot of what I did is much easier and can be done “normally” instead of with things that felt like hacks. 

Project Requirements

Different projects require different kinds of CMS packages, but here were my requirements:

  • Extensionless URLs (no .aspx on the end of URLs) – this was harder in ASP.NET 2.0, but in ASP.NET 4.0 especially on IIS7 this is much easier.
  • Normal Masterpages – I don’t want a special, proprietary template engine. I just want to use normal ASP.NET features so that people can work on the site without learning an new language and use Visual Studio if they want.
  • WebForms and *.ascx Controls – I love using MVC on certain projects, but for a site with lots of pages (DTS has around 1000 pages), I need to be able to use simple *.ascx controls. We have lots of pages with various repeaters and forms to fill out and using MVC controllers for each it too much to maintain. Personally I like <script runat=”server”> rather than codebehind or codebeside so we can keep a site agile.
  • Not require <form runat=”server”> – A lot of pages with plain HTML or just a <asp:repeater> don’t need viewstate, so there is no need to have ASP.NET form on every page. The CMS is smart enough to wrap content in <form runat=”server”> if needed, but not otherwise.
  • No takeover – The CMS can’t take over the entire site and not allow other normal ASP.NET functionality like pages (*.aspx) and handlers (*.ashx).
  • In page editing – This isn’t really a requirement, but I like being able to edit a page in place rather than have to go to a separate admin area. 

    Click “edit” and then you go to:

  • Page versioning – Of course we need to be able to rollback to a previous version. Nothing too complex, just a list of revisions with dates.
  • XML or SQL – A nice CMS shouldn’t have to use SQL for a 10 pages site. For now, XML is the default.
  • Permissions – We don’t need a complex workflow, but we need to be able to specify a role for super admin and a role for users who can be assigned edit access to special pages. It needs to work with ASP.NET Membership and Roles.
  • Redirects – A small feature, but we use a lot of vanity URLs in print advertisements that need to go somewhere else (www.dts.edu/thm -> www.dts.edu/admissions/degrees/thm)
  • Complex URL handling – I also want to be able to create a page that has wildcard handling for all sub pages. For example, I want a page that lists a faculty (www.dts.edu/about/faculty) but can also handle and sub pages and show an individual faculty member (www.dts.edu/about/faculty/dbock). This also allows things like blogs or forums if someone wanted to make those.

Download Purple CMS 0.1

I’ve put up a very rough demo you can try out. The permissions, redirects, and “complex URL handling” are not yet finished in this build, but the main ability to use masterpages, controls, and edit pages with HTML is in the demo. It looks just like the default ASP.NET site and allows you to login and edit pages.

To use it, you’ll need Visual Studio .NET 2010 RC and .NET 4.0 RC. Just unzip the file, run the solution, and hit “Debug” or point your local IIS to the website folder and select “ASP.NET 4.0” it’s Application Pool.

Let me know what you think.

HTML5 (XHTML5) Validation Schema and Intellisense for Visual Studio 2008

July 21, 2009 | .NET | 18 Comments

I’ve been playing around with HTML5 (nice intro at Smashing Magazine) for a side project, and I wanted Visual Studio 2008 to stop telling me the new elements were not valid. So I created a new Validation Schema for Visual Studio 2008 that implements much of the HTML5 spec. I found some hints on how to do this in Visual Studio 2005 and went from there. Here’s a pic of it in action giving you the attributes of of the new <source> tag under a new <video> tag:

Readme.txt

  • There is a lot of confusion about HTML, XHTML, and mime-types. I’ve chose to go with a stricter XML-like syntax of closed tags and quoted attributes, rather than the looser HTML, so I called it “XHTML 5” although that doesn’t really make it offically XHTML 5 until you do the rest of the research, work, and fun.
  • This is not a 100% perfect implementation. There are bound to be different interpretations of what’s “correct” HTML5 and you have until 2022 to get it right, so please don’t worry about it too much.

What’s Finished

  • All the new elements in HTML5 have been added in the follow groupings
    • structure: article, aside, footer, header, nav, section
    • media: audio, video, source
    • other: bb, canvas, command, datagrid, datalist, details, dialog, eventsource, figure, hgroup, keygen, mark, menu, meter, output, progress, time
  • When new elements have custom attributes (such as height and width for video, I’ve tried to add those)
  • I’ve also changed a few things like not requiring the type attribute on script blocks and allowing meta tags to have a charset attribute
  • I’ve begun adding HTML5 events (ondrag, onplay, etc.) but have not completed all of them
  • I am not sure how to add HTML5 style data- attributes, so those won’t validate yet.

How to Use it

  1. Download XHTML Validation Schema for Visual Studio 2008
  2. Save it to C:\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\schemas\html\
  3. Add the following to the Registry:
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Packages\{1B437D20-F8FE-11D2-A6AE-00104BCC7269}\Schemas\Schema 23]
    “Friendly Name”=”XHTML 5”
    “URI”=”http://schemas.microsoft.com/intellisense/xhtml5
    “File”=”html\\xhtml5.xsd”

    Note that you might need to change “Schema 23” to something else if you already have other non-default schemas installed. You just need to use the next available number in the list.

I hope you find it helpful. Please let me know if you end up using it and feel free to suggest updates or corrections.

Hi, I'm John Dyer. In my day job, I build websites and create online seminary software for a seminary in Dallas. I also like to release open source tools including a pretty popular HTML5 video player and build tools that help people find best bible commentaries and do bible study. And just for fun, I also wrote a book on the theology of technology and media.

Fork me on GitHub

Social Widgets powered by AB-WebLog.com.