Robot.txt file must be ANSI

For some reason I was not able to verify robot.txt files in Google Webmaster. It turned out that setting the encoding of the text file to ANSI, solved this problem.

 

The best place for Jquery in your website/ web application

Open your master page file and put references like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html>

<head id="Head1" runat="server">
<title></title>
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="~/..../....css" runat="server" id="screen"/>

<asp:PlaceHolder ID="PlaceHolder1" runat="server">
</asp:PlaceHolder>

<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.0.3.min.js"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery.ui/1.11.2/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" />
<script>
    // Fallback to loading jQuery from a local path if the CDN is unavailable
    (window.jQuery || document.write('<script src="/scripts/jquery-2.0.3.min.js"><\/script>'));
</script>

AntiXSS functies nu in .NET 4.5

Automatisch alle data in een webpagina encoderen kan door de nieuwe anti-XSS routines in te laden in je web.config file. Daarna is in je webapplicatie data ge-encodeerd:

 <meta name="copyright" content="Copyright&#32;2014&#32;hetmerk" />

Web.config:

<httpRuntime requestValidationMode="2.0" targetFramework="2.0" 
encoderType="System.Web.Security.AntiXss.AntiXssEncoder, System.Web, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" executionTimeout="30"
maxRequestLength="4096000" useFullyQualifiedRedirectUrl="false" minFreeThreads="8"
minLocalRequestFreeThreads="4" appRequestQueueLimit="40"/>

How to make a widget for Blogengine.net 2.0

  1. Make a Web User Control in Visual Studio the way you always do. If you never made a user control, try to learn how to make one first before you continue.
  2. Go to the folder widgets and copy a folder. For this example we copy the Calendar folder.
  3. Rename te folder to something new. For example Calendar2

  4. In the widget.ascx.cs file, put the foldername here (it must be exactly written as the name of the folder ----> Calendar2):

  5. In the widget.ascx file, rename the Inerits part to Calendar2 and the namespace in the widget.ascx.cs file to namespace Widgets.Calendar2:





  6.  Now try to load the new widget. The advantage is that you can see errors later on.

  7. After this step, you are almost there. Find #region Public Methods in widget.ascx.cs: 


    public override void LoadWidget()
    {
    //PLACE YOUR ASCX code (webuser control code, page load part) HERE. 


  8.  Copy and paste the classes in your code from your ascx (web control) file:



  9. Now your widget should work! Here the empty code to get started:

widget.ascx

 

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="widget.ascx.cs" Inherits="Widgets.Calendar2.Widget" %>

<%@ Import Namespace="BlogEngine.Core" %>

<div style="text-align: center">

////////////YOUR CODE HERE/////////////

</div>

 

widget.ascx.cs

 

using ////////////YOUR CODE HERE/////////////

using App_Code.Controls;

namespace Widgets.Calendar2

{

    public partial class Widget : WidgetBase

    {

        #region Properties

        public override bool IsEditable

        {

            get

            {

                return false;

            }

        }

        public override string Name

        {

            get

            {

                return "////////////YOUR FOLDERNAME HERE/////////////";

            }

        }

        #endregion

        #region Public Methods

        public override void LoadWidget()

        {

 ////////////YOUR CODE HERE/////////////

 }

        #endregion

    }

}

How to find the IP numbers of your VM's in Hyper-V CORE

I don't know why but I always seem to forget the IP numbers of the VM machines I run in Hyper-V. The PowerShell Management Library for Hyper-V at http://pshyperv.codeplex.com does not include a script to do this so you have to use a script of yourself.

To find out specific information about the ip address of a VM, I am using the following script I found at http://luka.manojlovic.net/category/ms-scripting/powershell/

 

 

$vm = "!!!NAMEOFYOURVM!!!";

filter Import-CimXml

{

    $CimXml = [Xml]$_

    $CimObj = New-Object -TypeName System.Object

    foreach ($CimProperty in $CimXml.SelectNodes("/INSTANCE/PROPERTY"))

    {

 if ($CimProperty.Name -eq "Name" -or $CimProperty.Name -eq "Data")

 {

         $CimObj | Add-Member -MemberType NoteProperty -Name $CimProperty.NAME -Value $CimProperty.VALUE

 }

    }

    $CimObj

}

$VmObj = Get-WmiObject -Namespace root\virtualization -Query "Select * From Msvm_ComputerSystem Where ElementName='$vm'"

$KvpObj = Get-WmiObject -Namespace root\virtualization -Query "Associators of {$VmObj} Where AssocClass=Msvm_SystemDevice ResultClass=Msvm_KvpExchangeComponent"

$KvpObj.GuestIntrinsicExchangeItems | Import-CimXml

 

 

In Hyper-V Core open notepad by typing notepad in the shell. After that copy and paste the following code into the notepad window and safe your file as (example): C:\ip.ps1

To run this powershell script, cd to C:\ and the type in Powershell: C:\> .\ip.ps1

How to manage a Hyper-V core with powershell on the Hyper-V machine

Virtual computers have always impressed me. Back in the days I had an Amiga 1200 with a Blizzard 1230VI expansion card. I emulated a Macintosh on this computer. Nowadays I have a Macbook and a copy of Windows Server 2003 Web Edition on it (VMware Fusion 2.0). I also have a bootcamp partition on which Hyper-V Core is installed. On this Hyper-V core a copy of Server 2008 WEB is installed. The only free option to manage the Hyper-V Core is using a MMC plugin in Windows Vista or Server 2008 server edition. I am using Powershell on the Hyper-V server. To use the powershell you must have a RDC with the Hyper-V machine.

Powershell

I experimented a lot with Powershell lately. I read somewhere that notepad can be run from the Hyper-V core. Woow, I thought, that is great, that solves the problem I had to get PS1 (Powershell) files on the Hyper-V core. I used a USB stick in the past, but that was very unhandy. The possibility to run notepad makes it possible to copy scripts from the clipboard of my Macbook, and paste them in a notepad document on the Hyper-V Core. In that way I am able to safe them in the C: drive of the Hyper-V core. And voila, then I will be able to execute these PS1 scripts from the Powershell!

notepad

The first script I run was a script to shutdown and boot the Windows 2008 Web edition from Hyper-V. I used the scripts on this website:

http://community.spiceworks.com/how_to/show/1793

And it worked! :-)

