Jul 30 2007

Assigning Keyboard Shortcuts to Quick Parts (Building Blocks) in Word 2007

Category: Office 2007lomaxx @ 3:21 pm

Word 2007 comes with the ability to add Quick Parts to your documents so you can quickly access frequently used blocks of text. As cool as this feature is, it would have lost a lot of its appeal if I had to use the mouse to access the Quick Parts from the ribbon menu which means I’d have to access them in 3 clicks, which really isn’t that Quick. What I wanted was the ability to insert it from a keyboard shortcut. At first this didn’t appear to be available but after a bit of digging I discovered it could be done (and without the use of a macro either). This blog post will take you through the process of creating a Quick Part and assigning a keyboard shortcut to it.

Creating a Quick Part

  1. Quick Parts are essentially blocks of commonly used text. To create a Quick Part, simply highlight the text that you want to access via the Quick Part menu and select “Save Selection to Quick Part Gallery…” from the Insert ribbon



  2. You should now see the “Create New Building Block” dialog. Fill in all the Relevant details and click “Ok”


  3. You have now saved your new quick part to the Quick Part Gallery. To use your Quick Part, you can simply select it from the Quick Part Menu



    Or from the Building Blocks Organizer



    Using either of these methods will insert the Quick Part at the current cursor location in your document.

Assigning a Keyboard Shortcut to your Quick Part

Once you have created your Quick Part, it can be rather inconvenient to continually have to go to the Quick Part menu to insert it. What you can do instead is assign a keyboard shortcut.

  1. Open up the “Word Options” dialog from the Office Button

  2. In the Word Options dialog, click on Customize and then in the right hand panel, click the Customize button next to the Keyboards Shortcut prompt


  3. In the Customize Keyboard dialog, in the left hand categories list box, scroll down and select “AutoText”, then in the right hand “AutoText” list box, scroll down to the name of the Quick Part you want to assign a keyboard shortcut to. Select the Quick Part and then select the “Press new shortcut key:” textbox and enter the shortcut key that you wish to assign to the Quick Part.

    Once you have done that, click Assign to go back to the Word Options dialog.

As you can see, Quick Parts can be an extremely useful when you’re repeatedly using specific blocks of text, however to really harness the power of Quick Parts, assign a keyboard shortcut to them so they’re even more readily available.


Jul 27 2007

Why can’t I add comments to your blog?

Category: Programminglomaxx @ 12:48 am

One of my favourite bloggers is Joel Spolsky. There are many reasons I like his blog, but one of which is that he tells it like it is regardless of if it’s what everyone else is doing or not. His recent post on why he doesn’t allow comments (or rather why he agrees with Dave Winer), pretty much backs up my theory on blogs and comments. The thing I’ve noticed about blog comments are that 99% of the comments on blogs fall into one of the following categories:

  1. They add nothing to the actual blog post (usually trash like “Great post, I loved it so much” or “Your post sucks”)
  2. They are questions about the post, which in itself isn’t so bad. But if you take a look at what Joel does, he takes the questions he feels are important to answer as a whole and makes them into new blog posts. The advantage of this is that they are then marked as “Hey this is a pretty good question and I don’t want it to get lost in the noise of the other comments, so I’ll answer it in its own post so everyone knows it’s flipping important”
  3. They are lengthy posts by the commenter on why they agree or disagree with the post, or offer a really meaningful contribution. In all reality, comments such as this are posts in their own right, so why not post it on your own blog. You’ve typed it up anyway, so why not post it on your own blog?
  4. SPAM! If don’t allow comments on your blog, then you aren’t going to have to worry about wasting time filtering for spam!

I used to comment on blogs, but over time I found it to become increasingly futile. I’d often have good things to say but unless you were in first 2 or 3 comments whatever you had to say would often be drowned out by all the other junk. There’s no doubt in my mind that part of the problem stems from the fact that posting comments to a blog is too easy and in my upcoming article on Microsoft Access, I’ll look at another example where making things too easy isn’t always a good thing. Basically my theory revolves around the idea that if you make things easy, dumb people can do it, and if dumb people can do it, they will do dumb things because they are dumb people.

Anyway, my point is this, I haven’t been blogging for long, so before I get hugely famous and popular, I’ll answer the question here and now. I don’t allow comments on this blog because if you feel it’s important enough to comment on, then you should build up a collection of useful posts on your own blog. If you’ve got enough interesting things to say, then your blog will be found and people will read it.

If you feel it’s important enough to ask a question, then send me an email. If you’ve taken the time to sit down and write an email then I’ll definitely take the time to write a response. Heck I’ll probably blog about it myself, I’m typing it up anyway in outlook, so it’s only a few extra clicks to publish it to my blog now that I’m blogging from Word 2007

Now some of you may be reading through my blog thinking “But some of your posts actually do have comments! You’re a liar!” Well, ok there is one minor exception to my comments rule and it isn’t really an exception anyway. I allow the publishing of trackbacks into the comments. I do this because it acts as a bit of an automated filing system for me to view all places where links to my blog have been posted so I can quickly see all related blog posts. I know I could use bloglines but I just don’t really want another account to manage, when I’ve already got a tool here that will do it for me.


Jul 19 2007

Iron Speed Build Error

Category: Iron Speed, Programminglomaxx @ 10:45 pm

Today I had a really annoying problem with Iron Speed Designer. I was getting an error after building my application that simply said “Object reference not set to an instance of an object”.

I searched the forums for ages looking for the solution, but came up empty handed. After nearly going bezerk looking for the error in my application, I realised that last night I had deleted a table from the database and subsequently from my application, however I noticed today that the ASPX files and associated folder were still there. I also noticed that in the App_code folder there were still references to this old table.

I went through and cleaned out all the references to the table in the following locations:

Presentation Layer

App_Code Folder

App_Code\Business Layer folder

App_Code\Data Access Layer folder

After that I was able to recompile successfully.


Jul 19 2007

Disabling MDAs (Managed Debugging Assistant)

Category: Programming, Visual Studio 2005lomaxx @ 11:18 am

Today I was working on a console application in Visual Studio 2005. It has a number of methods that take quite a long time to execute and I kept getting ContextSwitchDeadlock errors from the MDA which was really annoying me., because the code I was executing was fairly basic processing code, however because it was just prototyping stuff I knew it was dodgy, I just wanted to know if my theory was going to work. What I didn’t want was this MDA popping up every time I executed telling me that my code was trash. I knew that already. So I wanted to turn it off. This should have been pretty simple. It wasn’t.

I searched through a few articles and found some tips on either turning it off via the registry or turning it off via a config file. Surely this isn’t necessary. Why isn’t there an option in the Tools->Options list that allows you to do this? I tried both and neither worked. I did find however after much digging that you could get to the exceptions console by using the keyboard shortcut Ctrl + Alt + E. I don’t know where the menu option for this is. I’m told if you right click on your solution and select Debugging->Exceptions you can get it, but for some reason my copy of VS doesn’t have that nifty feature. That aside, if it is a genuine option that can be disabled, why the hell would you only put it in just the context menu of the Solution Explorer? Why isn’t it in the options dialog in the first place? In any case, I’m grateful that you can turn it off and by going here I found that there was a tree list and one of the nodes was Managed Debugging Assistants. I was able to turn off the MDA for ContextSwitchDeadlock by expanding the node and disabling it in the “Thrown” column.

Problem Solved!

Edit: After a bit more digging I actually found that it wasn’t my dodgy code that is causing the problem. See I wasn’t convinced that just by executing a command on a generics list of 100,000 objects that took nearly 12 minutes to complete that my code was doing anything particularly wrong. Well not really I knew that I might want to look at using an asynch thread if I ever roll this out to production and possibly process the list in batches, but the point is, I wasn’t doing anything strange in my code other than parsing a very large list of objects.

Turns out that even if I was using an asynch thread this wouldn’t solve the problem unless I caused each thread to run under 60 seconds. The problem is that because my code is processing a very large list of objects it’s punishing the CPU, and so it should. However because it’s doing this, it isn’t checking for pump messages which are important because you get important notifications from windows, but I want to process my list as quickly as possible and I don’t want to have to keep updating the message pump just so I don’t get a ContextSwitchDeadlock message. So my solution is that I need to process messages from the pump say every 100 objects that are processed in my application, which is fine, except it’s a console application. I don’t really care about how responsive the UI is or how responsive the application is. I’ve got a dual core CPU, it can smoke the daylights out of the first core, whilst I post to this blog on the second. The server it’s running on has dual quad cores. In any case at least now I know what the problem is and it won’t really cause me any problems, however if you are developing a GUI application and need to keep you apps responsive whilst doing a lot of processing, I suggest you read this blog post for tips and tricks on keeping the message pump under control.


Jul 17 2007

Setup of this Blog

Category: Programminglomaxx @ 12:26 pm

In previous posts I talked about blogging from Word 2007 and the benefits and features, however I now want to explain my blog setup fully.

Before I decided on a system, I set out a few criteria:

  1. Must be able to support posting from Word 2007 (With image support)
  2. Must be highly customizable and configurable
  3. Must be a dedicated blog engine
  4. Must load quickly
  5. Preferably Free

After quite a bit of research and preliminary testing, I finally decided on WordPress.

There were a few reasons for this, but the main one was that my site is hosted by Webhost4life who are very cheap ASP.NET hosts, however they are not very fast when it comes to actually running ASP.NET applications.

