Google Map Control and why EPiServer is so cool!

I’ve recently had a chance to write a Google Maps control for EPiServer, it’s still somewhat buggy and I’m still considering how to release it since it still contains some java script that is potentially GPL infected and I would not like to contaminate someone’s code with it. I may end up rewriting it to some extent or make it more server side so that it’s completely ASP based.

Anyway…

We’ve started working on the rewrite of our site internally in a few CMS’es basically creating an internal competition on which of the engines/teams can do the best the easiest and the fastest site. I can say honestly, EPiServer has been a blast! Virtually any control we’ve decided to place there was almost completely effortless. The controls that are delivered (with sample usage on the demo site) just seem to cover everything. Well, almost everything. There is no map creation component as far as I can tell.

I’ve been wanting to write this control for quite a while and since I deployed a wiki for my family and started filling it in. I had a really nice experience with this Google Map extension to the MediaWiki. I wanted us to have the same on our site. And in the mean time we’ve started running into some limitations that required us to write some plugins for the editor’s site of the CMS. Striking two birds with one stone, here comes the Google Maps for EpiServer.

Anyone familiar with EpiServer knows that the CMS allows you to define the content on any given page through a set of properties defined for its page type. There is a handful of those, and each of them comes with a specific editor. Some of them even come with so called DOPE (Dynamic-on-page-editing). This feature is really so cool that by itself it’s probably one of the driving selling factor. I wanted it all!

To deliver it you need to inherit a property, (in my case I decided to go with a LongString as I can easily go over the 255 char limit if the user woudl decide to have more than a couple of flagpoints on his/her map) and define its editors.

I’ve found out that the property can be easily integrated with the CMS (virtually without any user intervention) by means of attributes/reflection. So here we go:

namespace Cognifide.EPiServerControls.GoogleMaps

{

  [global::EPiServer.PlugIn.PageDefinitionTypePlugIn(

    DisplayName = “GoogleMapData”, Description = “Google Map”)]

  public class GoogleMapProperty : EPiServer.Core.PropertyLongString

  {

   …

  }

}

Yay! one line of code and my class is a property and will show up in the system as one of the available data formats. Now how cool is that!?

The cool part of it is that now as it’s a property, it’s even easier to integrate it with the page.

<%@ Page language=”c#” Codebehind=”GoogleMapsPage.aspx.cs”

    AutoEventWireup=”True”

    Inherits=”development.Templates.GoogleMapsPage”

    MasterPageFile=”~/templates/MasterPages/MasterPage.master” %>

 

<%@ Register TagPrefix=”EPiServer”

    Namespace=”EPiServer.WebControls” Assembly=”EPiServer” %>

 

<asp:ContentContentPlaceHolderID=”MainRegion” runat=”server”>

  <EPiServer:Property ID=”MyGoogleMap” runat=”server”

  PropertyName=”GoogleMapData” />

</asp:Content>

That’s it! The CodeFile is practically empty, except for the autogenerated part. The property instance knows by itself that is should pull the data from the page property defined in “PropertyName”!

The control supports all 3 modes:

View Mode – obviously:

Google Map View

Edit mode – can’t do without it:

Google Map View

I initially planned to put the dope-like editing there but for some reason EPiServer scripts kept interfering with the JavaScript defined for the control. Didn’t give it too much thought though what I really wanted to work good is…

DOPE mode – this is probably the coolest thing in the whole deal:

Google Map View

The only problem I still have with the last mode is that most of the code for the DOPE mode I have is a modified version of what comes originally from the MediaWiki Google Map extension. Since JavaScript is not my core competence, I’ve only modified it to the extent that was needed for the code to work and therefore before save, you need to copy the dynamically generated code that’s just below the editing controls and into the edit box. Lame, I know. But I don’t really fancy learning Java Script further right now and it was not the point of this exercise. Perhaps if the control is released someone will be kind enough to fix and extend it so that it’s more streamlined.

Cognifide
The article is based on the knowledge I’ve gathered and work I’ve performed for Cognifide. Cognifide is an official partner EPiServer and the real contributor of the the control.

Posted in .Net Framework, ASP.NET, C#, EPiServer, Web applications
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
| 24 Comments »

Microsoft loves programmers

I’ve just read a blog about a few new additions to C# 3.0 and in the context of what we’ve already learned about the whole “Orcas” project that is the simplest conclusion.

Microsoft .Net Framework designers and coders are just a bunch of programmers who you can clearly see enjoy hat they do. I can’t stress enough how many times I’ve been annoyed to be forced to wrap some private variables in the obvious public properties. No longer!

Instantiating a class followed by a bunch of setting of properties? Now done in one line. Shweet.

One may argue that C# is a set of such syntactic sugar. But then again, I am sure that’s why so many programmers really like it. Even some of the most Java oriented programmers (Yes Albert I’m looking at you!) in our company are looking forward to work on .Net.

It is the general perception here that, comparing to Eclipse, Visual Studio is a weak IDE in terms of pure code-writing-helpers, refactoring, and discovery of code dependencies. Only the next version will even be able to target more than 1 .net framework version… Please fix that crap… But the language designers are continually doing a great job.

