ie page 2 - Dave's Blog


Tweet from Šime Vidas

2016 Nov 17, 3:14
Chrome Canary has enabled scroll anchoring which prevents “jumps” when the layout above the viewport changes (demo: )

Tweet from David Risney

2016 Nov 3, 3:57
@FakeUnicode At least some of that is from . For unreserved characters (a-z0-9._-~) normal form is decoded.

Tweet from David Risney

2016 Nov 2, 9:30
Parsing WinRT metadata (winmd files) is much easier than last time I tried. There's support in .NET reflection APIs 

Parsing WinMD with .NET reflection APIs

2016 Nov 2, 6:13

Parsing WinMD files, the containers of WinRT API metadata, is relatively simple using the appropriate .NET reflection APIs. However, figuring out which reflection APIs to use is not obvious. I've got a completed C sharp class parsing WinMD files that you can check out for reference.

Use System.Reflection.Assembly.ReflectionOnlyLoad to load the WinMD file. Don't use the normal load methods because the WinMD files contain only metadata. This will load up info about APIs defined in that WinMD, but any references to types outside of that WinMD including types found in the normal OS system WinMD files must be resolved by the app code via the System.Reflection.InteropServices.WindowsRuntimeMetadata.ReflectionOnlyNamespaceResolve event.

In this event handler you must resolve the unknown namespace reference by adding an assembly to the NamespaceResolveEventArgs's ResolvedAssemblies property. If you're only interested in OS system WinMD files you can use System.Reflection.InteropServices.WindowsRuntimeMetadata.ResolveNamespace to turn a namespace into the expected OS system WinMD path and turn that path into an assembly with ReflectionOnlyLoad. code programming winmd winrt

Tweet from Open Culture

2016 Nov 2, 4:31
Read the CIA’s Simple Sabotage Field Manual. How to Subvert Organizations with “Purposeful Stupidity” (1944) 

Tweet from David Risney

2016 Oct 23, 4:18
Only Child written by @hodgman is amazing & hilarious. Although also showed me various ways in which I'm not special 

Tweet from Alice Maz

2016 Oct 12, 7:00
here's what the electoral map would look like if we had four political parties none of which won two adjacent states

Tweet from emily schechter

2016 Sep 8, 1:12
in Chrome 56, we'll mark HTTP pages with password or credit card form fields as "not secure". turn on HTTPS before! 

Tweet from Mike Birbiglia

2016 Aug 24, 11:12
When people hack someone's shit you have a responsibility as a decent person to not look at it. You're better than that.

Tweet from Pwn All The Things

2016 Aug 21, 11:23
If insurance companies said "your premiums will go from $10m to $2m if you parameterize your SQL" SQL-injection would all be dead tomorrow.

Tweet from Dan Ahdoot

2016 Aug 19, 2:42
I'm no scientist, but shouldn't he get MORE medals for this?

Tweet from David Risney

2016 Aug 18, 5:40
Mother Jones on ending private prisons and their previous piece inside private prisons: 

WPAD Server Fiddler Extension Source

2016 Aug 5, 3:18

I've put my WPAD Fiddler extension source and the installer on GitHub.

Six years ago I made a WPAD DHCP server Fiddler extension (described previously and previously). The extension runs a WPAD DHCP server telling any clients that connect to connect to the running Fiddler instance. I've finally got around to putting the source on GitHub. I haven't touched it in five or so years so this is either for posterity or education or something.

PermalinkCommentsdhcp fiddler network security wpad

WinRT Toast from PowerShell

2016 Jun 15, 3:54

I've made a PowerShell script to show system toast notifications with WinRT and PowerShell. Along the way I learned several interesting things.

First off calling WinRT from PowerShell involves a strange syntax. If you want to use a class you write [-Class-,-Namespace-,ContentType=WindowsRuntime] first to tell PowerShell about the type. For example here I create a ToastNotification object:

$toast = New-Object Windows.UI.Notifications.ToastNotification -ArgumentList $xml;
And here I call the static method CreateToastNotifier on the ToastNotificationManager class:
$notifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($AppUserModelId);
With this I can call WinRT methods and this is enough to show a toast but to handle the click requires a little more work.

To handle the user clicking on the toast I need to listen to the Activated event on the Toast object. However Register-ObjectEvent doesn't handle WinRT events. To work around this I created a .NET event wrapper class to turn the WinRT event into a .NET event that Register-ObjectEvent can handle. This is based on Keith Hill's blog post on calling WinRT async methods in PowerShell. With the event wrapper class I can run the following to subscribe to the event:

function WrapToastEvent {
param($target, $eventName);

Add-Type -Path (Join-Path $myPath "PoshWinRT.dll")
$wrapper = new-object "PoshWinRT.EventWrapper[Windows.UI.Notifications.ToastNotification,System.Object]";
$wrapper.Register($target, $eventName);

[void](Register-ObjectEvent -InputObject (WrapToastEvent $toast "Activated") -EventName FireEvent -Action {

To handle the Activated event I want to put focus back on the PowerShell window that created the toast. To do this I need to call the Win32 function SetForegroundWindow. Doing so from PowerShell is surprisingly easy. First you must tell PowerShell about the function:

Add-Type @"
using System;
using System.Runtime.InteropServices;
public class PInvoke {
[DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetForegroundWindow(IntPtr hwnd);
Then to call:
[PInvoke]::SetForegroundWindow((Get-Process -id $myWindowPid).MainWindowHandle);

But figuring out the HWND to give to SetForegroundWindow isn't totally straight forward. Get-Process exposes a MainWindowHandle property but if you start a cmd.exe prompt and then run PowerShell inside of that, the PowerShell process has 0 for its MainWindowHandle property. We must follow up process parents until we find one with a MainWindowHandle:

$myWindowPid = $pid;
while ($myWindowPid -gt 0 -and (Get-Process -id $myWindowPid).MainWindowHandle -eq 0) {
$myWindowPid = (gwmi Win32_Process -filter "processid = $($myWindowPid)" | select ParentProcessId).ParentProcessId;
} c# powershell toast winrt

Tweet from Windows Blogs

2016 Jun 10, 3:01
Using Device Portal to view debug logs for UWP 

Tweet from David Risney

2016 Jun 9, 4:02
Movie written by algorithm turns out to be hilarious and intense 

Tweet from The A.V. Club

2016 Jun 6, 4:50
BuzzFeed backs out of RNC ad deal, citing profound awfulness of Donald Trump 

Tweet from David Risney

2016 Jun 5, 4:10
I played Chrome, Edge, FF & IE against each other in WebDriverChess. Edge just beats out Firefox for #1. Results: 

Tweet from David Risney

2016 Jun 5, 3:55
I finished WebDriverChess : Two webdriver supporting browsers play a friendly game of chess.

Tweet from wilkie

2016 Jun 4, 11:27
they've really doubled down on the "world-ending ritual chamber" look and feel for wifi routers these days
Older EntriesNewer Entries Creative Commons License Some rights reserved.