Blogging

You are currently browsing the archive for the Blogging category.

In this post I’ll be comparing the different places where I write blog articles.

Here’s the location list:

  • home office
  • garden
  • train
  • work

At Home

My Office

The pink animal clock of Windows 7My home office is the place where I’ve written most of my posts so far.  It’s a quiet place, even when the kids are at home, because there’s a hallway in between that room and the living room.  So it’s a good place to write, easy to concentrate.

Our youngest daughter though, three years old, may occasionally take a peek through the glass door.  In fact, sometimes she even comes and sits on my lap to watch what I’m doing.  Her favorite clock type in Windows 7 is the pink animal, not sure what type of animal it is.

But that’s okay, as I’m using my free time to write these articles I occasionally need life to interfere and remind me about that fact.  That’s usually the time to stop writing and spend some time with the family.

Pros

  • Fast internet connection
  • Quiet, good for concentration

Cons

  • No fresh air

My Garden

Weather forecast for today, June 4th 2010: 23°C!Now that the weather has started to prepare Belgium for Summer, I prefer to spend my spare time outside sitting in our garden.  And sometimes, usually during the nice warm weekends, I want to use some of that time to produce an article.  With my wireless network, parasol, table and chair, I’m all set up for it.  While sitting outside I can even keep an eye on the kids, who are also outside playing with their slide, trampoline, swing, …

Pros

  • Can get something done while not missing out on the nice weather
  • Internet access (provided you’ve got a wireless network)

Cons

  • Laptop seems to run a bit warmer, probably because it’s warmer outside than in my office
  • Need an electricity plug for longer sessions

On The Road

In The Train

My new Swiss Gear Ibex 17-Inch Notebook Backpack Recently I’ve bought myself this backpack and it was the best thing I could buy.  My current client are the Belgian Railways.  Their offices are of course located close to a train station, so most of the time I’m commuting to/from work by train.  A one-way trip takes about 45 minutes and my main occupation so far has been reading or sitting with my eyes closed listening to music.

Until now.  With this new backpack I can easily take my laptop with me and use it to write, or to play with SQL Server, prepare a demo, ….  In fact, right now while I’m typing this I’m sitting on the train.  Without the backpack it was just too painful.  I need to walk about 8 minutes to get from the train station to the offices of my client and with the standard Dell bag the weight of the laptop is just too much on my shoulder.

In the mornings I still close my eyes though, that’s just too early to get something useful done anyway.

Pros

  • No time wasted doing nothing
  • More free time at home to spend with wife and daughters

Cons

  • No internet – no quick lookups
  • No internet – publishing will be delayed
  • No internet – links will need to be added later from another location in my list above
  • May get noisy on the crowded trains – difficult to concentrate
  • No mouse connected due to not enough space – I so miss it!
  • No electricity (but my battery lasts long enough so not an issue)

At Work

Well, actually, I’m just kidding here.  You thought it was for real?  Did you jump down straight from the top to get to this section?  I think I may have scared a couple of people, such as my employer.  Which is actually the intention of this paragraph, ha! (If you’re one of those, post a comment!) :-)

I’m not one of those guys who has the possibility to blog and get paid for it.

Conclusion

Even though I’ve listed quite some cons on writing while sitting in a train, I still like it.  Just because it’s much more productive than anything else that can be done at that time, and the time spent on the train is not something that’s optional or depends on a decision.  At home I can decide to make some time free for writing, whether if it’s in my office or in the garden.  But the train is a place where I will certainly spend some time each working day.  I can’t decide to not spend time on the train.  Except when I commute by car – which is something I do when I’ve got a meeting or info session in the evening – but that’s another story.

Real conclusion: sometimes buying a backpack can save you time.

Time for me to start the weekend and get off the train!

Have fun!

Valentino.

  • Share/Bookmark

Tags:

If you’re using Google Reader and you’ve got a WordPress blog then I’ve got a really useful tip for you!

Especially if you want to save time maintaining all those links in your blogrolls.

You can synchronize your blogrolls on your blog with folders in your Google Reader. Which means zero maintenance for your blogrolls: they’re automatically updated when you update your Reader subscriptions.

I actually found this solution on another site so I’ll just point you there: http://www.adashofbitters.com/2009/01/02/blogroll-google-reader-wordpress-easy/