Have a read on some:

Microsoft ,may be the most annoying company in any other context, though you can’t help but to feel that sweet and sticky loving goo leftover on your cursor avery time you flip a page….

The Wiki Family

Writing user documents for our company, I ‘ve been using our corporate wiki a lot recently.

Confluence is incredible. I can honestly say I’ve not been impressed by a piece of software to that degree for quite a while.

I really like how it provides me with the possibility for creating small pages like “format specifications” and “installation info” which I can then assemble into e.g. “User’s manual” simple and seamless:

{include:InstallGuide}
{include:CommandLineInterface}

It’s so neat, it’s actually a pleasure to work with it. Need a document to provide to your customer? No problem – it will create a PDF file from that page so that the customer can even print it out conveniently. Bliss…

So I’ve decided that I want to get a wiki for myself. I want to create a wiki with some of my code sippets for the everyday use, some small text handling utility classes, simple solutions, with some coding standards for myself to use, and for my family… to be able to share the family annual stuff like birthdays or important dates, phones, addresses, some basic photos, some experiences and some simple facts, like which pizzerias we consider good, where do we plan to perform our next family meeting and so on and so forth. Accessible for all of us online.

The hosting provider however does not allow me for shell access and java, so Confluence is out of the question (it has a free private license for 2 users which would otherwise be just fine).

I’ve asked around and it looked like mediaWiki might be the answer, so our MediaWiki seems to be up and running. I am not sure though if it’s just me being a noob, but the administering of it seems to be a major pain in the rare. Need permissions changed? Edit php. Add new user without enabling public access to the wiki? looks like you’re facing the the grief of dealing with myPHPAdmin.

And the editing support is almost as good as notepad… *sigh*. There is no way my dad is going to use it in its current state. We’re definitely in need of some nicer theme for it that won’t leave him running form it, screaming. Perhaps I can equip it with some plugins as well to make it bareable?

Short of that, I think I’m still in the market for another wiki engine.

[update]
I’ve also setup TikiWiki for testing, although it seems a bit overwhelming for a casual user. I’ll see about customizing it for the family.

I’ll also be looking at Twiki in the following days.

I’m sure soon enough the kids or at least Martuska will want to have access to it. Boy, would it be nice to have a global family wikipedia, or what!?

There seems to be a plethorea of them to the degree that there are sites and huge matrices comparing them point by point.

Wikipedia comparison
WikiMatrix comparing some of the wikis I’m considering

[update 27-01-2007]
I think I’ll settle with media wiki after all. It’s really tedious to administer, but I can handle it. While tiki seems a bit too complicated and I think the family could have had troubles using it.

Posted in Lifestyle, Rants, Software, Web applications
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
| 60 Comments »

Skype GeoLocation Tool

Download source files – 103 Kb
Download the Skype Geo Location tool – 52 Kb

Application GUI

Introduction

It’s a real joy to work in a international company, the problem we face are hardly ever matched by some locally based endeavours…

As some of our friends here at work, you may choose to reveal your current location to your skype buddies. This is nice and easy since you can just put it in your name or description and everyone will see where you are.This poses a problem should you really travel frequently, it is more likely than not, that your location tag will be out of sync.

As this is a something that happens for them once in a while I found it an interesting concept, fun enough to be worth solving it :)

So how does one establish his location? Short of installing a GPS on your machine, I would suggest checking your IP address and translating it based on one of the available databases.

The thought process goes as follows… [Read about the technical guts of the application in my article at Code Project]

The Convergence – The Application

The application helps you maintain your location tag in your name so that whenever you travel to a different town your skype name/description will reflect it.

Disclaimer: The application uses GeoIPTool as its source of IP and geo-location. Visit GeoIPTool for a wide variety of web based geo-location tools.

It does not contain either any kind of tracking abilities other than it letting you to maintain your location tag. The application will not even change your location tag by itself but rather it will notify you that your location has changed and will allow you to change your tag with a simple press of a button.

Usage
In your skype account set your name or description so that it has [] in it or press “Add location tab to…” in the application. Whenever the application will find those it will check if the text in the parenthesis matches your current location., if it does not it will suggest a new one and will highlight the relevant field red. You may set for this operation to be performed on every boot, you will however only be notified when/if your location actually changed.

Posted in .Net Framework, C#, Downloadable, Lifestyle, Software, Software Development, Web applications
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...
| 102 Comments »

How to get Website Thumbnail in C#

[Edit: I’ve posted it on CodeProject and there are some greatl people commenting on it that did the investigation on ho to wrap it in a STA Thread and make it a part of your ASP.Net solution – really cool stuff!]

An interesting use case. Darek (our beloved sys admin – we all bow to him and worship his skills) has recently asked if it?s possible to write a .net application to make a thumbnail of a website. Which is pretty trivial with Windows forms actually.

All you really need to do is drop a WebBrowser on your form and once it?s loaded the page call:

webBrowser.DrawToBitmap(bitmap, bitmapRect);

