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 »

Jingle Bells…

Just so you know… when you’ll notice a Father Christmas sitting on a chair
in the local mall, it might have never crossed your mind that is’t a hard and
dangerous job of many people that leads to these short moments of joy and
happiness that you and your children experience.

Fortunately the Woodpecker Film has taken
the risk and the courage to document the process for you. But beware!
Precautions must be taken…

Posted in Lifestyle
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
| 42 Comments »

My first meaningful EPiServer control… z Biedronki* :)

The challenge – The site that we will be coding will have its pages tagged with episerver categories. Implement a control that will list all the pages tagged with a specific category.
The control aspx code seems looks pretty straightforward and is derivative of some other controls that are defined in the EPiServer sample site:

<%@ Control Language=”C#” AutoEventWireup=”false” CodeFile=”CategoryListing.ascx.cs” Inherits=”development.templates.Units.CategoryListing” TargetSchema=”http://schemas.microsoft.com/intellisense/ie5″ %>

<%@ Register TagPrefix=”EPiServer” Namespace=”EPiServer.WebControls” Assembly=”EPiServer” %>

 

<div id=”rightmenudivStartPage”>                       

    <div class=”listheadingcontainer”>

        <div class=”listheadingleftcorner”></div>

        <a class=”listheading leftfloating” href=”<%=EventRootPage.LinkURL%>“><%= EventRootPage.PageName %></a>

        <div class=”listheadingrightcorner”></div>

    </div>

 

    <EPiServer:PageList runat=”server” ID=”PageList1″>

        <ItemTemplate>

            <div class=”startpagecalendaritem”>

                <span class=”datelistingtext”>

                <episerver:property ID=”Property1″ runat=”server” PropertyName=”PageLink” CssClass=”StartCalendar” />

                <span class=”Normal”><episerver:property ID=”Property3″ runat=”server” PropertyName=”MainIntro” /></span>

            </div>

        </ItemTemplate>

    </EPiServer:PageList>

    <br/><br/>

</div>

The wirst thing you will notice after looking at the code is that PageList is pretty much a standard ASP.NET reinvented and rehashed. GREAT! Sounds like we can use the Data binding, right? That’s also true:

private void Page_Load(object sender, System.EventArgs e)

{

    if (!IsPostBack)

    {

        PageList1.DataSource = CategoryPages;

        DataBind();

    }

}

Does the trick of binding the data to the repeater… uh… oh… sorry… I mean PageList.

Now comes the hard and non-obvious part.

How does one actually find the pages assigned to a category? Short of calling the database directly to query the tblCategorypage table that comes to mind at first, it looks like EPiServer has a really cool page finding module that allows for simple yet fairly effective discovery of pages conforming to some developer defined criteria. Those criteria are defined by means of forming any necessary number of instances of PropertyCriteria class provided as a PropertyCriteriaCollection to Global.EPDataFactory. The result is handed to us back as a PageDataCollection. The fetching of the pages looks like this:

public PageDataCollection GetCategoryPages()

{

    PropertyCriteria criteria = null;

 

    CategoryList categories = ((PropertyCategory)(CurrentPage.Property[“AggregatedCategory”])).Category;

 

    criteria = new PropertyCriteria();

    criteria.Condition = CompareCondition.Equal;

    criteria.Type = PropertyDataType.Category;

    criteria.Value = categories.ToString();

    criteria.Name = “PageCategory”;

    criteria.Required = true;

 

    PropertyCriteriaCollection col = new PropertyCriteriaCollection();

    col.Add(criteria);

 

    PageDataCollection pdc = new PageDataCollection();

    pdc = Global.EPDataFactory.FindPagesWithCriteria(EPiServer.Global.EPConfig.StartPage, col);

 

    return pdc;

}

For this to work though, one has to define some more stuff in the web admin part of the site. the usual task is to define the Page Template for the control. In this case when you define the Page Template make sure to put the “AggregatedCategory” property in that should be of type Category selection. This property defines what categories you want your control to aggregate, and you can provide one or more of those. the other property that is required for this very control is “CategoryContainer” of type Page. This is solely for the purpose of having a master page that you define as the “main page” for the chosen category selection. It serves as a clickable header in the control. Unnecessary maybe but one would have to define a caption for the control anyway so why not make it meaningful.

The usage of the said control is trivial. A sample usage on the default EPiServer site looks like this:

<%@ Page language=”c#” Codebehind=”CategorySummary.aspx.cs” AutoEventWireup=”false” Inherits=”development.Templates.CategorySummary” %>

<%@ Register TagPrefix=”EPiServer” Namespace=”EPiServer.WebControls” Assembly=”EPiServer” %>

<%@ Register TagPrefix=”development” TagName=”CategoryListing”  Src=”~/templates/Units/CategoryListing.ascx”%>

<%@ Register TagPrefix=”development” TagName=”DefaultFramework”    Src=”~/templates/Frameworks/DefaultFramework.ascx”%>

 

<development:DefaultFramework ID=”DefaultFramework” runat=”server”>

    <EPiServer:Content ID=”Content1″ Region=”fullRegion” runat=”server”>

        <development:CategoryListing  ID=”CategoryContent” runat=”server”/>

    </EPiServer:Content>