I originally thought I would setup a DotNetNuke based blog as I develop in it and am quite familiar with the interface, however it’s a poor system for blogging and posting to it from MSWord isn’t an option. Aside from that, DNN on WH4L is just horribly horribly slow and all I want is a simple blog to write a few of my musings on and that would load up quickly.

I tried Blogger and it was ok, reasonably quick and fairly intuitive, however it wasn’t that customizable or configurable

I tried TypePad and I have to admit that it was tempting and if I didn’t already have a hosting account at WH4L I probably would have taken the dive. For $5/month why not?

I looked at windows live spaces but lack of posting pictures from Word 2007 really stung. Aside from that, it just wasn’t a blog engine I felt was tried and tested by the masses.

BUT I already have a WH4L account and despite the slow speeds of the ASP.NET based sites, the PHP / MySQL sites fare much better. They also have a (almost) one click install of WordPress so there wouldn’t be any extra overhead and WordPress also has a very strong community behind it which meant it was highly customizable. So the additional cost for me to setup and customize my blog was minimal and it supported all the additional features I needed so WordPress was given the green light.

Installing WordPress on Webhost4Life

If you’ve dealt with WH4L before, you know that they offer a very cheap service, but it’s not always what they make it out to be. This is also the case with their “One Click” product installs.

To setup WordPress you first need to make sure you have a few things setup.

  1. Setup a virtual directory and have a domain pointing to it
  2. Setup a MySQL database (if you have one free)

Once you have done that, you can go into the “Site Admin” section of the control panel and click on “Php Free Plug-ins”

From there you can select the PHP WordPress plugin and click “Go Install This”

Next, select the virtual directory you just created

Finally you need to enter all your virtual directory information and database details.

Click next and your WordPress blog will be setup for you.


Jul 16 2007

Custom Stored Procedures in Iron Speed Designer

Category: Iron Speedlomaxx @ 11:42 pm

Iron Speed Designer is a great tool for generating all sorts of application code, however there are some times you need to write and execute your own stored procedures. I had that very problem today when I needed to execute an update stored procedure from within my code.

Unfortunately, Iron Speed doesn’t use the Microsoft enterprise library, however there’s no reason you can’t just use the standard ADO.NET methods.

Here’s the code I placed in the click event of my button to execute my custom stored procedure in the database.

Dim conn As New SqlClient.SqlConnection(ConfigurationManager.AppSettings(“DatabaseQSDU1″))
Dim procName As String =
usp_my_proc
Dim cmd As New SqlClient.SqlCommand(procName, conn)

cmd.Connection.Open()
cmd.CommandType = CommandType.StoredProcedure
cmd.ExecuteNonQuery()
cmd.Connection.Close()

 

As you can see it’s pretty straight forward. The only thing I did have a small problem with was that Iron Speed puts a “Provider=SQLOLEDB” in the connection string by default. I had to remove that to make the connection string compatible with the format the SqlConnection was expecting.


Jul 15 2007

Publishing to your blog from Word 2007

Category: Office 2007lomaxx @ 10:26 am

In my last post I went through some of the benefits of posting to your blog via Word 2007. This article will take a more detailed look at how you can actually post to blogs via Word 2007.

Requirements

To be able to blog with Word 2007 you need 2 things

  1. Microsoft Word 2007
  2. An account with one of the supported blogging provider

The table below shows a list of the supported blogging providers that Word 2007 is compatible with and if they support direct image uploading.

Provider

Supports Images

Windows Live Spaces

No

Blogger

No

SharePoint Blog

Yes

Community Server

No

TypePad

Yes

WordPress

Yes

 

Create a New Blog Post

To create a new blog post in Word 2007, open Word, click on the office button and click “New”

You will then be presented with the “New Document” dialog. From here, select “Blank and Recent from the templates list and then in the main window double click on the “New Blog Post” template

You will now have a new document ready to create your new blog post.

Register Word with your Blog Account

Blogging from Word 2007 currently supports a number of blogging providers as listed in the table under requirements. In addition some providers will also allow you to directly upload pictures which is a key requirement for me as I always like to illustrate what I’m doing with pictures.

The blogging account I have is with my own WordPress server but the registration process is essentially the same for all of them.

  1. Click “Manage Accounts”
  2. You will then be presented with the “Blog Accounts” dialog. From here click “New”

  3. You will then be presented with the “New Blog Account” dialog. Here you will need to select your blog provider from the drop down list of blogs. I am choosing WordPress.

  4. You will now need to configure you account details and click “OK”
  5. Word will try and verify you’re information and if successful, will register your account in the account manager.
  6. You can now close your dialog and begin working on your post.

Insert a Category

I usually like to sort my blog posts into categories and Word 2007 makes this task easy as well.

  1. Click on the “Insert Category” button
  2. At the top of your post, an inline drop down box will appear with all the categories defined for your blog. All you need to do is select one and when you publish your blog, it will be published to that category on the server.

Edit Existing Posts

