Check if URL exists, is so then return true

Hi everyone, I'm hoping someone can help with this function. it will check if a URL exists. If it does, would like it to return true and if it does not, then false.

Function Test_URLExists()
  Dim url As String
  url = ""
  MsgBox url, vbInformation, URLExists(url)
  url = ""
  MsgBox url, vbInformation, URLExists(url)
End Function

Function URLExists(url As String) As Boolean
    Dim Request As Object
    Dim ff As Integer
    Dim rc As Variant
    On Error GoTo EndNow
    Set Request = CreateObject("WinHttp.WinHttpRequest.5.1")
    With Request
      .Open "GET", url, False
      rc = .StatusText
    End With
    Set Request = Nothing
    If rc = "OK" Then URLExists = True
    Exit Function
End Function

Happy coding!

How To Enable SQL Full Text Indexing

The following steps will tell you if your database version supports full text searching and if so how to enable it.

  1. Open SQL server management console
  2. Right click on the database and select properties
  3. On the left select files
  4. If “Full-Text Indexing” is greyed out it means that full-text indexing is not enabled.
    NOTE: If you are using SQL Server 2012 Please see the SQL Server 2012 notes at the bottom of this article.

How to enable Full Text Searching

  1. Click on the New Query button top left of the screen and make sure the database is selected from the drop down list below the button.
  2. This query will tell if Full Text Search is enabled:

    then click the Execute button

  3. If you get a 1 in the results window Full Text Search is already enabled.
  4. If the result is null, you may have the database name incorrect.
  5. If the result is zero, Full Text Search can be enabled by running these queries:
    exec sp_fulltext_database 'enable'
  6. Now run this again:

If you get a one, that shows that Full Text Search is now enabled. If the response is still 0, then your installation of SQL Server cannot enable Full Text Search. Some reasons for this include:

  • You may need to change the install of SQL Server to include Full Text Search
  • Your SQL Server edition does not support Full Text Search.

You will need to ensure that any installation of SQL Server has Full Text Search enabled, standard and enterprise editions have this by default however express editions need the advanced services version to be installed. SQL Express Web Edition does not support Full Text Search at all.

Index The Tables

Once Full Text Search has been enabled you need to the build the indexes that will be used to return results of your search query.

The following will show you how to enable this and only need to be done once:

  1. Open the MS SQL Server Management Studio and login
  2. Expand the databases folder
  3. Expand the database
  4. Expand the Storage folder
  5. Right Click on Full Text Catalogs and select New Full-Text Catalog
  6. Provide the name as database_fullcatalog then click OK
  7. Right Click on Full Text Catalogs and select Refresh and you new catalog should appear

Define The Indexed Data


Once you have created the catalogs they need to be told what data to index:

  1. Right click on the database_fullcatalog catalog and select properties
  2. Click on Tables/Views
  3. From the table list on the left select a table and move it to the right
  4. from the list of columns tick the columns you want in the full catalog
  5. Click Ok

The catalogs will auto rebuild each time any of the data changes for the selected columns.

Another way is from the table design. Right click and select Fulltext index. Here you can choose the columns for this table.


SQL Server 2012 Notes

It appears that there is a bug in SQL Server 2012 SP1 where the server will report that Full Text Search is not supported in this edition of SQL Server when it clearly is. The workaround is to create the initial catalog by using a query:

CREATE FULLTEXT CATALOG database_fulltext;

Run each query seperatly against the database then you can follow the “Define The Indexed Data” section.

This bug is supposed to be fixed within the SP2 timeframe according to Microsoft.

Microsoft reveals some interesting stats about apps, Office, and french fries


Microsoft has released some interesting stats on its "Microsoft by the Numbers" website, which showcases the growth of the Windows platform as well as other products and services offered by the company.

The website has also highlighted several milestones and achievements accomplished by the company which include:

  • Office has been downloaded more than 100 million times on iPhones, iPads and Android devices.
  • 80% of the Fortune 500 is on the Microsoft cloud.
  • More than 75 million devices are running Windows 10.
  • Skype Translator can translate voice calls in 6 different languages.
  • Microsoft Surface Hub collaboration devices are integrated with optically bonded displays capable of detecting 100 points of multi-touch and up to three simultaneous pen inputs.
  • Microsoft employees in Redmond, Washington eat about 984,000 orders of French fries each year in campus cafeterias.

Many more intriguing facts have been listed as well which includes that there are now 669,000 apps in the Windows Store. The company also states that there are now 48 million Xbox Live users in 42 countries and that has more than 400 million active users. More than 1.2 billion people use Microsoft Office which equates to one in every seven people on the Earth.

The Redmond giant has also highlighted prominent individuals linked to the company such as Stephen Alvarez, who has endeavored to snap photos of all the Seven Natural Wonders of the World using only Microsoft-made smartphones. Rudy Huyn has been mentioned as one of the "platform's most prolific developers" as his apps have been downloaded over 16 million times. There are several more interesting facts listed on the company's website which you can view by visiting the source link.

How to remove HTML tags from data with SQL

