Tutorial by Examples

Before you can use a resource in a configuration, you must explicitly import it. Just having it installed on your computer, will not let you use the resource implicitly. Import a resource by using Import-DscResource . Example showing how to import the PSDesiredStateConfiguration resource and the F...
In classic ASP we can specify a for loop with the for keyword. With the for statement we need the next statement which will increment the counter. For i = 0 To 10 Response.Write("Index: " & i) Next The step keyword can be used to changed the how the next statement will modify...
Do while is very similar to for loop however this generally is used if our loop repetitions is unknown. Do While: 'Continues until i is greater than 10 Do While i <= 10 i = i + 1 Loop 'Or we can write it so the first loop always executes unconditionally: 'Ends after our first loop as...
#!/usr/bin/env python """ An annotated simple socket server example in python. WARNING: This example doesn't show a very important aspect of TCP - TCP doesn't preserve message boundaries. Please refer to http://blog.stephencleary.com/2009/04/message-framing.html before adaptin...
#!/usr/bin/env python """ An annotated simple socket client example in python. WARNING: This example doesn't show a very important aspect of TCP - TCP doesn't preserve message boundaries. Please refer to http://blog.stephencleary.com/2009/04/message-framing.html before adaptin...
Detailed instructions on getting pthreads set up or installed.
Passwords should never be stored as plain text! They should be hashed with a randomly generated salt (to defend against rainbow table attacks) using a slow password hashing algorithm. A high number of iterations (> 10k) can be used to slow down brute force attacks. A delay of ~100ms is acceptable...
Apart from primitives, the Explicit Layout structs (Unions) in C#, can also contain other Structs. As long as a field is a Value type and not a Reference, it can be contained in a Union: using System; using System.Runtime.InteropServices; // The struct needs to be annotated as "Explici...
Signing a script is done by using the Set-AuthenticodeSignature-cmdlet and a code-signing certificate. #Get the first available personal code-signing certificate for the logged on user $cert = @(Get-ChildItem -Path Cert:\CurrentUser\My -CodeSigningCert)[0] #Sign script using certificate Se...
To change the execution policy for the default scope (LocalMachine), use: Set-ExecutionPolicy AllSigned To change the policy for a specific scope, use: Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy AllSigned You can suppress the prompts by adding the -Force switch.
Often you might need to execute an unsigned script that doesn't comply with the current execution policy. An easy way to do this is by bypassing the execution policy for that single process. Example: powershell.exe -ExecutionPolicy Bypass -File C:\MyUnsignedScript.ps1 Or you can use the shorthan...
Getting the effective execution policy for the current session: PS> Get-ExecutionPolicy RemoteSigned List all effective execution policies for the current session: PS> Get-ExecutionPolicy -List Scope ExecutionPolicy ----- --------------- MachinePolicy Undefined...
Get information about the Authenticode signature from a signed script by using the Get-AuthenticodeSignature-cmdlet: Get-AuthenticodeSignature .\MyScript.ps1 | Format-List *
When signing personal scripts or when testing code signing it can be useful to create a self-signed code signing certificate. 5.0 Beginning with PowerShell 5.0 you can generate a self-signed code signing certificate by using the New-SelfSignedCertificate-cmdlet: New-SelfSignedCertificate -Friendl...
Dynamic SQL enables us to generate and run SQL statements at run time. Dynamic SQL is needed when our SQL statements contains identifier that may change at different compile times. Simple Example of dynamic SQL: CREATE PROC sp_dynamicSQL @table_name NVARCHAR(20), @col_name NVARCHAR(2...
Sometimes a new Java programmer will write code like this: public void check(boolean ok) { if (ok == true) { // Note 'ok == true' System.out.println("It is OK"); } } An experienced programmer would spot that as being clumsy and want to rewrite it as: publ...
import XCTest @testable import PersonApp class PersonTests: XCTestCase { func test_completeName() { let person = Person(firstName: "Josh", lastName: "Brown") XCTAssertEqual(person.completeName(), "Josh Brown") } } Now let's discuss wh...
The normal Java classloaders look for classes first in the bootstrap classpath, before checking for extensions and the application classpath. By default, the bootstrap classpath consists of the "rt.jar" file and some other important JAR files that are supplied by the JRE installation. Th...
Sprite animation consists in showing an existing sequence of images or frames. First import a sequence of images to the asset folder. Either create some images from scratch or download some from the Asset Store. (This example uses this free asset.) Drag every individual image of a single animati...
Unity networking provides the High Level API (HLA) to handle network communications abstracting from low level implementations. In this example we will see how to create a Server that can communicate with one or multiple clients. The HLA allows us to easily serialize a class and send objects of ...

Page 791 of 1336