Another really cool feature is the ability to edit existing blog posts from within Word 2007. To do this all you need to do is:

  1. Click the “Open Existing” button

  2. Choose the account and post that you wish to edit and click “Ok”

Publishing your post

This really can’t get much easier. All you do is click the publish button and you’re done.

Conclusion

As you can see, setting up and publishing to a blog from Word 2007 is a snap. For my next article I’m going to look at setting up WordPress on Webhost4life, which is my hosting provider.


Jul 14 2007

Why Blog Using Microsoft Word 2007

Category: Office 2007lomaxx @ 8:35 pm

I have wanted to setup a blog for some time now, however I have always found the process of blogging to be cumbersome. The problem stemmed from the fact that you either had to be online to post or you had to use a third party client such as Windows Live Writer (which is still in beta but is free) or pay for something like BlogJet which is a very good application, but unfortunately for the casual blogger like myself, isn’t something I’m overly interested in purchasing.

This week however I was doing a bit of research and noticed that you could actually post blogs from MS Word. Suddenly, I was interested in blogging again.

Benefits of Blogging Offline

Now at first, you might not consider blogging offline to be a bit of a backward step to the whole process of blogging, however if you have ever done any serious blogging, I’m almost certain that you will have a workflow similar to the following:

  1. Type your post up in your favourite text editor
  2. Once completed, copy and paste it into your blogging software
  3. Apply headings and formatting
  4. Preview the post
  5. Post

Now this has never appealed to me as it’s always felt like a bit of a cumbersome way of doing things and quite frankly has meant I’ve never had an interest in maintaining a blog. With the ability to post to blogs from Word 2007, managing a blog suddenly becomes a whole lot more appealing for the following reasons:

  1. Publishing via a web browser is inferior
    If you have done any sort of site admin or even content creation for websites, the general trend has been to use controls such as FreeTextBox or FCKEditor. Now these are great additions to websites and if you are using them to make small edits or add small bits of content then they are great, however have you ever tried writing a complete article with either of these? It simply doesn’t compare to using Word to get the job done.

  2. Create Publishable Content Offline
    There are times when you might be at a hotel, stuck at an airport, travelling on the train or simply don’t have a net connection available but you have time to blog. Now you can always type it up in Word which you probably already do, but you’re still going to have to complete the other steps in the above workflow. But being able to publish from Word means you can also apply formatting and preview the post so that when your connection comes back, all you need to do is click publish and you’re done.

  3. You’re probably already writing your posts in Word anyway
    As you probably noticed the first part of the blogging workflow involves typing up your posts in Word anyway. So if you’re already doing it, why not cut out the other steps and publish directly from Word anyway?

  4. Word is THE Swiss army knife of editors
    No matter how fancy the online editors get, they’re never going to be better than Word. Spell-check, autocorrect, formatting, charts, clipart, tables, wordart, symbols, shapes and all manner of formatting and text manipulation options that we just take for granted with word are the reason you don’t type your posts online anyway.

  5. Ctrl + S
    Nothing, and I repeat NOTHING is more annoying than losing work, which is another reason you probably use Word to type your posts in the first place. Nothing is more assuring than knowing that a simple Ctrl + S will save your work. On more than one occasion, working with an online blogging client has infuriatingly cost me time because of a timed out connection, or an accidental back button click which has meant that even if I have saved my word document, all my formatting is out the window forcing me to re-apply it.

  6. Publishing to Multiple Document Types
    Publishing online is great, however publishing in Word means that I can save my documents to Word format after I’ve published them so I can back them up, or publish them to PDF (if you have a PDF generator installed) or any other format that Word supports, so I don’t have to maintain multiple versions of the document both online and offline, I simply open the post in Word and I can save it to any format I need.

  7. I don’t have to open my browser
    In reality, you will actually need to do this to respond to, or moderate comments, but I don’t really have to if I don’t want to. I can post, edit posts, manage categories and even manage multiple accounts all from Word so as a blogger, I no longer even need to open my browser to blog anymore.

  8. Automatic Image Insertion (for some blogging platforms)
    One of, if not the most single painful part of creating online documents is the need to upload images before you can include them in your document. It kills me every time I have to add a picture to my online documents and as such, I keep them to a minimum.
    One feature that I absolutely love in Office is the ability to just copy and paste images or screenshots directly into the document without even having to save it first. I simply take the screenshot and press ctrl + v and I have an image in my document just like that. Now the cool thing about this is that when I publish a blog post in Word it will automatically publish the post for me. Admittedly it doesn’t do it for every blogging platform, but for mine (WordPress) it does and I have to say this feature alone would be enough to make the switch because quite simply, IT ROCKS!

Blogging from Word 2007 is a great addition to Word and I hope to see it advanced in future releases. I will be posting a follow up article on how to actually setup and blog using Word 2007 shortly.