Securing Windows Remote Desktop

Just a quick list of pointers to help you secure RDP today...

For a while now, I've been using Windows Live Mesh to connect to my home PC's from remote locations. This method was really simple and didn't require any firewall changes on my router. Unfortunately SkyDrive, Live Mesh's successor, does not include this feature so I'll need to use RDP or another service such as LogMeIn.com. LogMeIn is a great service, so I'd recommend using this (even MS is recommending it!)

But for those of you that prefer/need to use RDP, here's a few tips for increasing security:

Change RDP TCP port (done in the registry)

Consider implementing an SSH tunnel

Update account password to strong as possible

rename admin account to non-standard name

disable all other accounts for RDP

If possible, restrict RDP client IP range in router or other firewall

Enable windows firewall for extra protection

Checklist After Configuring
Can other ips can connect?

Can accounts other than the desired one connect?

Further Reading
http://theillustratednetwork.mvps.org/Ssh/RemoteDesktopSSH.html

http://revision3.com/hak5/HackingRDP

How To Scan A File/Directory With Windows Defender (Windows 8 AntiVirus)

By default there is no simple way to scan a single file or directory with the built in Windows 8 Anti Virus program.

One way is to open Windows Defender, then select Custom, then click Scan.
You are then presented with a folder selection screen, which allows you to selectively scan parts of your PC's storage.

But to scan just one file, you have to get into command line land. To do this:

1. Open a Command Prompt
2. Type the following:

"c:\Program Files\Windows Defender\MpCmdRun.exe" -scan -scantype 3 -file PATH_TO_YOUR_FILE

e.g.

"c:\Program Files\Windows Defender\MpCmdRun.exe" -scan -scantype 3 -file c:\users\ted\downloads\suspect_file.zip


You'll need to surround your file's path with double quotes if it contains spaces.

If you are using this in an automated way (e.g. your download manager is scanning completed downloads) it's worth knowing that the scan results will be logged in %TEMP%\MpCmdRun.log

You can use that file's contents to see how the scan went.

Hope that helps!

How To Recover Your Lost SoulseekNS Password (Windows)

Have you forgotten your Soulseek password?

If so, and you still have access to the PC you had Soulseek installed on, then you're in luck. The password is stored in plain text in the Windows registry.

You can find it here:

Computer\HKEY_CURRENT_USER\Software\Soulseek2\config

in a key called login.

Just double-click on the key and you will see your password.

Now if you've forgotten your username, then I think you're hosed!

Note, these instructions are for SoulseekNS, which is no longer under development. Not sure how you reset/find a lost password for the new version: SoulseekQT.

See you in the Dark Ambient channel!

Resetting a network adapter with Powershell

I recently moved to a new PC and there's something wrong with the network configuration. The hardware seems OK but every few hours Windows reports that there is no Internet connection. I haven't spent much time troubleshooting but it looks like the PC loses its IP lease and does not renew it, but that's mostly just a guess at this stage.

The Windows 7 Troubleshooter reports:

The Network Diagnostics Framework has completed the diagnosis phase of operation. The following repair option was offered:

Helper Class Name: AddressAcquisition

Root Cause: "Local Area Connection" doesn't have a valid IP configuration

Root Cause Guid: {245a9d66-ae9c-4518-a5b4-655752b0a5bd}

Repair option: Investigate router or broadband modem issues
If you're connected to a hotspot or domain network, contact the network administrator. Otherwise:
    1.  Unplug or turn off the device.
    2.  After all the lights on the device are off, wait at least 10 seconds.
    3.  Turn the device on or plug it back into the power outlet.
To restart a router or modem that has a built-in battery, press and quickly release the Reset button.

RepairGuid: {9513cc1c-4a26-4cb8-bf89-0a82129bd105}

Seconds required for repair: 63

Security context required for repair: 0

Interface: Local Area Connection ({419b3c06-e283-4a99-adaa-b66439dd064d})


Running the Troubleshooter does fix the issue. It appears that this tool resets the network adapter which forces a new IP to be allocated to the interface.

I've never had this type of issue with Ethernet on Windows before, although I have experienced unstable 802.11 connections on certain laptops.