You can see it in action in my sidebar on the right. Several of those link lists are being fed from Google Reader, such as the one called "SQL Blogs @Microsoft".

Happy blogging!

Valentino.

  • Share/Bookmark

Tags: , ,

Here’s a tip for anyone who’s using Windows Live Writer for blogging and wants to paste code into the articles.

Ever since my first code post back in July 2008 I have tried about four different Live Writer plug-ins to get the code formatting right.  Three of those are still installed today and I regularly use two of them.  As I post code samples in several languages (SQL, MDX, C#, VB, XML, …) I need the plug-in to support all those languages and to turn the code into decent output.  It would be ideal if I could do all this with just one plug-in.

Disclaimer: the code shown in this article is copied from my own blog or from Microsoft code samples.  They are not guaranteed to be complete and are just for demonstration purposes.  No explanation is provided on what the code is supposed to be doing either.

The Old Stuff

Following three screenshots will show you those three plug-ins in action.

Code Snippet

More info through this link

Code Snippet in action with some C# code

Colorized Code

More info through this link

Code Colorizer in action with some T-SQL

Source Code Formatter

More info through this link

Source Code in action with some XML

This last one is the one that I don’t use very often – to be honest I don’t even remember what I’ve actually used it for…

Now, back to the real reason for this article.

Time For Something New

As I mentioned before, I’m not extremely happy with the fact that I need to use several plug-ins for a similar task.  I keep forgetting which one the more interesting one is for SQL, or for C#, or whatever, I think you get my point.  It would be perfect if one plug-in could do all this.  And it has taken me quite a while but I think I may finally have found that one plug-in.  You can see it in action in my previous post.  Doesn’t that look nice?

What I like most about this plug-in is that the developer has taken a different approach to get the formatting done.  All other plug-ins that I’ve tried required me to paste the code into a pop-up window and select the right programming language, as I’ve shown you above.  This one is much simpler: it takes what is stored in the clipboard, including the formatting!

In my opinion this has two interesting advantages:

    • Faster: no messing around with a pop-up window
    • Accurate: as it uses the formatting as provided by the application from which it was copied, it will look exactly the same!  Which is something that I can’t say about the other plug-ins.

Okay, this means I don’t have any other options either, no line numbering, no alternating background coloring, …  But who cares when the output looks good?  And I don’t use those extra features anyway.

Here are some pasted snippets using my new favorite plug-in.

SQL copied from the Management Studio (SSMS 2008)

--a comment
declare @number int = 42;
declare @character char(1) = '0';
declare @expectedLength int = 8;
/* a block comment */
select REPLICATE(@character, @expectedLength - LEN(@number)) 
+ CAST(@number as varchar(8)) as Result;

MDX Copied From SQL Server Management Studio (SSMS 2008)

SELECT NON EMPTY { [Measures].[Reseller Sales Amount], [Measures].[Reseller Order Quantity] } ON COLUMNS,
NON EMPTY { ([Geography].[Geography].[Postal Code].ALLMEMBERS ) }
DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS
FROM [Adventure Works]
CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

C# Copied From Visual Studio (VS 2008)

public partial class StoredProcedures
{
    [Microsoft.SqlServer.Server.SqlProcedure]
    public static void WeatherSP(string zipCode)
    {
        Weather myWeatherWS = new Weather();
        WeatherReturn weatherResult = myWeatherWS.GetCityWeatherByZIP(zipCode);

        SqlMetaData[] recordMetaData = new SqlMetaData[2];
        // layout of the records that we'll return
        recordMetaData[0] = new SqlMetaData("Description", SqlDbType.Char, 100);
        recordMetaData[1] = new SqlMetaData("Value", SqlDbType.Char, 1000);

        // build a record based on the metadata
        SqlDataRecord record = new SqlDataRecord(recordMetaData);

        // let's start sending result into the active pipe
        SqlContext.Pipe.SendResultsStart(record);

XML Copied From Visual Studio (VS 2008)

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="MyWebService" value="http://MyWebServiceServer:MyWSPort/PathTo/MyWebService.asmx" />
    </appSettings>
</configuration>

VB.NET Copied From Visual Studio (VS 2005)

#Region "AddColumnInformation"

    '/ <summary>
    '/ Stores the column information of the provided input and output objects in a ColumnInfo object.
    '/ This method is called by the RemoveDuplicates component during PreExecute when the BufferManager
    '/ is available, and assumes the exact same number of input and output columns.
    '/ </summary>
    '/ <param name="bufferManager">The IDTSBufferManager100; used to locate the columns
    '/ in the input and output buffers.</param>
    '/ <param name="output">The output of the component.</param>
    '/ <param name="input">The input of the component.</param>
    <System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")> _
    <System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId:="System.Exception.#ctor(System.String)")> _
    <CLSCompliant(False)> _
    Public Sub AddColumnInformation(ByVal bufferManager As IDTSBufferManager100, ByVal output As IDTSOutput100, ByVal input As IDTSInput100)
        If input Is Nothing Then
            Throw New ArgumentNullException("input")
        End If

        If output Is Nothing Then
            Throw New ArgumentNullException("output")
        End If

        If bufferManager Is Nothing Then
            Throw New ArgumentNullException("bufferManager")
        End If

        If input.InputColumnCollection.Count <> output.OutputColumnCollection.Count Then
            Throw New Exception("Input column collection does not match the output column collection.")
        End If

        For x As Integer = 0 To output.OutputColumnCollection.Count - 1
            Dim colInfo As New ColumnInfo()
            Dim outCol As IDTSOutputColumn100 = output.OutputColumnCollection(x)
            Dim inCol As IDTSInputColumn100 = input.InputColumnCollection(x)

            ' Set the buffer column index for the input column and the output column.
            colInfo.inputBufferColumnIndex = bufferManager.FindColumnByLineageID(input.Buffer, inCol.LineageID)
            colInfo.outputBufferColumnIndex = bufferManager.FindColumnByLineageID(output.Buffer, outCol.LineageID)

            ' Save the column
            columnInfos.Add(colInfo)
        Next x
    End Sub
#End Region
End Class

One feature though that I’d like to see is a horizontal scrollbar when the code lines are longer than the width of the code block.  Right now it automatically wraps the text which makes it a bit difficult to read.  So I have to pay attention when pasting code.  Although it’s not always obvious, you can see this wrapping occur in three of the above code snippets (MDX, XML, VB.NET).

To conclude this article: the new plug-in that I’m using is called “Paste from Visual Studio” or VSPaste.  You can download it here.

Out of curiosity, I wonder how it performs when pasting formatted text from Word (2007):

PrFont34Bin0BinSub0Frac0Def1Margin0Margin0Jc1Indent1440Lim0Lim1Some bold text
And some italic
Italic, bold and underline in combination
Text in blue and green and red on one line

Okay, ow, look at that, I’m writing in red now, that can’t be the intention! Luckily Live Writer allows me to switch back to black.

So, conclusion: VSPaste not only works when pasting from Visual Studio, SQL Server Management Studio is okay as well!  But Word is not…

Happy blogging!

Valentino.

  • Share/Bookmark

Tags: ,

WordPress Spam

I wasn’t getting a lot of spam on this blog until recently – I guess the URL has entered some kind of “Spam Test Targets: Rookie Level”-list – so I decided to do something about it.

WordPress comes with a spam blocker called Akismet.  By default this plugin is not active.  To activate it you need to register @ wordpress.org.  This gives you a unique API key which you need to enter when activating Akismet.

Since I activated it yesterday it has intercepted 43 spam messages.  Way to go Akismet! :-)

Thanks go to the writer of this list of tools for fighting spam in WordPress.  If Akismet is not enough, check out the other tools mentioned on the site.

  • Share/Bookmark

Tags: ,

I’m using Windows Live Writer (version 2008, build 12.0.1370.325) to write my posts on this WordPress 2.6 blog.  To be able to do this I had to make a couple of changes to the default configuration of WordPress.

  1. Activate XML-RPC in Settings > Writing, by default this is disabled.
  2. Modify the upload folder in Settings > Miscellaneous.  By default this was “wp-content”.  I changed it to “wp-content/uploads” and I created the uploads folder manually on the server (with 777 rights).  This is the folder where the images will end up.

After these two changes I was able connect to the blog with WLW and post the article about the black background issue (which contains an image).

  • Share/Bookmark

Tags: ,

© 2008-2010 A Developer's Blog All Rights Reserved