How to create a triangle with pure CSS and HTML

This post describes in 3 examples, how you can create a triangle with pure CSS and HTML.

 

clip_image001[4]

 

HTML
<br />
Example 1
<br />
<br />
<div class="example1"></div>
<br />
Example 2
<br />
<br />
<div class="example2"></div>
<br />
Example 3
<br />
<br />
<div class="example3"></div>
CSS
.example1 {
height: 40px;
width: 40px;
border-left: 10px solid blue;
border-right: 10px solid blue;
border-bottom: 10px solid #000000;
border-top: 10px solid #000000;
}
.example2 {
height: 20px;
width: 20px;
border-left: 10px solid blue;
border-right: 10px solid blue;
border-bottom: 10px solid #000000;
border-top: 10px solid #000000;
}
.example3 {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid #2f2f2f;
}

Capture incoming http IIS traffic with fiddler 4 on Windows 10

If you are running an IIS server and you want to capture HTTP traffic send from remote clients, you can add a custom rule in Fiddler.

 

Before you create the custom rule make sure port 8888 is open in de Windows firewall.

Just add an new inbound firewall rule:

 

Open Windows Firewall:

image

 

Click on “Advanced settings”:

image

 

Click on “Inbound Rules” > “New Rule…”:

image

 

Assume your computer has an ip4 address:

 

image

 

Click on “Port”:

 

image

 

Enter “8888” in the “Specific local ports” textbox:

 

image

image

 

image

 

Enter “Port 8888” in the “Name” textbox and click Finish:

image

 

 

Now we are ready to add a custom rule to Fiddler:

image

 

Assuming the ip4 address of the IIS machine = “10.2.200.20” and de site you want to debug run in IIS under port 80, then:

 

In the “OnBeforeRequest” function add:

if (oSession.host.toLowerCase() == "10.2.200.20:8888") oSession.host = "10.2.200.20:80";

 

image

 

Restart fiddler and when you access the website from an other machine by using the 10.2.200.20:8888 address, fiddler should capture the traffic and pass is to the website running on port 80.

Fix: Visual Studio 2013 / 2014–SQL Server 2014 – The term ‘Invoke-Sqlcmd’ is not recognized as the name of a cmdlet

 

Note

When you want to run / edit / debug PowerShell scripts inside Visual Studio 2013 / 2015 you will have to install the “PowerShell Tools for Visual Studio” Visual Studio extension found at: https://visualstudiogallery.msdn.microsoft.com/c9eb3ba8-0c59-4944-9a62-6eee37294597

 

I wanted to run and debug a PowerShell script inside Visual Studio 2013 / 2015, on a machine that only had SQL Server 2014 installed as database server. This threw an exception: The term ‘Invoke-Sqlcmd’ is not recognized as the name of a cmdlet http://blog.sqlauthority.com/2014/11/23/sql-server-fix-the-term-invoke-sqlcmd-is-not-recognized-as-the-name-of-a-cmdlet/

 

Turns out you have to update the PowerShell “PSModulePath”, so it can find the PowerShell modules containing the SQL Server 2014 cmdlets.

 

Temp fix:

http://stackoverflow.com/questions/29562742/invoke-sqlcmd-failing-after-automated-sql-install-with-powershell

Existing Powershell session isn’t aware about Sql’s modules that were just installed. Take a look at environment variable $env:PSModulePath. Compare new shell’s variable to existing and you should see a missing path like …\Microsoft SQL Server\110\Tools\PowerShell\Modules\.
For a work-around, modify the path to include module dir. Like so,

$env:PSModulePath += ";C:\Program Files (x86)\Microsoft SQL Server\120\Tools\PowerShell\Modules"

 

If you want to persist this extra “Module load path”, you have to change the registry:

http://tomtalks.uk/2013/06/powershell-add-a-persistent-module-path-to-envpsmodulepath/

 

image

 

Now I can run and debug the following PowerShell script inside Visual Studio 2013 / 2015:

# This sccript requires the system to allow running powershell scripts, when not allowed the following code can be used to allow running powershell scripts.
# Set-ExecutionPolicy RemoteSigned
# The following import statement enables the SQL Server PowerShell cmdlets, like "Invoke-Sqlcmd".
Import-Module SqlPs
$serverInstance = "(localdb)\v11.0"
$database = "App"
function ExecuteSqlFile {
[string]$file = $args[0]
Invoke-Sqlcmd -ServerInstance $serverInstance -Database $database -InputFile $file
}
ExecuteSqlFile('C:\Temp\test.sql')

drop and create SQL Server tables based on an array with table names by using PowerShell

 

# Add table names to the "$tables" array in the order they should be created.
$tables = @(
"dbo.Person",
"dbo.Settings",
"dbo.SmsStatus",
"dbo.Sms"
)
# Create a table if it does not exist.
# It expects the "create scripts" to be located in a subfolder "Tables".
function CreateTable
{
[string]$table = $args[0]
[string]$file = "{0}\Tables\{1}.sql" -f $PSScriptRoot, $table
Echo("create table {0}" -f $table) 
Invoke-Sqlcmd -ServerInstance "(localdb)\v11.0" -Database "MyDatabase" -InputFile $file
}
# Drop a table if it exists.
function DropTable
{
[string]$table = $args[0]
[string]$query = "if object_id('{0}') is not null begin drop table {0} end" -f $table
Echo("drop table {0}" -f $table) 
Invoke-Sqlcmd -ServerInstance "(localdb)\v11.0" -Database "MyDatabase" -Query $query
}
function DropTables
{
$reverseTable = $tables.Clone()
[array]::Reverse($reverseTable)
foreach ($table in $reverseTable) {
DropTable $table
}    
}
function CreateTables {
foreach ($table in $tables) {
CreateTable $table
}
}
DropTables
CreateTables

Will drop all tables in $tables if they exist and then will create all tables in $tables if they do not exist.

Use formatting–f, when writing to the output console with PowerShell

If you want to format a string when echoing to the screen, use parentheses.

Echo("This is {0} " -f "a test.")

 

Will output:

This is a test.

 

Note

http://stackoverflow.com/questions/17623644/what-is-the-difference-between-echo-and-write-host-in-powershell

echo is an alias for Write-Output, which writes to the Success output stream. This allows output to be processed through pipelines or redirected into files. Write-Host writes directly to the console, so the output can’t be redirected/processed any further.

How to add multiple constraints to one column, when creating a table with T-SQL

 

If you want to add a “named” default and a “named” unique constraint to one column, when creating a table with T-SQL, you can use the “inline syntax”:

 

Here we create a table with a column “Code”, that has a “named” default and a “named” unique constraint:

if object_id('dbo.Product') is null
begin
create table dbo.Product
(
Id int identity(1,1) not null constraint PK_dbo_Product_Id primary key,
Code uniqueidentifier not null constraint UQ_dbo_Product_Code unique(Code)
constraint DF_dbo_Product_Code default newid()
)
end
go