Download File with a PowerShell One-Liner

December 11th, 2011 No comments

I was recently trying to automate some scripts on a linux box and I wanted to know if it was as simple to download a file in PowerShell as it is in linux: wget http://example.com/file.jpg

Well as it turned out, it wasn’t, but it wasn’t that difficult either. What we needed was too use the System.Net.WebClient class. There’s one thing to note, in PowerShell you can’t use a ~ (tilde) to reference your home directly, that is to say, you can’t download a file to ~\Desktop you will need to specify the full path, in my case C:\Users\Brangle\Desktop. Read more…

Make PowerShell Talk / Speak

December 9th, 2011 No comments

Have you ever run a long PowerShell script, minimized it, only to realize much later that an error caused it to stop? Rather than just using a color syntax red to display the error,  I wanted to hear it so I could switch back to the PowerShell window and see the error.

So how easy is it to make PowerShell speak? It’s almost identical to the .NET code I have in VB.net and C# on Make Your Computer Talk with VB.NET Application (and Source Code) using the SAPI.SpVoice class. Read more…

Hulu Referral Coupon Code (2 Free Weeks)

December 7th, 2010 No comments

Hulu has recently come out with their new Hulu Plus service and is offering 2 free weeks of service using the following referral coupon code: http://hulu.com/r/t4qESA

Categories: Uncategorized Tags:

Mapping Amazon AWS S3 to a Custom Domain Name

November 7th, 2010 2 comments

According to Amazon’s Developer Guide you can setup Virtual Hosting of your files by adding a CNAME in your DNS server. I’ve sinced mapped a subdomain s3.brangle.com to Amazon’s S3 cloud.

The way I did this was to create a CNAME entry on my DNS server mapping
s3.brangle.com to s3.brangle.com.s3.amazonaws.com.
and yes, that is a period at the end of s3.brangle.com.s3.amazonaws.com. Now just creating the CNAME entry only redirects users to Amazon S3, Amazon needs to know which bucket to use. The name of the bucket needs to be the fully qualified domain name (FQN) that you are using. So in my example, my bucket name is s3.brangle.com.

In general, if you want to create subdomain.domain.com then your bucket will have to be named subdomain.domain.com. I was under the impression that I could create s3.brangle.com and name the bucket whatever I wanted with a

According to Amazon Web Services

Customizing Amazon S3 URLs with CNAMEs

Depending on your needs, you might not want “s3.amazonaws.com” to appear on your web site or service. For example, if you host your web site’s images on Amazon S3, you might prefer http://images.johnsmith.net/ as opposed to http://johnsmith-images.s3.amazonaws.com/.

The bucket name must be the same as the CNAME. So http://images.johnsmith.net/filename would be the same as http://images.johnsmith.net.s3.amazonaws.com/filename if a CNAME were created to map images.johnsmith.net to images.johnsmith.net.s3.amazonaws.com.

Any bucket with a DNS compatible name may be referenced as follows: http://[BucketName].s3.amazonaws.com/[Filename], for example, http://images.johnsmith.net.s3.amazonaws.com/mydog.jpg. Using CNAME you can map images.johnsmith.net to an Amazon S3 host name so the previous URL could become: http://images.johnsmith.net/mydog.jpg.

The CNAME DNS record should alias your domain name to the appropriate virtual hosted style host name. For example, if your bucket name (and domain name) is images.johnsmith.net, the CNAME record should alias to images.johnsmith.net.s3.amazonaws.com.

**Edit 13 Dec 2011 – Updated AWS developer guide link

Categories: Amazon S3 Tags: , , ,

How To Use the OpenFileDialog Box in VB.NET

September 7th, 2009 2 comments

Using the OpenFileDialog box wasn’t as intuitive as I initially expected, I was thinking I could just drag it out onto my form as a button and place it right where I wanted to. But when I clicked on it from toolbox it just went into the bottom frame of my application, but not on my form like I was hoping for. Below I is an example of a dynamically (aka created at run) created OpenFileDialog. Because it’s dynamically created when don’t have to drag it out to form, it’s created by the code, not from the GUI. Read more…

Categories: VB.NET Tags: , ,

How to Use the Progress Bar in VB.NET and C#

August 31st, 2009 2 comments

The progress bar is one of those universal objects that everyone recognizes, it’s useful when doing a large or long task. For example, if your updating/deleting/copying a bunch of files you can update the progress bar as you modify each file. Read more…

Categories: C#, Uncategorized, VB.NET Tags: , , ,

How to Center A Form in VB.NET and C#

August 30th, 2009 1 comment

I’ve often found it necessary to center a form on my screen using the pure code, but it’s not as easy as Me.center in Visual Basic or this.center() in C# so I wrote some code to work around that. Using the code below you can center you application on your monitor in just 3 lines of code using either VB.NET or C#. Read more…

Categories: C#, VB.NET Tags: , , ,

How to Cut/Copy/Paste into the Clipboard using VB.NET

August 30th, 2009 5 comments

In this example, I’ll show you how to cut, copy, paste and clear text in the clipboard. Cutting and copying text is really straight forward, pasting text requires just a little bit of checking. For example, we want to check to see what the clipboard contains before we try and do something like pasting an image into a text box. Read more…

Categories: VB.NET Tags: , , ,

Make Your Computer Talk with VB.NET Application (and Source Code)

August 29th, 2009 20 comments

I was playing around with COM objects in Windows and discovered that I could access the SAPI.SpVoice interface and make Microsoft Windows talk to me. Well needless to say I had to rush and develop and application to do just that. I uploaded a simple applicaton which will just say whatever you type in as an argument. For example SpeakToMeConsole.exe Hello World will make your computer speak the words “Hello World.” The part that really amazes me is that the guts of this program is only 2 lines long, and it can even that can reduced down to 1 line if we create an anonymous instance of SAPI.SpVoice object. Read more…

Categories: VB.NET Tags: , , , , ,

Humor: Tech Support Cheat Sheat

August 27th, 2009 No comments

Hilarious tech support cheat sheet… Read more…

Categories: Uncategorized Tags: