Great, if slightly quirky, video from Paul Irish. Some good points about IIFE’s and jQuery selector performance.
I’ve even added a Cornify button for you to click here:
Great, if slightly quirky, video from Paul Irish. Some good points about IIFE’s and jQuery selector performance.
I’ve even added a Cornify button for you to click here:
Just had an issue trying to use a dynamic object in a .NET test project – at build time I had the compiler error:
One or more types required to compile a dynamic expression cannot be found. Are you missing a reference?
In the end all I had to do was reference “Microsoft.CSharp” from my test project.
AntiScrape is an IIS ASP.NET Http Module to help in the fight against website scrapers!
AntiScrape hooks into the IIS ASP.NET request/response pipeline.
When your website users request a page, it automatically adds secret hidden links to the page that normal users in web browsers won't see. However, website scrapers that are scanning the HTML of the page will see the link and follow it.
Once the scraper has followed the secret link, they are recorded as being a scraper, and from then on what happens is entirely up to you!
You can either:
The settings for AntiScrape are integrated into the web applications web.config.
The module comes with a reference implementation of the data persistence layer for SQL Server, but other implementations can be easily added by implementing the IDataStorage interface in an assembly that resides in the web applications bin folder (remembering to remove the assembly containing the SQL Server reference implementation). AntiScrape uses Microsoft Unity to resolve the IDataStorage interface at run-time.
As part of this project I wanted to ensure that the module could be integrated with an existing web solution as easily as possible. Therefore the sample web project is just a vanilla web forms project created with File, New Web Project in Visual Studio, plus the dlls and some config changes. There are some other minor tweaks to show the results of the scraping requests in a table, but that’s it!
This software is currently in active development, and so not recommended for production environments at present.
Stuff I have yet to deal with:
Once I have something reasonable that answers these I shall put together a NuGet package that integrates the module and applies the config transforms.
Live demo is available on Windows Azure here: AntiScrape Demo
Source code is available on Github here.
<appSettings> <add key="LeadingBytes" value="2"/> <add key="LeadingBytesValue" value="7"/> </appSettings>
Where NZ is number of leading zero bytes the hash of the result must have, in this case 4 Also stores value in a list of request values for the session.
NZ[ random data ] X-PoWRequest: 0465A709F1CE40EABEFEF4C94FA0E9A8
Server checks that X-PoWRequest is present, if not response invalid.
X-PoWRequest: 0465A709F1CE40EABEFEF4C94FA0E9A8 X-PoWResponse: ED807302BF6A403ABE0C0864E271E284
[ server value ][ client value ]
0465A709F1CE40EABEFEF4C94FA0E9A8ED807302BF6A403ABE0C0864E271E284
[ hash ]
00000000891444D0AE14416C4D25E59EACE0404151F44C118F8B1CF868C314A8
Other helper methods:
public static Task<byte[]> GenerateResponse(byte[] request) public static Task<string> GenerateResponse(string request) public static Task GenerateResponse(HttpContext context)
public static bool RequiresResponse(HttpContext context) public static string GetRequest(HttpContext context) public static byte[] GetRequest(HttpContext context) public static void SetResponse(HttpContext context, byte[] request, byte[] response) public static void SetResponse(HttpContext context, string request, string response)
!!('WebkitOverflowScrolling' in document.documentElement.style)
Which meant that the CSS I was using to enable the scrolling was not being applied by the browser, as it looked like this:
.overflowscrolling .my-scroller {
overflow: scroll;
-webkit-overflow-scrolling: touch;
}
This issue has been reported on Stack Overflow here.
No, I think this was indeed triggered by 172481. We removed -webkit-overflow-scrolling with the hopes that it was no longer necessary because we'd automatically opt-in to fast scrolling when we need. The problem is that it isn't happening here.
So it would seem that support for –webkit-overflow-scrolling had been removed from the code at this point.
Tien-Ren observed while debugging 162363 that -webkit-overflow-touch is an inherited property. So the behavior of setting zindex: 0 on all non-hidden elements with that property creates a cascade of stacking contexts below it. (This behavior, behind ENABLE_ACCELERATED_OVERFLOW_SCROLLING, is currently enabled only on Android.) The obvious fix would be to set zindex: 0 on only "overflow: scroll" elements.
So it would seem that if you are having issues with the scrolling not working as expected then adding zindex: 0 to the element with overflow: scroll then this may help. However this did not work for me, although the scrolling sections worked (with my modified Modernizr test detailed below) the momentum effect of the scrolling was not present.
It turns out that iOS Safari also creates stacking contexts for all inherited elements, so let's leave this effect for -webkit-overflow-scrolling on Chrome for Android. This means that we should never support this property on desktop Chrome.
So the decision to remove it probably occurred between Jan 8 and Feb 12.
Although the name suggest that this is a game, at present it is merely a demo. When you visit the site (in a browser that fulfils the requirements below) then you will be presented with a first-person view from your own personal spaceship, flying through the galaxy.
Other people also viewing the site at the same time as you will be visible to you as spaceships flying through space, their positions updated in real time. Your spaceship will also be visible to them.
Mouse
Keyboard
Top left displays your radar, which shows where other ships are in space. Your ship is represented by the large green dot in the centre, other ships are smaller red dots around. If a red dot is on top of the green dot that means that either the other ship is right next to you, or directly in front of you.
Bottom left displays the game info messages, which will tell you about events in the galaxy, such as a new player joining the game.
You will need a browser that supports WebGL, running on a reasonably powerful computer with decent graphics hardware.
The currently recommended browser is Google Chrome. The demo works ok on Firefox (but not as fast as Chrome), and not at all on IE 10 or less. Apparently this may be changed in IE 11 (which will possibly support WebGL).
Google Chrome has also been found to work on Android devices, such as Tablets and recent phones. However what does not work at present is the touch interface for these devices. At present this is primarily a desktop-with-mouse driven experience.
This demo uses WebGL for the graphics rendering. It also uses either WebSockets, Server-Sent Events or AJAX Long Polling for the real-time communications.
It is built with the following technologies:
A live demo is available here: http://awesome3dgame.azurewebsites.net/
Source code is available on Github here: https://github.com/SneakyBrian/Awesome3DGame
In future posts I will delve into the details of how this was implemented.