</development:DefaultFramework>

Out of which really only the <development:CategoryListing  ID=”CategoryContent” runat=”server”/> part is meaningful.

For the record… It looks like THE place to go to solve that kind of dilemas fast is the EpiServer “Developer to Developer” forums.

*)… couldn’t ressist with the title joke :) For those not in subject… It’s a reference to a silly commercial of one of the market chain (Biedronka) in Poland that advertises recently with “My first *something*… from Biedronka*

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 ASP.NET, C#, EPiServer, Internet Information Services
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...
| 21 Comments »

EPiServer fun

EPiServer is an Interesting technology we’ve started working on recently. I will try to blog my impressions and the progress over the course of learning the solution.

Since I just seem unable to learn by reading docs I chose to build an email obfuscating (antispam) control and a paged search as an exercise and a way to learn the guts of the EPiServer.

A couple of loose thoughts for a start…

Translation

I am not sure I fully appreciate the way the translation is performed for the parts of the system that is editor independent . The translation is done by means of xml files stored on the disk in the /lang folder.

Basically what that means is that it’s much more prone to missing translations and thus is not as translation friendly as it could fairly easily be.

For the content I can always fall back to the e.g. english version and look what’s the original value there. not so much for the framework translations. Is there a tool for that? I will investigate that later as we’ll probably want to create a number of controls for the website we’ll be working on soon, and that will need to be translated to many languages. And not just that but also the original template files – we will need much more than what’s available originally in EPiServer.

So once you define your control’s content:

<asp:LinkButton ID=”Obfuscate” runat=”server” CausesValidation=”False” OnClick=”ObfuscateEmail”>

    <episerver:translate Text=”/templates/emailobfuscator/obfuscate runat=”server” ID=”Translate3″ />

</asp:LinkButton>

in which you defined where the translation is to come from. (In this case the path is: “/templates/emailobfuscator/obfuscate”) you need to edito the template framework file and add the translation there with the XPath defined in the control. Which looks along the lines of:

<?xml version=1.0 encoding=utf-8 standalone=yes?>

<languages>

    <language name=English id=EN>

        <templates>

            <emailobfuscator>

                <obfuscate>Obfuscate</obfuscate>

            </emailobfuscator>

            …

        </templates>

        …

    </language>

</languages>

The most annoying part of it though is that it needs to be done for alll the languages if you want the site to be fully translated, which without a tool is not fun.

I will look more into that later. One would expect that a tool like that may exist already.

Technology

I am really looking forward to EPiServer 5.x to be released. It’s to be based on ASP.NET 2.0 which most probably means (I hope)that a number of EPiServer specific technologies will be replaced by a .Net generic technologies. As the ElektroPost notices:

EPiServer Content Framework Is Not Unlike ASP.NET 2.0 Master Pages and Content Pages.

Also the EPiServer seems to be really hard to develop for in VS.Net 2005. I still didn’t Indeed ElektroPost suggests VS 2003 as the development platform, but once switched to 2005 I personally can’t deal with VS 2003 any longer.

The good news though is that it is compatible with .Net 2.0 in a way that you can simply add an ASP 2.0 control and with just slight modifications work with it. You can also use .Net 2.0 partial classes – which means much cleaner code.

Overall the EPiServer is a really positive experience. I’m looking forward to work more with it.

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.

Most of us here use Pandora for the listening to the music with their headphones.

The keyboards we have at the office do not have any sound volume adjusting keys.

It’s mildly annoying that you need to take off your headphones every time someone talks to you or click the system tray every time the musinc is too quiet or too loud. But hey! What do we have CodeProject and Visual Studio for?

Quick investigation on CP allows to determine that there is a way for a DotNet app to both control the system volume and hook the keyboard events fairly easily.

Half an hour later…

We have a little tray application for adjusting the system volume control

The only visual indication of the app running is a tray icon. While it is running you can:

  • Ctrl + Alt + Up Arrow – Volume up
  • Ctrl + Alt + Down Arrow – Volume down
  • Ctrl + Alt + Scroll Lock – Mute / Unmute
  • Click the icon to het a baloon tooltim with those hints
  • Right click the tray icon to close the app.

The icon has been taken from the Dement?con icon pack by MindlessPuppet.

Posted in .Net Framework, C#, Downloadable
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
| 3 Comments »

Linkage

I’ve done some research about Visual studio plugins recently, just so that I can close the tabs and move on here are some links that I cound to contain some useful information:

UpTime.Net

PerformanceCounter pc = new PerformanceCounter(“System”,
    “System Up Time”);

 

//Normally starts with zero. do Next Value always.

pc.NextValue();

TimeSpan ts = TimeSpan.FromSeconds(pc.NextValue());

MessageBox.Show(Environment.MachineName +

    ” has been up for \n\n” +

    (ts.Days < 1 ? “” : ts.Days + ” days, “) +

    (ts.Hours < 1 ? “” : ts.Hours + ” hours, “) +

    (ts.Minutes < 1 ? “” : ts.Minutes + ” minutes “) +

    ” and “ + ts.Seconds + ” seconds.”);

Nice, neat and simple.

Get a compiled executable here

Posted in .Net Framework, C#, Downloadable
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
| 30 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 »