I've also updated the Intel NIC driver to see if this would help - it didn't. Others do seem to have this issue also. Most people use the workaround of assigning a static IP to the adapter - this isn't an option for me in this environment.

Anyway, I need to remote into this PC so I can't have it sitting there with a non-working network connection!

So to get around this problem, I wrote a script in Powershell which I've scheduled in Task Scheduler to run every 10 minutes. The script will check if the network connection has Internet connectivity and, if not, will reset the network adapter. So the longest I'll have to wait to get on to the PC will be 10 minutes.

Here it is:

# Set up event log source
# redirect stderr to null since there's no simple way to check if the source already exists
(new-eventlog -logname Application -Source "Reset Network Adapter"2> $null

$pingResponse = Get-WmiObject -Class Win32_PingStatus -Filter "Address='www.google.com.au'" -ComputerName . | Select-Object -Property Address,ResponseTime,StatusCode

if ($pingResponse.ResponseTime -eq $null) {
    Write-Host Network connection down. Resetting adapter.
    write-eventlog Application -source "Reset Network Adapter" -eventid 1 -message "Network connection down. Resetting adapter."

    # Assumes you have only one ethernet device in your PC. If you have more, use something like: '-and $_.Name like "*Intel*"'
    $adapter = Get-WmiObject -Class Win32_networkadapter | Where-Object { $_.AdapterType -eq "Ethernet 802.3" }
    $adapter.disable()
    $adapter.enable()
else {
    Write-Host Network connection seems OK
    write-eventlog Application -source "Reset Network Adapter" -eventid 2 -message "Network connection seems OK"
}

Hope that helps someone!

Scheduling the Task

This is quite simple but I recommend creating a new user on your system to run the task. For the above script they need to be in the Local Admin group in order to create the event log.

Add an action with:

command: powershell
and 
arguments: -file path_to\reset-adapter.ps1

An Exercise for the Reader

You can trigger a Windows scheduled task based on an event. When the network fails there are a bunch of events that are generated by applications and the System. You could pick one that reliably represents this network issue and set up your scheduled task to only run when this event is detected. This is a nicer approach that polling every 10 minutes.

Some hints for finding appropriate events in the System Log:
  • Source: Time-Service, DNS Client Events

Resources

SSH login error: "server refused public key signature despite accepting our key"

Just a quick one today...

If you are receiving the error above, make sure of these things before regenerating the key:
  1. Your account is not locked on the server
  2. You are using the right private key!
  3. You have added your public key to ~/.ssh/authorized_keys file on the server
  4. You added the wrong format of public key to authorized_keys file (e.g. added the Putty format instead of the OpenSSH format)
This error means that the public key generated by your SSH client was successfully transferred to the server but did not match the one stored on the server. In some cases, as mentioned above, this is misleading.

If your account is disabled then you will also get this error on some systems, even if the key you are sending is correct.

Testing exit code of Windows Batch file

Even though PowerShell is awesome, the old DOS Batch file is still a useful and commonly used tool. You will find Batch files powering crucial automated processes all over the globe.

Commonly you will run a sequence of commands and check each of them for successful completion. The usual way to do this is to check the errorlevel variable like so:

c:\mycommand.exe
if errorlevel 1 exit 1

(NOTE, you need to clear any environment variables called errorlevel because the Batch interpreter will return these instead of the built in variable if they are defined. Do this just like this: set errorlevel=)

Anyway, once you have checked each of your commands for errors, you will usually print out error messages and return your own error codes so that external programs calling your batch file will know what went wrong. You do this like so:

exit 2

Where 2 is an error code that means something specific to your script.

Testing these initially seems difficult because when you run the script it exits and you cannot check which error code was returned. There is a way to test these! Here it is:

cmd /k myscript.bat
echo %errorlevel%

Hope that helps - send me questions/comments below!

Giving a Windows directory a drive letter

Sometimes you need to test a program/script on your local machine that is expecting a certain drive, let's say X: drive. Your local machine may only have a C: drive, so what do you do?

You could reconfigure the script to use your C: drive but this is an unnecessary extra step. Instead you can create drive letters that map to Windows directories (folders) using the SUBST command.

It's easy, at your command line, type:

subst DRIVE_LETTER: PATH

For example:

subst X: C:\temp\testdata

You must not add a trailing slash to the directory or it will not work.

Once you're done, just add /D to the command plus drive letter, e.g.

subst X: /D
Hope this makes your life easier!

[Via Lifehacker -> via Codejacked]

Oracle Client Installer Fails on Windows 7 64 bit

You'll love this one! :)

Problem:
Trying to install the Oracle Client on your Windows 7 PC, it checks the Prerequisites and then vanishes.
Many web pages suggest that the installer will log it's progress to C:\Program Files\Oracle\... - this is not the case. It actually logs to %USERDIR%\AppData\Local\Temp\OraInstall..TIMESTAMP..

But in this case, the logs do not show anything is wrong!

Instead you have to look in %USERDIR%\AppData\Local\Temp\ for files with a name like hs_err_pidNNNN.log (NNNN is a number) - these are Java HotSpot exception dump files.

In this file I found errors showing an error in SHLWAPI.dll, which gave a stack trace ending in:

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  sun.awt.shell.Win32ShellFolder2.getLinkLocation(JJZ)J+0
j  sun.awt.shell.Win32ShellFolder2.getLinkLocation(Z)Lsun/awt/shell/ShellFolder;+20
j  sun.awt.shell.Win32ShellFolder2.isDirectory()Z+69
j  sun.awt.shell.Win32ShellFolder2.isDirectory()Z+79

This gives us a clue: the error is something to do with a link. Could that be a folder shortcut? A bit of Googling yielded that this was, in fact, the case.

So here's the solution:

Delete any folder shortcuts from your Windows Desktop. Re-run the installer.

Fixed.

I am really not a fan of Oracle OR Java. This type of thing reflects my general experience with Oracle and Sun technology.

Enough said...

The Windows Phone 7 Annoyance Page

I am a huge fan of Windows Phone 7. I've tried iOS and Android and in my opinion WP7 is much superior user experience. But being a relatively new OS there are some things that are annoying, weird and should be fixed. So just for fun I thought I'd list them here - maybe someone in the know will read them!

  1. No ability to edit the user spelling dictionary, apart from resetting it. Sometimes you accidentally correct a word to another wrong word. I suppose resetting is not so bad, since it's quite quick to re-add your customisations, but it'd be nice to be able to remove these incorrect corrections. 

Some General Thoughts on WP7

... work in progress

.NET Framework Error: Please set registry key HKLM\Software\Microsoft\.NETFramework\InstallRoot to point to the .NET Framework install location

Recently Windows 7 on one of my laptops became unstable and I had to restore from a System Image. This worked.. sort of. After restoring I found that Microsoft Security Essentials had to be repaired, and the .NET Framework 4.0 seemed to be corrupt.

When running programs that require the .NET Framework I would get the above error: "Please set registry key HKLM\Software\Microsoft\.NETFramework\InstallRoot to point to the .NET Framework install location"

This prohibits me from running many different programs including Visual Studio 11 Beta so this had to be fixed!

The obvious first step was to uninstall .NET Framework 4.0 and reinstall. This did not help.

Next was to manually edit the registry to try and provide the data requested in the error message. This was confusing because the key was present and contained the path to the framework directory in the Windows directory. It looked OK.

Next I tried the .NET Framework Setup Verification Tool. This confirmed that the framework was not installed properly but, to be honest, I could not determine from the log file what was actually wrong.

The last resort is to do an in place install of Windows 7 - basically replace all the system files. Through my Technet subscription I have access to an ISO of Win 7 SP1 so I grabbed this [BTW, Microsoft, why can't you enable resuming on the Technet download servers?] and tried to make a bootable USB key by which to install Windows 7. If you have the Windows DVD media then this will be also be fine.

I usually use the Windows 7 USB DVD Download Tool from Microsoft Store. But guess what? This required .NET 4.0 to be properly installed!

There is another product, WinUSB Maker, which is popular but this also requires .NET4.

What to do?

Well, I found another tool which can do the trick and does not require the .NET Framework: NoviCorp WinToFlash. This can copy a Windows DVD to a USB drive and make the drive bootable. It can also format the drive if required.

The only thing is WinToFlash does not natively work with ISO files, so you will also need a Virtual DVD-ROM such as VirtualCloneDrive.

The process is simple:
1. Mount the Windows ISO with VirtualCloneDrive
2. Run the WinToFlash wizard
3. Choose the VirtualCloneDrive drive (e.g. E:) as the Windows disk, and your USB drive as the target.
4. Allow WinToFlash to format the drive if it asks.
5. That's it.

Now to reinstall Windows 7, just insert the USB key and AutoRun should start the installer. If it doesn't just open the drive in Windows Explorer and run Setup.exe. Follow the instructions until you choose Upgrade or Custom. Choose Upgrade to reinstall.

Do not choose custom unless you want to delete all your existing files and programs!


Note: you can only reinstall the same version of Windows, so you can't upgrade to Pro from Ultimate, and so on.

As for .NET,

Hope that helps. Any questions - reach out in the comments.

Update: 31-May-2012

The above  did not fix the .NET Framework corruption for me. I messed around some more but ended up having to do a fresh install of Windows 7. Then everything worked great.

Converting a DataReader to IEnumerable Using Iterators and Yield in VB.NET

The yield keyword is incredibly useful when you need to convert collections into other types of collections. Unfortunately VB programmers were left out until late last year. Since the Async CTP 3 the yield keyword and Iterator functions have been available for Visual Basic .NET.

You can find lots of examples of this around for C# but some of us corporate contract programmers sometimes have to use VB.NET! 

Here's an example of how to create a list of objects from a DataReader using Yield. To run this you will need to download the Visual Studio Async CTP 3 or .NET 4.5 RC.

So our goal is to take a set of rows from a database, which we access via a DataReader. We want to convert each row into an object, and return all those objects as an IEnumerable - in this case a List(Of T).

Here's our class to store the data as objects. Notice it has a static method to create an instance of itself using a row from a DataReader.


Class StudentRecord
        Public StudentId
        Public UnitCode
        Public HoursPerWeek
        Public NumberOfWeeks
        Public TotalHours
 
        Public Shared Function Create(dr As IDataRecordAs StudentRecord
            Return New StudentRecord With {
                .StudentId = GetStringFromReader(dr, "studentId"),
                .UnitCode = GetStringFromReader(dr, "unitCode"),
                .HourPerWeek = GetDoubleFromReader(dr, "hoursPerWeek"),
                .NumberOfWeeks = GetIntFromReader(dr, "numWeeks"),
                .TotalHours = .HoursPerWeek * .NumberOfWeeks
                }
        End Function
End Class


(GetStringFromReader and similar are helper function from my common utility library. They just return the specified column's value as the required type.)

Next, we have our main loop where we retrieve the data from the database, and then pass it to the conversion method. Let's call it GetData. It queries the DB and returns the list of StudentRecord objects. The details of GetReader aren't important - it just creates a DataReader based on the SqlDatabase and SqlCommand objects.

Note: this code is just for example - we wouldn't normally necessarily have the SQL statement right here!

The interesting part is the call to GetEnumerator. We pass in the type (aka generic type T) we want to get back, as well as the data reader and a function parameter for the static method we saw above. Lastly we convert the IEnumerable it returns to a list.


Private Function GetData() As List(Of StudentRecord)
        Dim db As New SqlDatabase(CONN_STRING)
 
        Using cmd As SqlCommand =
            SqlDatabaseHelper.CreateSqlStringCommand(db,
                                   "SELECT * from students")
            ' Create data reader             Using dr As DbDataReader = GetReader(db, cmd)                 Return GetEnumerator(Of StudentRecord)(dr, AddressOf StudentRecord.Create).ToList()             End Using         End Using     End Function


Last but not least - here's where we convert each row from the DataReader into a StudentRecord. It's quite simple and this is the great bit about how Yield works. We simply pass each row from the reader into the function specifed in the generator function parameter, and it outputs a constructed StudentRecord object. The Yield functionality takes care of executing the StudentRecord.Create method, collecting up all the created objects and returning them as an IEnumerable object.

We can get rid of the reader here because once we've completely iterated we have all the data we need in the IEnumerable.


Public Iterator Function GetEnumerator (Of T)(reader As IDataReader, generator As Func(Of IDataRecordT)) As IEnumerable(Of T)
        Try
            While (reader.Read())
                Yield generator(reader)
            End While
        Catch ex As Exception
            Debug.WriteLine(ex.Message)
        Finally
            reader.Dispose()
        End Try
End Function

So there you have it - a functional Yield scenario written in VB.NET. Personally I love these patterns as they allow you to write much cleaner and testable code Hope it helps!

Unlocking your Vodafone phone to use with another carrier

This post is mostly relevant to Australians, but the instructions might also work in the UK, or other countries.

I recently had enough of Vodafone Australia's terrible call quality and slow data network. I am often out of the city centre, and the quality of service is such that it my phone was often unusable. I couldn't even make a call from my home office!

I moved over to Telstra, and found that my phone was locked to Vodafone, even though I remember the sales guy saying it wasn't :) If you Google something like 'unlock HTC trophy' you'll find a bunch of sites offering to give you the unlock code for $35 or more. Luckily Vodafone Australia provides this for free for some handsets. So even though we can't use Vodafone to make a decent phone call, kudos for providing the unlock codes. I know some carriers charge for this.

So the unlock issue is easy to fix, and I thought I'd put the instructions up so others can benefit.
By the way, this phone is an HTC Trophy, but this should work on anything Vodafone sell.
  1. On your phone's dialer, type *#06#
  2. Write down the number displayed - you will need the first 15 digits. This is your IMEI number.
  3. Get a Telstra SIM card and activate it while porting your number
  4. Turn off your phone
  5. Remove your Vodafone SIM and insert the new SIM.
  6. Turn on your phone
  7. You will be greeted with a message like: "The SIM card can only be used on specific networks. Contact your customer service centre for the unlock code"
  8. Go to https://unlock.vodafone.com.au/voila/handsetunlock/self-service.html?method=selectService and enter the IMEI number and the Captcha
  9. An Unlock code will be generated and displayed at the top of the following page
  10. Enter this number into the phone and press Enter.
  11. Your phone should be ready to use!
  12. In some cases the new SIM may also be locked. If this is the case you need the PIN and PUK code from your new carrier's Customer Service dept.

Windows 7 Backup fails with I/O Error: 0x8078002A

Long story short, the reason this error occurs in general is because the partition is formatted with a sector size of 4kB. This is not supported in Windows 7, but is in Windows 8.
It is frequently experienced with external drives because people often reformat them before using them. Why? They ship with a whole lot of substandard bundled software which can take GB's of space.

When you reformat the drive with the Windows format and default settings, it will create a partition with a sector size of 4kB. The error with Windows Backup occurs because the System Image backup only supports a sector size of 512 bytes.

So the solution is to delete the partition and reformat with a sector size of 512 bytes.

First of all, you can check your drive's current settings with this command:

fsutil fsinfo ntfsinfo DRIVE_LETTER:


You will see something like this:

Bytes Per Sector  :               4096             <<< this needs to be 512
Bytes Per Physical Sector :       <Not Supported>
Bytes Per Cluster :               4096
Bytes Per FileRecord Segment    : 1024


For Western Digital drives you can use their WD Quick Formatter utility.

For others, you may look for a similar utility on the manufacturers website, or a third party utility. I haven't tried any myself, but I did find PC Disk which may help.

References:

Microsoft ASP.NET 4.0 Chart Resources

I'm working on a project using the ASP.NET 4.0 Chart controls (System.Web.UI.DataVisualization.Charting) at the moment and I thought I'd collect the useful resources here. Like many parts of the .NET Framework, the documentation is not so great, but the information is out there if you know where to look.

  • MSDN - the official documentation resource. You will find this useful at times but it is rather terse.
    • Custom Properties List - many chart types have additional properties which are not directly exposed in the designer. You need to set these in the code-behind, or via the CustomProperties parameter which is available on most Chart elements.
  • ASP.NET 4.0 Chart samples - this is probably the best place to start to learn how to accomplish your specific goals.
  • Numeric formatting - for chart label formatting
  • ASP.Net Chart Forum - some decent examples here
  • Alex Gorev's Blog - 3+ years old but does contain a lot of useful information which is still relevant.
  • StackOverflow - ask a question here if you get stuck!

Adding the HTML 5 Facebook Like Button to Blogger

Facebook Like buttons are a cool feature to add to your blog. They really do work to drive more engaged traffic to your precious posts.

The reason is they are not just a static AddThis/ShareThis type of button. Those things never really worked very well. Facebook's buttons, by contrast, add social proof (or lack thereof) to your posts. They do this by:
  • showing how many people already like the page
  • showing photos of these people
They also provide a very easy way for people to quickly share content with their friends. Since 50% of Facebook's 800 million users log in every day, the chances of someone browsing your blog being already logged in to Facebook is pretty high. If they are logged in, when they see the Like button, they literally need to press it and your blog's title, URL, description, and image is instantly posted to their wall. Within seconds others will see it, and may comment, or click through to your site.

So the bottom line is: leverage the astoundingly lively Facebook ecosystem to get more clicks to your site. More importantly, these clicks are coming with a pre-recommendation from their Facebook friend.

Rules of thumb for Facebook buttons:

  1. Make sure the Like/Share/Send is referencing the actual post URL, not the blog's home URL.
  2. Include them at the end of the post - just after the content - so when people have finished reading, it's the next logical step.
  3. Make them prominent and try to nicely integrate them into your page layout.
  4. Customise:
    1. Choose the word Like/Recommend depending on the context. Like is suitable for most sites, but Recommend might be better for product reviews, music, movies, etc..
    2. Use the light/dark colour theme to best match your site's look.
  5. Use Open Graph tags to maximise the impact of your integration - more about that later.

How to Integrate the HTML 5 Facebook Like Button Into Blogger

In a blogging platform like Wordpress, just use a plugin to insert the Like Button - it's the easiest way. But on Blogger, it's not so simple. Having said that, if you want total control, you can use the instructions below to include the Like Button right in your Wordpress Theme's post.php, category.php, or any other relevant file.

I suggest using the HTML 5 code because it's the most simple to integrate. Most browsers should be able to handle it, and this is increasing each day. In addition, the mobile world is heavily investing in HTML 5 so it helps ensure the button will work on mobile browsers too.

If you really can't use HTML 5, you can use the XFBML option with one extra step, or the Iframe version. Keep in mind the Iframe will be blocked by some user's configurations, and does not support the Send button.
  1. Go to https://developers.facebook.com/apps
  2. Set up an Application for your site. If you are only interested in the Like Button, you really just need the App ID, so don't worry too much about what you enter here unless you actually want to create a proper App related to your site.
  3. Then go to:  https://developers.facebook.com/docs/reference/plugins/like/
  4. Configure the button
  5. Put anything in the url, e.g. http://test.com - we will change this later
  6. Click Get Code
  7. The code will pop up - make sure you are looking at the HTML 5 tab.
  8. At the top, select the Facebook App you just created.
  9. Select everything in the first box and copy it to the clipboard.
  10. Now go into your Blogger Dashboard
  11. In the blog you want to modify, go to Template, then click Edit HTML (I am using the latest Blogger Dashboard, if you can't find this, let me know in the Comments.), then click Proceed.
  12. Click 'Expand Widget Templates'
  13. Add the Javascript Facebook SDK code:
    1. Scroll all the way to the bottom of the HTML window, and paste the Facebook code just above the </html> tag.
    2. Then make a blank line after the <script> tag and before the </script> tag.
    3. After the <script> tag, add:  //<![CDATA[
    4. Before the <script> tag, add:   //]]>
    5. This makes sure the javascript remains intact.
    6. By the way, Blogger will move this code higher up in the template when you save it. I found that it's easy to add it here, then let Blogger do its thing.
  14. Add the Facebook Like button code:
    1. Go back to the Facebook Like Button Developer page and copy the code from the second box.
    2. Search for "<div class='post-footer'>"
    3. Just after this line, paste the Facebook code.
    4. Now we need to edit the URL.
    5. In the code you just pasted, change the data-href attribute to: expr:data-href="data:post.url". The entire line of code should look something like this: <div class="fb-like" expr:data-href="data:post.url" data-send="true" data-width="450" data-show-faces="true"></div>
    6. Copy the line you just edited.
    7. Search again for "<div class='post-footer'>" to find the mobile section of the template, and paste the line in again, after the line with "<div class='post-footer'>".
  15. Click Preview and check how it all looks.
  16. When you are happy with it, click Save Template.
  17. That's it! You may like to change the built in Blogger widgets to remove the Facebook button, as now it's redundant.
Here are some screenshots to help you:
Facebook SDK code at bottom of template

The code for adding the button to the post
That's all you need to do to integrate the button, but we can do a bit more by adding the Open Graph information to the template's meta tags.

Adding Open Graph Information to your Blogger Blog

I don't know much about Open Graph, but I assume it will become more and more used by Facebook. They releases a new version last year, so this shows that they are committed to it.

In relation to the Like Button, it allows you to better control what actually gets posted to the user's wall.

You basically need to add six meta tags. You can generate these on this page and then modify them slightly for blogger. Again these instructions can be pretty easily adapted for use with Wordpress Themes.

Read about how Open Graph works.

On the Facebook page:
  1. Leave Title blank - we will modify this later
  2. Under Type, select Article, or something else if it makes more sense.
  3. URL: leave blank
  4. Image: leave blank unless you have a URL to a logo you want included. If so, paste in the full URL to the image. In Blogger, I don't know of a way to dynamically insert image URLs from a given post, but this is pretty easy in Wordpress.

    I have noticed that if you leave this tag out of your template, Facebook will automatically grab the first image from the post when someone posts it to their wall. So you can just leave it out unless you want to post a specific image.
  5. Site name: leave blank
  6. Admin: leave with the ID already included.
  7. Click Get Tags and copy the output.

Now to your Blogger template:
  1. Again go to Edit Template in Blogger.
  2. Expand Widget Templates
  3. At the top of the HTML box, find the line with the text:  <meta expr:content='data:blog.metaDescription' name='description'/>
  4. Paste the tags you copied under this line.
  5. Now we need to edit them like so:
<meta property="og:title" expr:content="data:blog.pageTitle" />
<meta property="og:type" content="article" />
<meta property="og:url" expr:content="data:blog.url" />
<meta property="og:image" expr:content="http://test.com/image.png" />
<meta property="og:site_name" expr:content="data:blog.title" />
<meta property="fb:admins" content="your user id, e.g. 123456789" />


It's also recommended to add the following tag:

<meta property="og:description" expr:content="data:blog.metaDescription" />

If the tag content is blank, you should not leave them in your template, as it will cause an error.

Now save your template and test your Like Buttons!!

Any questions - please fire away in the comments.

Tags

windows (10) microsoft (9) .net (6) google chrome (5) windows 7 (5) asp.net (4) google (4) google browser (4) development (3) javascript (3) mssql (3) rss (3) sql server (3) wordpress (3) automation (2) blogging (2) css (2) database (2) firefox (2) get all wordpress images (2) gmail (2) google docs (2) intel (2) internet explorer (2) linux (2) linux commands (2) microsoft word (2) mysql (2) netsh (2) network issue (2) proxy (2) seo tips (2) shell (2) sun (2) tfs (2) videos (2) wget (2) windows networking (2) windows vista (2) winhttp (2) .net 3.5 (1) .net 4.5 (1) .net async ctp3 (1) .net framework 4.0 (1) 404 (1) JungleDisk (1) access (1) active directory (1) addons (1) adobe acrobat (1) adobe dlm (1) adobe reader (1) adp (1) adsense (1) adtoll (1) adwords (1) amazon (1) antivirus (1) asp.net 4.0 (1) authentication (1) back links (1) backlinks (1) bacula (1) bash (1) batch files (1) blogger (1) box (1) browser exploits (1) category rss (1) cell phone (1) cell phone comparison (1) charting (1) cheap cell phones (1) cheap laptop upgrades (1) checkout (1) chrome (1) chrome.manifest (1) cloud (1) cloud hosting (1) cloud vps (1) code (1) color chart (1) colour chart (1) conditional formatting (1) config (1) configuration (1) context menu (1) copy (1) corrupt (1) credentials (1) cross-reference (1) database scripts (1) dba scripts (1) debian (1) decrypt (1) delete file windows vista (1) delete files (1) dell (1) dell laptop (1) dell studio (1) dell studio 1537 (1) dhcp (1) directory size (1) div (1) dns (1) document properties (1) dotnet (1) download (1) dreamhost (1) dreamhost coupon (1) dreamhost promo (1) dreamhost promo code (1) drive letter (1) drivers (1) duplicate content (1) editpad pro (1) encrypt (1) encryption (1) error (1) error code (1) excel (1) exception (1) external hard drive (1) facebook (1) faviconize (1) feeds (1) firefox 3 rc1 (1) firefox 3.1 (1) firefox addons (1) firefox tabs (1) firewall (1) firewall script (1) fix (1) fix .net framework (1) foreign keys (1) gmail 2.0 (1) gmail error (1) google chrome 2.0 (1) google chrome dev (1) google chrome exploit (1) google reader (1) google reader tags (1) gtdinbox (1) hard drive (1) hex color (1) hex colour (1) htaccess (1) html (1) html 5 (1) iis6 (1) installation (1) ipod touch (1) ipod touch 2g (1) ipod touch freeze (1) ipod touch magnet case (1) ipod touch magnet case problem (1) ipod touch problem (1) iterator pattern (1) itunes (1) java (1) joomla (1) jquery (1) laptop (1) laptop upgrade (1) laptops (1) latex (1) leeching (1) like button (1) link checker (1) linkbacks (1) linq (1) linqdatasource (1) lost password (1) making money online (1) map drive (1) mega cheap phones (1) microsoft excel (1) microsoft signature (1) microsoft store (1) microsoft web deploy (1) microsoft windows (1) microsoft word 2007 (1) minimize firefox tabs (1) mozy (1) ms word (1) msdeploy (1) msdtc (1) nant (1) netstumbler (1) network path not found (1) network path was not found (1) network problem (1) networking (1) new movies (1) nintendo (1) nirsoft (1) nocheckbrowser (1) number (1) odf (1) odt (1) online backups (1) open source browser (1) openoffice (1) oracle (1) oracle client (1) photoshop (1) phpmyadmin (1) podcast (1) powershell (1) pr checker (1) productivity (1) proxy server (1) proxycfg (1) putty (1) recover (1) registry (1) reinstall windows 7 (1) remote desktop (1) remove (1) repair (1) reset joomla admin password (1) rewrite (1) rsa (1) sandy bridge laptop (1) seagate momentus xt (1) seo tools (1) sequence (1) server monitoring (1) sftp (1) social networks (1) softlayer (1) soulseek (1) spreadsheet (1) spreadsheet formula (1) sql (1) sql scripts (1) sql server management studio (1) sqlclient (1) ssh (1) ssis (1) ssl (1) ssms (1) subst (1) tabmixplus (1) telstra (1) text editor (1) trust (1) unlock cell phone (1) unlock mobile phone (1) upgrade laptop hard drive (1) user management (1) vb.net (1) video download (1) virtual server (1) visual studio (1) vodafone (1) vodafone australia (1) vps (1) vps.net (1) wd external drive (1) web deploy (1) web dev (1) web development (1) web hosting (1) web security (1) webdev (1) webmail (1) webmaster tips (1) western digital (1) wifi networks (1) wii (1) win7 (1) windows 7 backup (1) windows 7 gadgets (1) windows 8 (1) windows 8 antivirus (1) windows error (1) windows live (1) windows live essentials (1) windows live toolbar (1) windows tips (1) windows web development (1) windows xp (1) winxp (1) wireless networks (1) word tips (1) wordpress 2.7 (1) wordpress plugin (1) wp super cache (1) yield (1) youtube download (1) youtube playlist download (1)