I trained a machine learning model to differentiate between buttons and links on web pages. Using a dataset of ~3000 button images and ~4000 link images, I trained a convolutional neural network (CNN) with added noise for better generalization. Preprocessing included grayscale conversion, dataset diversification with multilingual sites, and image compression. The model performed well in initial tests, correctly classifying button-like and link-like elements. Next, I'll build a web app for easier testing and a Lighthouse audit for website analysis.
C# Query from Google
This post addresses the C# problem of checking if a string contains a number. Two approaches are suggested: using the Convert class with specific data types like Convert.ToInt16
, Convert.ToInt32
, Convert.ToFloat
, etc., and using regular expressions like ^[0-9]+$
or ^[\d]+$
for whole number strings. The post aims to help C# programmers effectively perform this type of string validation.
RE: Regex 101 Exercise S2 - Verify a string is a hex number
In a previous post about verifying a hex number string with regex, there was a slight error. The regex should have been ^[A-Fa-f0-9]+$
. A further refinement to prevent leading zeros (except for the number zero itself) would look like this: ^[A-Fa-f1-9][A-Fa-f0-9]*$
.
RE: Regex 101 Exercise S2 - Verify a string is a hex number
This blog post discusses a regex exercise to verify if a string is a hexadecimal number. The proposed solution is ^[A-Fa-f0-9]*$
, which matches any combination of hexadecimal digits (0-9 and a-f, case-insensitive). The author acknowledges that this regex allows starting a number with 0, which might not be desirable.
ASP.Net Query Parameter Validation
I've been pondering an ASP.Net security concern: while it blocks potentially harmful querystring characters by default, turning this off puts the onus of validation on developers. I'm exploring the idea of a declarative approach to query parameter validation, where developers define predicates (like data types) for expected parameters within the Page Class definition itself. This could simplify validation and ensure data is HTML-safe before reaching the developer. This would streamline validation compared to using custom validators. I'm considering the benefits and implementation details of such an approach.