Entries from November 1, 2011 - November 30, 2011

Sunday
Nov272011

Hands-On with with Freemake Video Downloader 3.0

I’ve been very pleased with ClipGrap to download YouTube videos, but having recently learned about Freemake Video Downloader I thought I’d give this new tool a try.

INSTALLATION

Standard stuff…

image

image

In the setup program you will see that the default installation is ad-supported.

image

I selected the oddly named Parameters settings (which presumably means “custom installation”) instead.

image

NOTE: I wouldn’t mind some form of gentle advertising in the app – I just don’t want to install additional ad software.

 

image

 

image

image

image

 

 

OVERALL LOOK AND FEEL

Really, really, simple and elegant application.

MENUS

image 

image

image

 

OPTIONS

image

 

image

image

 

image

image

SUPPORTED SITES

image

 

Many major sites are directly supported. Also the application is refreshingly candid in its support for downloading pornography. One must know one’s audience! (A blurred out two of the names because I felt they were inappropriate to show on the blog). I also appreciate that they are up-front about what sites are not supported.

image

 

 

DOWNLOADING A YOUTUBE VIDEO

I picked this video of the latest NASA Mars Rover called “Curiosity”.

I copied the URL from the browser address bar

image

And clicked Paste URL

image

 

The app sat there for about 5 seconds, apparently trying to learn more about the video

image

And then this dialog appeared.

image

Again, the design of the UI is quite nice. However, I would appreciate some indication which format is the “original” – this is very obvious with ClipGrab. MP4 is the default that ClipPicks for this YouTube video as the “Original” so maybe the tool is indeed finding the original – but it would be nice to mark it that way in the list.

Very conveniently, the app provides the file sizes for the different videos.

Extraction of audio is also supported and even format conversion

 

image

 

I chose Only Download and clicked Convert.

image

One the downloading starts, progress will be shown like this

image

 

And upon completion you’ll see a notification at the bottom of the screen.

image

 

 

Once it is done, you can Show in Folder or Play the file.

image

 

QUICK THOUGHTS

  • Slick UI – a bitter cooler than ClipGrab.
  • Well thought-out UI and feature set – the creators of this software have delivered exactly what is needed
  • It is definitely worth you time to try this tool the next time you need to download videos
Thursday
Nov172011

PowerPoint - Fixing the Aspect Ratio of all the Images in your Slides

Scott Hanselman posted about fixing images that have been distorted in PowerPoint when moving from a 4:3 to to 16:9 aspect ratio. But what if you have many distorted images in your deck. If you manually try to correct those aspect ratios according to the instructions at the link above, you’ll be in for a lot of work.

However, if you aren’t afraid of working with VBA macros then below is a little bit of code that may help. It will reset the aspect ratio for all images in your deck.

----

Sub SetScaleSizeForAllImages()
Dim s As slide
Dim sh As shape
Dim factor As Single
factor = 1.0
For Each s In ActivePresentation.Slides
    For Each sh In s.Shapes
        If sh.Type = msoPicture Then
            sh.ScaleHeight factor, msoTrue
            sh.ScaleWidth factor, msoTrue
        End If
    Next sh
Next s
End Sub

----

Sunday
Nov132011

Interlude: 2080 - My Megadrive

http://www.youtube.com/watch?v=kcPtMyOPgBw

 

 

FRAMES FROM THE VIDEO

image

 

image

 

image

 

image

 

image

 

image

Saturday
Nov122011

Visio – Controlling Character Spacing (Screencast)

Controlling how tightly or loosely your text appears is a useful technique for making any visual content look better. Like many applications, Visio provides this control, but it is buried. In this post and screencast I’ll show you how to control the character spacing and some advanced techniques in Visio to control it smartly.

SCREENCAST

http://vimeo.com/32022414

 

EXAMPLES

First, let’s get on the same page about what character spacing looks like.

Below the the default character spacing to which we are all accustomed.

image

Now with expanded spacing …

image

And now with condensed spacing …

image

(as you can see from the last example, if we condense too much the letters may run into each other)

 

CONTROLLING CHARCTER SPACING IN VISIO

Right-click on a shape and select Format > Text

image

 

The Text properties dialog will appear

image

Select the Character tab.

image

You’ll see options for spacing. By default text will be set to Normal. There are two more options, Expanded and Condensed which do what their names imply.

image

If you select Expanded, it will default to a 1pt expansion that you can alter.

image

 

If you select Condensed, it will default to a –1pt expansion that you can alter.

image

In this example, let’s choose Condensed and set it to –2.5pt.

So our text turned from this …

image

To this…

image

 

THE INFLUENCE OF CHARACTER SIZE ON CHARCTER SPACING

By default there is none. Changing the character size will not change the character spacing. So for example, the text in the screenshot above is 36pt and has a –2.5pt character spacing. If one changes the text size to for example 14pt it will leave the spacing at –2.5pt.

image

 

And the result will look like as shown below.

image

It’s clear something looks wrong. The characters are jammed together to much.

Let’s zoom in to get a closer look.

At 400% zoom you can see it much more clearly.

image

What we really need is a way to make the character spacing be relative to the character size.

DYNAMIC CHARACTER SPACING

Fortunately, this is completely possible in Visio, and as it so often true, we must look toward the ShapeSheet for help.

Right-click on the shape and select Show ShapeSheet.

image

The Character section clearly has the spacing set to a hardcoded value of –2.5pt.

image

Now let’s change it to be relative to the Character Size using this simple formula

=-Char.Size*0.05

image

Looking at the 14pt text it looks fine.

image

Let’s zoom in to be sure…

image

 

And zoom back out and set the text size to 36pt to see if the spacing is preserved.

