May 1004

Sorting emails (Advanced?) in Outlook

This is a really simple but very useful productivity tip for Outlook.

I like to use my email list in Outlook as a to-do list of sorts; emails come in all the time and once or twice a day I’ll look through them. I used to be ‘addicted’ to email, I’d have Outlook open all the time on 1 screen or I’d have the system tray icon pop up when new mail arrived, then I’d stop what I was doing to read the email. At work we get quite a lot of emails, meeting requests and background noise so this was very quickly becoming quite a time sink for me.

Now, as I said, I’ll check through a couple of times a day (usually when I’ve finished coding something and just want a quick break), my goal is to keep my inbox (and other folders) empty so if I like to scan down my emails and delete / archive as many as I can. My preferred ‘view’ is Unread Mail and I have that sorted by folder, so all emails from a given sender are grouped together. The problem I have been having with that is the emails are then sorted with the newest at the top of the group. It is really handy seeing all my emails and rss grouped together but the newest on top is the wrong way round for me. Unfortunately when I’ve tried to change the sort order and say:
Sort by – Folder, then by Received Outlook does a double sort and my emails are jumbled together.

My tip is to hold down the Shift button when clicking the header. So for me to get my emails sorted by Folder and then within the folder to have the oldest emails at the top (so I can process them in order) I click on the Folder header, hold down the Shift key and then click the Received header two times, the first activates that column (but with the wrong sort order), clicking it again sorts it ascending order. I’m now a happy (and marginally more efficient) developer!

Update 05/05/10

Ok, seems that my tip has a flaw. The sort works a treat but if you change your view in Outlook to another folder and then return expecting the custom sort to still be there… you’ll be disappointed. I’m not sure why but Outlook doesn’t seem to remember the sort properly, it ends up jumbling up the sort. I’m not sure if this is just an Office 2010 (beta) issue or more widespread at the moment.

Spread/Promote this post

If you enjoyed this article, consider bookmarking or helping me promote it! Thanks.

  • Del.icio.us
  • Digg It!
  • Technorati
  • BlinkList
  • DZone It!
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon

Don't miss another post

Subscribe to SJM Dev's RSS Feed to stay updated with our latest articles!

Permalink | Comments (0)

April 1020

Conditional logic in an ASP.NET Repeater

The premise for this is quite straightforward, I’m using an ASP.NET Repeater control to display the results of a query – one row per item. As an example I’m going to display a list of students and a Checkbox IFF the data allows. To do that I need to create a function in the code behind and then pass my arguments to it from within my repeater.

Unfortunately Repeater controls do not allow you to embed <% if … %> statements, otherwise I could do something like this:

<ItemTemplate>
    <tr>
        <td class="contactNoCol"><%#Eval("ContactNo")%></td>
        <td><%#Eval("FullName")%></td>
        <% If String.IsNullOrEmpty(Eval("SelectText")) Then%>
        <td class="chkColumn"><%#Eval("SelectText")%></td>
        <% Else%>
        <td class="chkColumn"><asp:CheckBox ID="chk" runat="server" /></td>
        <% End If %>
    </tr>
</ItemTemplate>

Using this approach will result in an error: “Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.” Annoyingly it isn’t valid to use this kind of logic in the repeater, despite the fact that Visual Studio helped me write it by providing me with intellisense.

To get around that I moved the logic to a function in the code behind. This has a few advantages, the logic can be a lot more complicated and it keeps the aspx file a bit cleaner / free from the logic. This is how I’m doing it now:

<ItemTemplate>                    
    <tr>
        <td class="contactNoCol"><%#Eval("ContactNo")%></td>
        <td><%#Eval("FullName")%></td>
        <td class="chkColumn">
            <asp:CheckBox ID="chk" runat="server" Visible='<%# ShouldShowIf(False, Eval("SelectText")) %>' />
            <asp:Literal ID="ltSelectText" runat="server" Text='<%#Eval("SelectText")%>' 
                Visible='<%# ShouldShowIf(True, Eval("SelectText")) %>' /></td>
    </tr>
</ItemTemplate>

The function ShouldShowIf is declared in the code behind for this page:

Public Shared Function ShouldShowIf(ByVal returnBool As Boolean, ByVal value As String) As String
    Return If(value.Length > 0, returnBool, Not returnBool)
End Function

ShouldShowIf takes 2 arguments, the value to evaluate and the flavour of the Boolean to return. I needed to allow the calling code to determine whether it should return True or False because the checkbox should be shown if the SelectText is empty otherwise it should display the SelectText value.

I’ve used this approach before, but forgot about it – so I’m posting it up in the hopes that it helps someone else, if nothing else it will serve to remind me how to do this in future.

Spread/Promote this post