So, that was the first step. To make life easier, I wanted to install on the hyper-V server the PowerShell Management Library for Hyper-V at http://pshyperv.codeplex.com/.

I unzipped the files in a directory on the C drive. To use the library you have to install it. You need to re-install after rebooting the Hyper-V machine.

PS: C:\dir_with_library> .\install.cmd

To get the files on the Hyper-V server, I connect the Hyper-V server to a share on the Windows 2008 server. In this share the files are available that can be downloaded from http://pshyperv.codeplex.com.

To set up a share in the Windows 2008 server, you go to computer management and there is an option for adding shares. After setting up this share, I connect the Hyper-V server to this share with the following command in Powershell:

$net = new-object -ComObject WScript.Network
$net.MapNetworkDrive("u:", "\\server\share", $false, "domain\user", "password")

 

After this, you are able to install the files from this new share U:\.

 

With this library installed, it is possible to do all kind of things. For example find the path of the virtual images, export virtual images, take snapshots, etc.:

Finding a VM
Get-VM, Choose-VM , Get-VMHost

Connecting to a VM
New-VMConnectSession

Discovering and manipulating Machine states
Get-VMState , Set-VMState , Convert-VmState, 
Ping-VM , Test-VMHeartBeat, Shutdown-VM , Start-VM, Stop-VM, Suspend-VM
Get-VMKVP, Add-KVP, Remove-KVP, Get-VMJPEG

Backing up, exporting and snapshotting VMs
Export-VM , Import-VM, Get-VMSnapshot, Choose-VMSnapshot , Apply-VMSnapshot , New-VMSnapshot ,Remove-VMSnapshot, Rename-VMSnapShot, Update-VMSnapshot, Get-VMSnapshotTree, Get-VmBackupScript

Adding and removing VMs, configuring motherboard settings.
New-VM , Remove-VM , Set-VM , Get-VMCPUCount, Set-VMCPUCount, Get-VMMemory, Set-VMMemory, Set-VMSerialPort

Manipulating Disk controllers, drives and disk images
Get-VMDiskController
Add-VMSCSIController , Remove-VMSCSIcontroller
Get-VMDriveByController , Add-VMDRIVE , Remove-VMdrive
Get-VMDiskByDrive, Add-VMDISK , Set-VMDisk, Get-VMDisk
Get-VMFloppyDisk , Add-VMFloppyDisk
Add-VMNewHardDisk

Manipluating Network Interface Cards
Get-VMNic , List-VMNic , Choose-VMNIC, Add-VMNIC, Remove-VMNIC , Set-VMNICAddress , Set-VMNICConnection , Get-VMNicport , 
Get-VMnicSwitch, Choose-VMSwitch, New-VMSwitchPort, Get-VMByMACaddress, Choose-VMExternalEthernet,
New-VMExternalSwitch, New-VMInternalSwitch,New-VmPrivateSwitch

Working with VHD files
Get-VHDDefaultPath, Get-VHDInfo, New-VHD, Compact-VHD, Test-VHD,Convert-VHD,Merge-VHD,Mount-VHD, Unmount-VHD

Exporting a virtual machine VHD file to my Macbook

It would be great to be able to store a backup of a virtual machine running in Hyper-V on my Macbook. Then it will be able to run this VHD in Mac Fusion or I can import it in another Hyper-V core machine.

First I needed to do the export job:

PS C:\> export-vm VM c:\ -CopyState -Force

This created the VHD in the C:\ directory. -CopyState is required to copy the VHD to C:\

To see the progess type (please note that the InstanceID is between '':

PS C:\> Test-wmiJob '\\MS_HYPER-V\root\virtualization:Msvm_ConcreteJob.InstanceID="91321CDB-9AF7-49AF-BB08-E08EAB03BC11"'

When ready, it is time to get the file on the Macbook. To do this I shared a drive in MacosX with SMB and added the user that has access to the Hyper-V core. Done!

Happy computing!

Server Shortcuts that are handy

Search with CMD for a file

dir /s \. |find "text"

 

Find computerdetails on LAN from PowerShell

Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE -ComputerName HP380

Find responsetimes from websites:

"127.0.0.1","localhost","research.microsoft.com" | ForEach-Object -Process {Get-WmiObject -Class Win32_PingStatus -Filter ("Address='" + $_ + "'") -ComputerName .} | Select-Object -Property Address,ResponseTime,StatusCode

Find drives attached:

GET-PSDrive

Get-PSDrive | Format-List

Ideal betalingen aanbieden via de betaalomgeving van Ogone

Om Ideal betalingen via Ogone te kunnen ontvangen, dien je een contract af te sluiten met je bank. Na goedkeuring krijg je dan een nummer dat je in moet voeren in de beheeromgeving van Ogone. De aanvraag van Ideal bij in dit geval de ABN Amro bank kun je doen via:

https://www.abnamro.nl/nl/zakelijk/betalingsverkeer/internetkassa/f_aanvragen.html

Bij de vraag "Welk internet kassamodel en/of welke betaalmethode wilt u aanvragen?" dien je iDEAL Payment Service Provider te kiezen (de iDEAL Payment Service Provider is Ogone).

Van de bank krijg je een aantal documenten tav de Ideal implementatie die ondertekend moeten worden nadat je via internet Ideal hebt aangevraagd. De meeste documenten, op 1 document na, spreken voor zich. Dit document zie je in het plaatje.

Bij 1.2 in het contract dien je geen enkele optie aan te vinken.

difference class and structure

A Class has many uses in the object oriented environment of programming. One of its major advantages is that it can act as a blueprint for a new program you are about to write. For example, if your are building houses -- each house is different, one storey, two storey, three bedroom, five bedroom, etc, BUT there are some common elements in ALL houses -- the roof, floor, windows, door, etc. These common elements can go in a "House.class" file. So, when you are writing a "OneStoreyHouse.class" application for example, you can make an instance of the House.class in the OneStoreyHouse.class and be able to use all the pre-defined elements in that class to build your new class.

A Structure on the other hand deals with the data-type issue. if you are writing a job application program, you will need different types of data -- string (name), int (age), float (salary), char (m/f), etc. Normally, you would have to create an individual variable for each data type, so you would end pp with 4 variables. A structure can combine these 4 variables into 1 data-type, so you would only have to create 1 variable as this new data-type. eg: public struct ReqData { public string Name; public int Age; public char Gender; public float Salary; } appdata;

So, by defining appdata User , the single variable called User will now contain 4 different data-types.