image

And it is. Success!!! Now the character spacing will respond to the text size so we don’t have to keep adjusting it manually.

image

Saturday
Nov052011

Batch Exporting SharePoint 2010 List item Attachments using Access 2010 and C#

Despite having one of the least exciting titles, in this blog post I’ll show you how I solved a problem we were having at work. I know this is a common problem you encounter, so I think you’ll find this solution helpful.

THE SITUATION

As you know our product (Dynamics AX) has a large set of SSRS reports - 856 to be exact. During the development of AX we asked developers to save PDFs of their reports into a SharePoint list.  We already had a SharePoint list that tracking various attributes of our reports (name, which team built it, what milestone it was due, etc.) so we simply used SharePoints ability to add attachment to list items.

Everything worked great until this week. My team needed to share all the PDFs on a fileshare so people could easily browse and examine all the reports. Of course, I went looking for a feature that doesn’t exist: “Export all attachments in list” is not a feature SharePoint has.

After researching a few days I found no features or tools that would help me. So it was clear I’d have to make my own solution.

OVERVIEW

SharePoint can export a list AND its attachments into an Microsoft Access database. That’s a start. At least he data is now out of SharePoint. And then next step was to use the DAO (not ADO) API to go through the resulting database and save each attachment. It turned out to be quite simple actually.

STEP 1: EXPORTING THE LIST WITH ATTACHMENTS

First, I created a view of our Reports list called “Attachments” that contained only the fields I needed. I added a filter to this list so that it only included those list items that had at least 1 attachment. The attachment field, the Design field and the Name field. Why the Design and Name fields? These extra fields help disambiguate the attachment names – which are often simply called “report.PDF”. The portion of the actual list is shown below.

Then under List Tools / List I chose Open with Access

 

The Open in Microsoft Access dialog appeared. I gave it the name I wanted and chose Export a copy of the data and clicked OK.

After about 20 seconds I my file was created.

I opened the file in Microsoft Access 2010 to verify that everything worked.

And just to be sure I examined the attachments for the first row

 

At this point everything looked great.

Now let’s get these attachments out.

STEP 2: GETTING THE ATTACHMENT OUT OF THE LIST

I couldn’t find a tool to do this for me, so I built my own using Visual Studio 2010.

The basic steps are simple.

  • Create a new VS2010 C# (.NET 4.0) project
  • Add a reference to Microsoft.Office.Interop.Access
  • Add a reference to Microsoft.Office.Interop.Access.DAO

 

 

And then use the code below. Instead of covering this line-by-line I’ll give a brief overview of the code.

The basic input consists of the filename of the Access DB, the name of the table in the DB, the name of the attachment field in the table, what folder to store the attachments in, and any fields to use as a prefix to the attachment filename.

All the code does is query the table for a recordset. For reach row, it queries the “attachment recordset” for that row. The attachement recordset contains the filename of the attachment and the binary data. All that is left to do is attach a prefix onto the the filename.

 

---

using System;
using System.Linq;
using MSACCESS = Microsoft.Office.Interop.Access;
namespace ExportAccessAttachments3
{
    class Program
    {
        static void Main(string[] args)
        {
            const string fieldname_filename = "FileName";
            const string fieldname_filedata = "FileData";
            string outputfolder = @"D:\attachments";
            string dbfilename = @"D:\\AX6Reports.accdb";
            string tablename = "AX6Reports";
            var prefix_fieldnames = new[] { "Name", "Design" };
            string attachment_fieldname = "Attachments";
            var dbe = new MSACCESS.Dao.DBEngine();
            var db = dbe.OpenDatabase(dbfilename, false, false, "");
            var rstype = MSACCESS.Dao.RecordsetTypeEnum.dbOpenDynaset;
            var locktype = MSACCESS.Dao.LockTypeEnum.dbOptimistic;
            string selectclause = string.Format("SELECT * FROM {0}", tablename);
            var rs = db.OpenRecordset(selectclause, rstype, 0, locktype);
            rs.MoveFirst();
            int row_count = 0;
            while (!rs.EOF)
            {
                var prefix_values = prefix_fieldnames.Select(s => rs.Fields[s].Value).ToArray();
                var attachment_rs = (MSACCESS.Dao.Recordset2)rs.Fields[attachment_fieldname].Value;
                int attachment_count = 0;
                while (!attachment_rs.EOF)
                {
                    var field_filename = attachment_rs.Fields[fieldname_filename].Value;
                    var field_attachment = (MSACCESS.Dao.Field2)attachment_rs.Fields[fieldname_filedata];
                    if (field_attachment != null)
                    {
                        if (field_attachment.Value != null)
                        {
                            string prefix = "";
                            if (prefix_fieldnames.Length > 0)
                            {
                                prefix = string.Format("{0}__", string.Join("__", prefix_values));
                                prefix = prefix.Replace(" ", "_");
                                prefix = prefix.Replace(":", "_");
                                prefix = prefix.Replace("/", "_");
                            }
                            var dest_fname = System.IO.Path.Combine(outputfolder, prefix + field_filename);
                            if (System.IO.File.Exists(dest_fname))
                            {
                                System.IO.File.Delete(dest_fname);
                            }
                            field_attachment.SaveToFile(dest_fname);
                        }
                    }
                    attachment_rs.MoveNext();
                    attachment_count++;
                }
                attachment_rs.Close();
                Console.WriteLine(row_count);
                row_count++;
                rs.MoveNext();
            }
            rs.Close();
        }
    }
}

---

PARTING THOUGHTS

This was a fun small coding project – it took maybe all of 1 hour to research the information and build the project. Still, It would be nice if this was a built-in feature of SharePoint.