When it gets tricky is when you want to do it in a console application is a way that can take a shot of multitude of websites provided in a batch file. There is a dirty way of instantiating a whole form, making it show (or not), doing the work and then exiting the Winforms app. Which might probably be enough for a quick solution, but I wanted to publish this piece of code, so I would actually NOT take a pride in something like that.

How is it done the proper way then? Read the rest of this article »

Posted in .Net Framework, C#, Downloadable, Software Development, Web applications
1 Star2 Stars3 Stars4 Stars5 Stars (7 votes, average: 4.29 out of 5)
Loading...
| 150 Comments »

New week, new toy

I’ve just found this cool app that allows you to post to blogs, including our own one.

http://windowslivewriter.spaces.live.com/

go ahead and try it! I’m writing this article in it! As cool as WordPress is, it’s writing editor sucks. I don’t tend to write often, but when I start, my articles usually take more than a page and if in the process I accidentally press the shortcut for the browser go-back… I’m crying! I also wonder if you’ve ran into the 1000 miles long line bug in the WordPress editor? It seems to sometimes make all spaces in the line non breakable, there is a solution to this, which is to press enter and then go back to the line again and delete and re-insert all the spaces again… which makes me cry some more! I am also just not a big fan of Web interfaces for something so interactive as creating documents or calculations (hint, hint Google). I think Web is more suited for presentation whereas desktop is for creation.

It has a spell checker and all the cool stuff the app that I’m writing has, and it’s free. It’s in beta but seems to work pretty well so far.

As a side note… It’s written in .Net, which is soooo… expected (but nice).

ok so if you want to use it in our blog use this:

http://blogs.cognifide.com/adam/xmlrpc.php

as your blog URL, naturally, replace adam with your blog name, fill in the user name and password and enjoy!

Last final test – let’s see how does it deal with images from disk…


(c) Mother Goose and Grimm by MIKE PETERS

Posted in Blogging, Lifestyle, Software, Web applications
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
| 123 Comments »

Is everything going to web based?

Yeah… Mr. Obvious, am I not?

Check out this web Word processor. Neat toy… not sure why would I use it but still…

http://www.writely.com/

One of the gazillion Google web apps.

Let me remain sceptic – editing belongs to desktop if you asked me.

Posted in Blogging, Software, Web applications
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
| 6 Comments »

Put your Blog Navigator on a stick!

On how to make Blog Navigator store it’s data on a USB dongle or wherever you want it to be.

Originally posted on Wincustomize.com

I’ve seen some requests recently to make Blog Navigator run from a flash dongle or any mobile drives in our newsgroups lately. I was not quite comfortable with the inability to change the storage path by the user myself for a while, not to say that the data is stored in a wrong place, on the contrary, this default behavior does not change. But to make it confined to a Local Application Data folder was a bit too harsh. for my taste.

So, for Blog Navigator 1.2, I went ahead and made it totally customizable for the user to define where does he/she want to store the files. Currently there are 3 definable folders in Blog Navigator:

  • <repositoryFolder> is the place that Blog Navigator stores its repository to it’s the file that contains all the knowledge and articles stored in your Blog Navigator
  • <keepSafeFolder> is the folder that will be the default folder for keepsafed articles, unless the user defines differently globally in the Blog Navigator preferences or locally for a particular folder, and finally
  • <temporaryFolder> this is pretty much where all the dynamically generated stuff goes, it’s the Blog Navigator working folder.

Read the rest of this article »

Posted in Blog Navigator, Blogging, Web applications
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
| 18 Comments »

Collect, Manage, and utilize the knowledge you’ve acquired with ease and grace.

Originally posted on Wincustomize.com

What we really intend to make for you with Blog Navigator is to create a robust and efficient way to manage all your on-line knowledge. You know how hard it is to actually find something useful on the Internet at times, right? That’s where our “Web Search Folders” come to help. You could already organize your knowledge into baskets, but we’ve decided that it’s not enough. While baskets were a great way of organizing your findings and keeping them for later reference, there were a couple of deficiencies of baskets.

To address that we’ve added two things to 1.2 version of Blog Navigator:

  • you can easily put one basket into one another to make your knowledge more hierarchically organized, just like you can organize your Internet Explorer favorites.
  • you can manage Internet Explorer favorites within Blog Navigator! (Firefox users, consult the final paragraph to learn how to import your bookmarks into Blog Navigator).

Read the rest of this article »

Posted in Blog Navigator, Blogging, Web applications
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
| 3 Comments »

Did you know that…

A few of Blog Navigator tips

Originally posted on joeuser.com

I really find the “Did you know that…” dialogs showing when an application is running quite hilarious.

They provide no solution or enrichment whatsoever, because some random tip at the program startup is highly unlikely to help me with the task I am about to perform with the software. It also is completely stripped off wider context and random as it is, serves exclusively as an annoyance and the first thing user has to turn off in the application.

That said, user still may find some tips and tricks usefully, if provided in a proper form and time. So here are some of them to read at a time of your convenience…

Did you know that….         ;)

Read the rest of this article »

Posted in Blog Navigator, Blogging, Web applications
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
| 60 Comments »