This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System.Linq.Expressions | |
Public Class UnsupportedExpressionRewriter | |
Inherits ExpressionVisitor | |
Public Shared Function RewriteExpression(Of T)(expression As Expression(Of T)) As Expression(Of T) | |
Dim rewriter As New UnsupportedExpressionRewriter() | |
Return CType(rewriter.Visit(expression), Expression(Of T)) | |
End Function | |
Protected Overrides Function VisitMethodCall(node As MethodCallExpression) As Expression | |
' Handle GetValueOrDefault |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Kazia - A Mech Tale | |
by | |
Richard Griffiths | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#how to make a silly image like thing for use in datagrids like DevExpress. Friday snap special | |
from PIL import Image | |
image = Image.open('C:\Downloadstmp\LeftAktarian75 - Copy.bmp').convert('L') # Convert to grayscale | |
image = image.resize((64, 64)) | |
# Threshold value to distinguish between '1' and ' ' | |
threshold = 128 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///In an effort to get some kind of intuition around what an octonion even is - I'm not a mathematician! - I asked GPT4 for help. | |
///During this conversation it gave me the outline of an octonion in C#. Running with this, I prompted for the main operations and built | |
///this up, sparked by the fact there wasn't an implementation out there (according to GPT4 - which probably is not true). | |
///Still, posting this up for my future reference as I'm interested in the notion of using such in a neural network | |
///Though I'm more likely to review abstracts of others who have actually code such CNNs already! :) | |
public struct Octonion | |
{ | |
public double w, x, y, z, u, v, t, s; // the eight components of the octonion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter as tk | |
# Define the UserExamStore class | |
class UserExamStore: | |
def __init__(self, id, name, date, exams=None, languages=None, formats=None): | |
self.id = id | |
self.name = name | |
self.date = date | |
self.exams = exams if exams is not None else set() | |
self.languages = languages if languages is not None else set() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter as tk | |
# Define the UserExamStore class | |
class UserExamStore: | |
def __init__(self, id, name, date): | |
self.id = id | |
self.name = name | |
self.date = date | |
self.exams = [] | |
self.languages = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This code generates a sequence of random numbers and applies a transformation to each number, | |
such that the probability of the number being transformed to 1 increases as the sequence progresses. | |
This is done using a Markov chain with a transition matrix that depends on the sequence index. | |
```csharp | |
// Install TensorFlow.NET NuGet package | |
#load "nuget: TensorFlow.NET, 0.11.0" | |
using System; | |
using System.Collections.Generic; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''This code just saved 6700 mergecodes across to the db in a few second compared to long minutes via EF :) | |
Public Shared Sub SaveMany(Items As List(Of BranchContact)) | |
If Items Is Nothing Then Return | |
Using db As New LogIQEntities | |
Dim chunkedItems = ChunkData(Items, 500) 'I've not tested to see the upper/lower bounds of benefits/deficits on this figure :P | |
For Each chunkedList In chunkedItems | |
Dim Query = New StringBuilder | |
For Each i In chunkedList | |
Query.Append($"update BranchContacts set Mergecodes = '{i.Mergecodes}' where Emailid = {i.Emailid} and Branch = '{i.Branch}';") | |
Next |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface ICrud //Used to allow the texttemplate in the Model Layer to work. Needs a revisit. | |
{ | |
int Id { get; set; } | |
} | |
public abstract class BaseModel : INotifyPropertyChanged | |
{ | |
protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null) | |
{ | |
if (Equals(storage, value)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<#@ include file="EF.Reverse.POCO.Core.ttinclude" #> | |
<# | |
// v2.35.0 | |
// Please make changes to the settings below. | |
// All you have to do is save this file, and the output file(s) is/are generated. Compiling does not regenerate the file(s). | |
// A course for this generator is available on Pluralsight at https://www.pluralsight.com/courses/code-first-entity-framework-legacy-databases | |
// Main settings ********************************************************************************************************************** | |
Settings.ConnectionStringName = "RedDiamondConnectionString"; // Searches for this connection string in config files listed below in the ConfigFilenameSearchOrder setting | |
// ConnectionStringName is the only required setting. |
NewerOlder