If you enjoyed this article, consider bookmarking or helping me promote it! Thanks.

  • Del.icio.us
  • Digg It!
  • Technorati
  • BlinkList
  • DZone It!
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon

Don't miss another post

Subscribe to SJM Dev's RSS Feed to stay updated with our latest articles!

Permalink | Comments (5)

August 0904

Moving Subversion repositories

We have just got a new (virtual) server at work to use as a continuous integration server which I plan to also use as a source control / subversion server. This means I need to move all existing repositories from their current server to the new one. What I didn’t want to happen was to need to delete and recreate all working copies in order to use the new repositories.

All my searching seemed to point to a command line approach; creating a dump of the repository on the old server, loading that dump on the new server and then using svn switch –relocate oldurl newurl (or the switch command from TortoiseSVN)- I tried this but kept getting an error saying:

https://oldserver:8443/svn/MyRepository
is not the same as
https://newserver:8443/svn/MyRepository

So I did a bit more googling around the ‘is not the same repository’ error, checked to make sure that the new repository was using the same uuid as the old one, which it was (use svnlook uuid path/to/repository). Then, just as I was about to give up for the night and go home I found the answer and it was much easier than anything I’d tried before.

Moving repositories between servers

First you need to move the repository to the new server. I am using VisualSVN Server which makes this very easy; right click on the Repositories root node then go to All Tasks then Import Existing Repositoryimport

This brings up a dialogue for you to browse to the original repository. browse-for-svn

When you do this it copies the entire repository over (complete with its uuid) and includes all history, every commit and the ability to roll back to any previous version!

Update clients and working copies

Next you need to update your working copies; right click on the WC, go to TortoiseSVN menu select Relocate and simply enter your new repository address.
relocate

This updates all references in your WC to the new repository and from that point on you will be updating from and committing to the new repository.

Easy eh! Now I’ve just got to move another 30 or so repositories and I can turn off the old repository server.

Spread/Promote this post

If you enjoyed this article, consider bookmarking or helping me promote it! Thanks.

  • Del.icio.us
  • Digg It!
  • Technorati
  • BlinkList
  • DZone It!
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon

Don't miss another post

Subscribe to SJM Dev's RSS Feed to stay updated with our latest articles!

Permalink | Comments (0)

June 0923

Recover disk space after Vista SP2 install

I just found out about a (greatly under publicised) tool that shipped with Vista SP2, looking around it seems there was also something similar for SP1 called the Vista SP1 File Removal Tool.

Anyways the tool is called compcln.exe and running it from a command prompt recovers your free disk space by removing SP1 backup files that were not removed by the SP2 setup. The price you pay is not being able to remove the Service Pack.

I was able to recover almost 1GB of free disk space after doing this.

Spread/Promote this post

If you enjoyed this article, consider bookmarking or helping me promote it! Thanks.

  • Del.icio.us
  • Digg It!
  • Technorati
  • BlinkList
  • DZone It!
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon

Don't miss another post

Subscribe to SJM Dev's RSS Feed to stay updated with our latest articles!

Permalink | Comments (1)

March 0902

cfmail and white space problem

Ok I don’t often have to deal with ColdFusion, but at work there are still a few legacy websites using it and every so often I have to make some updates / changes (at least until we’ve finished migrating things over to .Net, and Sitefinity). However this morning I needed to make a change one of the forms so as well as saving details to the database, it also emails the results to someone.

One of the nice things about Coldfusion is that it is pretty easy to use, there are quite a few handy tags to use and cfmail is one of those, set a few properties on the attributes (such as who the mail is from, who its going to and the subject) the content for the mail message is simply everything between the start and close tags. To put text on the next line you simply add a line break (not \n or <br /> or VbCrlf), so it’s treated a bit like a <pre> tag, but it seems that only works IFF the end of the line is not an output (wrapped in # markers). When the last thing on the end of the line is wrapped in output markers cfmail ignores the fact that you’ve added a line break, you can add another line break but then cfmail adds both line breaks. You could make the whole email an html mail, but then you’d have to control all line breaks with a <br /> tag and that’s more hassle than its worth (for a simple email anyway).

The solution I landed on was simply to add a character to the end of the line, in my case a full stop (period) ‘.’ character was a good candidate. Somewhat obscure, though I can understand why it behaves like that, a bit like C# something has to indicate that the code block is over and ‘normal’ html should resume.

Spread/Promote this post

If you enjoyed this article, consider bookmarking or helping me promote it! Thanks.

  • Del.icio.us
  • Digg It!
  • Technorati
  • BlinkList
  • DZone It!
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon

Don't miss another post

Subscribe to SJM Dev's RSS Feed to stay updated with our latest articles!

Permalink | Comments (0)