Showing posts with label Picture. Show all posts
Showing posts with label Picture. Show all posts

Wednesday, June 19, 2013

HTTP SSL Certificate for Local IIS Development

Thanks to Rob Bagby's excellent blog post and screencast on Channel9, and to Scott Hanselman's blog post about IIS Express and SSL.

1. Get selfssl.exe (the first link above points to the download location of this tool)

2. Open a command prompt as an administrator and:

C:\system32> cd C:\downloads
C:\downloads>selfssl /N:cn=localhost /V:99999 /S:1

3. Export the newly created certificate using IIS (as described in the first link)

4. Add the certificate to Local Computer (as described in the first link) to make the computer (and web browsers and other services) trust our self-signed cert and avoid getting that SSL warning/error.

Note: for IIS Express you just need to set your project to use SSL on the project's properties window (set the SSL Enabled property to True) and then add the existing IIS Express certificate (the one named IIS Express Development Certificate) to the Local Computer (following the instructions found on the first link above)

Note 2: After you added the IIS Express certificate as indicated above, it can take a little for these changes to take effect; so it's possible that you still get the SSL warning on the web browser. Just wait a little (this happened to me and I thought there was an error with the setup, then a few minutes later it started working).

Note 3: Note 2 is not true --I still get that SSL warning.

Friday, January 18, 2013

Send email PowerShell

Create a script like the following and save it as send_email.ps1.

$from = New-Object System.Net.Mail.MailAddress "from@domain.com" 

$to = New-Object System.Net.Mail.MailAddress "jdoe@gmail.com" 

$messge = new-object system.Net.Mail.MailMessage $from, $to

$messge.IsBodyHTML = $true
$messge.Subject = "Test email to jdoe"
$messge.body = "Lorem ipsum dolor sit amet. Regards."

$smtpServer = 'localhost'
$port = '25'

$smtp = new-object Net.Mail.SmtpClient($smtpServer, $port)

$smtp.Send($messge);

Open PowerShell, go to the directory where the script was saved and execute it.

If you have permissions to execute scripts in Powershell, and the SMTP server is correctly configured, and the recipient email account exists, then you should get the email.

Monday, November 28, 2011

Sunday, August 21, 2011

Create XSD based on XML file

  1. Open Visual Studio Command Propmt
  2. Point to the directory where the xml is located in.
  3. xsd filename.xml
  4. A new .xsd file will be created in the same location.

Friday, June 3, 2011

Javascript Function Objects

Having:

function validateFields() {
// a lot of cool and interesting code goes here.
var a = 1;
var b = 2;
var c = a + b;
}

the following

$('#submit').bind('click', function() {
validateFields();
});

is similar to this:

$('#submit').bind('click', validateFields);

and, to this as well:

$('#submit').bind('click', function() {
var a = 1;
var b = 2;
var c = a + b;
});

So you could say that

function validateFields() {
// a lot of cool and interesting code goes here.
var a = 1;
var b = 2;
var c = a + b;
}

is essentially the same as

var validateFields = function() {
// a lot of cool and interesting code goes here.
var a = 1;
var b = 2;
var c = a + b;
}

i.e. validateFields is not a function/method but an object. Therefore I conclude "Javascript is a different language in disguise."

Monday, March 28, 2011

Friday, March 18, 2011

Powershell Cannot Execute Files

Error:
File C:\folder\script.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.

Fix:

set-executionpolicy remotesigned

Thursday, March 17, 2011

ASPNET State Database

You will need to run the following commands using a db login that has Create Database permission.
(command prompt)

cd C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

aspnet_regsql -S serverName -U myUser -P p4zz#w0rd -ssadd -sstype c -d MyASPState

where

-S server name
-U user (database server login)
-P user's password
-d database name

Sunday, February 13, 2011

Google Search By Site

key words site:lorem.ipsum.com

Example:

Monday, January 24, 2011

Register Cache Host in Cluster - Powershell

After executing Get-CacheHost and our host is not listed in the results:

1. Register the local host in the cluster using:
> Register-CacheHost
// Then provide System.Data.SqlClient and the connection string for the AppFabric cache cluster configuration DB
2. Execute Get-CacheHost and will see our host is now listed (as DOWN)
3. Execute Start-CacheHost (or start the AppFabric service in the service.msc console)
4. Execute Get-CacheHost again and will see our host as UP







Monday, January 3, 2011

Query Tables Size

From http://goo.gl/dF6Cv
and http://goo.gl/jxTTa


CREATE TABLE #TempTable
(
tableName varchar(100),
numberofRows varchar(100),
reservedSize varchar(50),
dataSize varchar(50),
indexSize varchar(50),
unusedSize varchar(50)
)

INSERT INTO #TempTable
EXEC sp_MSforeachtable @command1="EXEC sp_spaceused '?'"

SELECT *, cast(cast(replace(reservedSize, ' KB', '') as int)/1024 as varchar) + ' MB' AS Size
FROM #TempTable
ORDER BY cast(replace(reservedSize, ' KB', '') as int) DESC

Result:

Friday, December 24, 2010

Open Port Windows 7

As an Administrator:
Windows Firewall with Advanced Security -> Inbound Rules -> New Rules -> Port -> Complete Wizard

Sunday, December 19, 2010

Install .NET Windows Service - installutil

1. Open the visual studio 2008 command prompt (or the 2010 version) as an administrator
2. Change to the directory where the binaries are deployed
3. Execute the following: installutil MyService.exe

> cd C:\Projects\Builds\MyService
> installutil MyService.exe
> exit

2.- Second Approach

1. open a command prompt as administrator
2. change to the .NET Framwork 2.0 directory
3. execute installutil specifying the full service path

> cd C:\Windows\Microsoft.NET\Framework64\v2.0.50727
> installutil C:\Projects\Builds\MyService\MyService.exe
> exit

If everything was ok, the service is installed and available in the service manager (service.msc)



Tuesday, October 26, 2010

FILESTREAM feature doesn't have file system access enabled.

Run this:


sp_configure 'filestream access level',2


and then this:


RECONFIGURE WITH OVERRIDE


in the database in question (not in the master db)

I also enable these two options as well (but don't know if they have to be enabled):



Source: http://blogs.msdn.com/b/chrissk/archive/2009/02/08/example-using-transactional-replication-with-filestreams-in-sql-2008.aspx

Tuesday, October 12, 2010

jeditable maxlength

In jquery.jeditable.js add:
if (settings.maxlength) { input.attr('maxlength', settings.maxlength); }

right below:
if (settings.height != 'none') { input.height(settings.height); }



Then set maxlength
$('.loremipsum').editable('http://www.example.com/save.php', {
    ...
    maxlength: 20
});

reference: http://www.appelsiini.net/projects/jeditable (user Sasi's comment)

Thursday, October 7, 2010

FILESTREAM feature is disabled

Msg 5591, Level 16, State 1, Line 2
FILESTREAM feature is disabled.

In SQL Server Configuration Manager

Wednesday, October 6, 2010

The subscription(s) have been marked inactive and must be reinitialized

The subscription(s) have been marked inactive and must be reinitialized. NoSync subscriptions will need to be dropped and recreated. (Source: MSSQLServer, Error number: 21074)

At publisher:

use distribution
go

update MSSubscriptions set [status] = 2

To review pending commands to replicate. At plusblisher:

use distribution
go

exec sp_browsereplcmds