The purpose of this article is to provide a way of cleaning up of HTML tags within the data. When we use various styles or tabular format data in UI using Rich Text Editor/ Rad Grid etc, it will save data in database with HTML tags.

When you save in database this kind of field you have:

An HTML element starts with a start tag (<p>) and ends with end tag (<p/>) and everything between Start tag and End tag is HTML element. e.g.

<b>Following are the popular databases: <br /> </b>1. SQL Server <br /> 2. Oracle <br /> 3.
Teradata <br /> 4. Sybase

We are using SQL Server CHARINDEX function to get the positions of ‘<’ and ‘>’ and once found replacing the string between <….> with blank using STUFF function. We are using WHILE Loop that will run till presence of ‘<’ & ‘>’ in the string. Below is the UDF script that performs HTML Tags clean up from data.



CREATE FUNCTION [dbo].[usp_ClearHTMLTags]  
    (@String NVARCHAR(MAX))  

        DECLARE @Start INT,  
                @End INT,  
                @Length INT  

        WHILE CHARINDEX('<', @String) > 0 AND CHARINDEX('>', @String, CHARINDEX('<', @String)) > 0  
            SELECT  @Start  = CHARINDEX('<', @String),   
                    @End    = CHARINDEX('>', @String, CHARINDEX('<', @String))  
            SELECT @Length = (@End - @Start) + 1  

            IF @Length > 0  
                SELECT @String = STUFF(@String, @Start, @Length, '')  
        RETURN @String  

By using above UDF, We can clean the HTML tags from the data.

SQL SERVER – Find Current Location of Data and Log File of All the Database

As I am doing lots of experiments on my SQL Server test box, I sometime gets too many files in SQL Server data installation folder – the place where I have all the .mdf and .ldf files are stored. I often go to that folder and clean up all unnecessary files I have left there taking up my hard drive space. 

I run following query to find out which .mdf and .ldf files are used and delete all other files. If your SQL Server is up and running OS will not let you delete .mdf and .ldf files any way giving you error that file already in use. This list also helps sometime to do documentation of which files are in being used by which database.

SELECT name, physical_name AS current_file_location
FROM sys.master_files

Following is the output of files used by my SQL Server instance.

How to strip all HTML tags and entities and get clear text?

I was encouraged to write this Tip/Trick because of so many questions received for this issue.
Suppose you're having a bunch of HTML strings, but you just want to remove all the HTML tags and want a plain text.

You can use Regex to come to the rescue.

The Regex I had developed before was more cumbersome, then Chris made a suggestion, so I will now go further with the regex suggested by Chris that is a "\<[^\>]*\>".

I have tested it for many cases. It detects all types of HTML tags, but there may be loopholes inside so if you find any tags which are not passing through this Regex, then kindly inform me about the same.

Regex Definition

  • Regex :\<[^\>]*\>
    • Literal >
    • Any character that NOT in this class:[\>], any number of repetations
    • Literal >

Visual Basic

''' Remove HTML from string with Regex
Function StripTags(ByVal html As String) As String
    ' Remove HTML tags.
    Return Regex.Replace(html, "<.*?>", "")
End Function


/// Remove HTML from string with Regex
public static string StripTags(string source)
    return Regex.Replace(source, "<.*?>", string.Empty);

Happy coding!

UWA Message Dialog

To show a Message Dialog in Windows 10 (Universal Windows App) you have to use Windows.UI.Popups

using Windows.UI.Popups;

After you can create a basic dialog like this:

// Create the message dialog and set its content; it will get a default "Close" button since there aren't any other buttons being added
var messageDialog = new MessageDialog("You've exceeded your trial period.");

// Show the message dialog and wait
var res = messageDialog.ShowAsync();

If you want to customize your button, you can use another way:

/// Click handler for the 'CancelCommandButton' button.
/// Demonstrates setting the command to be invoked when the 'escape' key is pressed.
/// Also demonstrates retrieval of the label of the chosen command and setting a callback to a function.
/// A message will be displayed indicating which command was invoked.
/// In this scenario, 'Try again' is selected as the default choice, and the 'escape' key will invoke the command named 'Close'
private async void CancelCommandButton_Click()
	// Create the message dialog and set its content
        var messageDialog = new MessageDialog("No internet connection has been found.");

	// Add commands and set their callbacks; both buttons use the same callback function instead of inline event handlers
	messageDialog.Commands.Add(new UICommand("Try again", new UICommandInvokedHandler(this.CommandInvokedHandler)));
	messageDialog.Commands.Add(new UICommand("Close", new UICommandInvokedHandler(this.CommandInvokedHandler)));

	// Set the command that will be invoked by default
	messageDialog.DefaultCommandIndex = 0;

        // Set the command to be invoked when escape is pressed
        messageDialog.CancelCommandIndex = 1;

        // Show the message dialog
        await messageDialog.ShowAsync();

#region Commands
/// Callback function for the invocation of the dialog commands.
/// The command that was invoked.
private void CommandInvokedHandler(IUICommand command)
	// Display message showing the label of the command that was invoked
        Debug.WriteLine("The '" + command.Label + "' command has been selected.");

Using SQLite in Windows 10 Universal apps

Using SQLite in Windows 10 Universal apps is really easy even in this preview phase. Even though Entity Framework 7 support for Windows 10 Universal apps is almost here, you still might decide to just continue using a lighter SQLite.Net-PCL library that you're used to since Windows Phone 8/WinRT.

If you are using Visual Studio 2015 RTM and 10240 SDK, there's now the official (no more pre-release stuff) SQLite VSIX package that you can download from Search for "Universal App Platform" and you're good to go! The rest of the blog post should apply to this version as well.


The next step is to add the SQLite.Net-PCL library that I already mentioned. Use the (redesigned) NuGet to do that.


It will add two references

  • SQLite.Net
  • SQLite.Net.Platform.WinRT

Now, remember the VSIX package (Visual Studio extension) installed earlier? It installs SQLite extensions that you need to reference by simply right-clicking on References and choosing "Add Reference..." and then finding the right reference under Windows Universal -> Extensions.


And that's it! You can start using SQLite!

To test it, I defined a simple model class called User.

public class User  
    public int Id { get; set; }
    public string Name { get; set; }

And then I created a table which will hold User entities.

var path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "db.sqlite");
using (SQLite.Net.SQLiteConnection conn = 
       new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path))  

Adding SQLite support to Windows 10 Universal apps is really simple! After all of the extensions are added, and the ORM/client library fetched over NuGet, the usage is the same as before. This is really neat for simpler scenarios and until Entity Framework 7 officially, fully supports Windows 10 Universal apps.

Microsoft is downloading Windows 10 to your machine 'just in case'

MICROSOFT HAS CONFIRMED that Windows 10 is being downloaded to computers whether or not users have opted in.

An INQUIRER reader pointed out to us that, despite not having 'reserved' a copy of Windows 10, he had found that the ~BT folder, which has been the home of images of the new operating system since before rollout began, had appeared on his system. He had no plans to upgrade and had not put in a reservation request.

He told us: "The symptoms are repeated failed 'Upgrade to Windows 10' in the WU update history and a huge 3.5GB to 6GB hidden folder labelled '$Windows.~BT'. I thought Microsoft [said] this 'upgrade' was optional. If so, why is it being pushed out to so many computers where it wasn't reserved, and why does it try to install over and over again?

"I know of two instances where people on metered connections went over their data cap for August because of this unwanted download. My own internet (slow DSL) was crawling for a week or so until I discovered this problem. In fact, that's what led me to it. Not only does it download, it tries to install every time the computer is booted."

We asked Microsoft to comment on whether it was downloading Windows 10 anyway as the company rushes to build on the 75 million machines with the new OS installed in its first month, putting it in fourth place behind Window 7, 8.1 and the erstwhile XP.

Microsoft told us: "For individuals who have chosen to receive automatic updates through Windows Update, we help upgradable devices get ready for Windows 10 by downloading the files they’ll need if they decide to upgrade.

"When the upgrade is ready, the customer will be prompted to install Windows 10 on the device.”

Microsoft Announces Office 2016 Will Arrive September 22


Microsoft announced this morning the official launch date for the long-anticipated new version of Microsoft Office: Office 2016 will be broadly available starting on September 22, the company says. Meanwhile, Office Customers with volume licensing agreements will be able to download the software on October 1st.

The updated version of Office includes a number of new features for desktop customers, including the ability to co-edit documents at the same time, sync files to OneDrive in the cloud, and more.

Alongside the announcement of the launch date, Microsoft noted a few other new features and options for I.T. admins and businesses looking to deploy the software.

For starters, the company noted that Office 365 ProPlus customers who are paying for the subscription version of Office for companies, will also receive the “Current Branch” – meaning the most up-to-date feature release and security updates – on September 22. This release will also include the new Office 2106 app updates.

But based customer feedback, Microsoft says it’s introducing a new update model called “Current Branch for Business” which will offer three cumulative feature updates per year, while continuing to offer monthly security updates. This is designed for organizations that want to test new releases of Office 2016 before rolling out the new features, a Microsoft blog post explains.

The company says it’s also addressing other Office 365 ProPlus I.T. requests with this release, including deployment through Background Intelligent Transfer Service (BITS) to help control network traffic when deploying updates, as well as the introduction of new reports on Office activation and usage. Plus, Office 2016 is getting support for Data Loss Prevention, Multi-factor Authentication and more.

Microsoft is continuing to embrace a cross-platform approach with its new Office software. Office 2016 for Mac was previously released in July, initially to Office365 subscribers. At the time, the company said that the standalone version would not arrive until September, which offered a hint that the Office 2106 launch would arrive this month.

In addition, news of the September Office 2016 launch follows the company’s announcement from yesterday that Microsoft has developed new features for Word, Excel, PowerPoint, OneNote, Outlook and Translator which are designed to take advantage of enhancements on Apple’s new iPad Pro, new mobile OS iOS 9, and its Watch software, watchOS 2.0. Specifically, the company is updating Office with support for things like Apple Pencil, Slide Over and Split View multi-tasking, among other things.



Planet Xamarin

Planet Xamarin