Posts

Simple PayPal page with Vue

So, i needed to create a pay page for my company site www.upwardinfo.com. i choose to go with PayPal buttons on an HTML page, simple and fast. but i needed more, so it thought why shouldn’t i hook PayPal buttons to a simple Vue can’t app, and do some URL parameters that can be intercepted by JS (yes you can so that!). The idea was simple, have an HTML and JS script you can host anywhere, and the page should be able to have two URL parameters for a description /name and amount to be paid, if those values did not exist an input field should be available for user input, and as I have Vue why not do some validations as well. If you want to take a look on the code and use it on your page visit this code repo.

Blazor how to generate that SHA256 check

So ... I see that Balzor + .NET 5 (where did Core go?!!) is now do have what i want to get my things running but of course as always something was missing, see Blazor lazy loading is just the thing i was looking for but it doesn’t work unless i reference the module/razor component library on the main project, which i exactly what is don't want. Fortunately this time everything was kind of there, just a bit trouble to do myself. See if you create a client side Razor app, you get blazor.boot.json file generated and on that file you get lazyAssembly entry which supposed to make browsers only get these assemblies if needed (can't see this working on Firefox or Chrome but that's another story), and if you list your assembly there and follow instructions in here magic happen and the page you created on your razor component library works! But, first you need to be able to calculate that sha256 value for your assembly! Which at first i couldn’t figure out how, but then found this

EF Core two data models on two separate projects / dlls with a relationship

Again stuck on my learn / dream project WorkNxt , what i though is a very simple task turn out to be a bit tricky. as i am trying to separate each module and load things at runtime and use DI, i encountered a problem that one of the data models i created under one module need to have EF relationship with another data model on another module, each of course was on a separate project / dll. ideally i didn't want to reference the other module project but to make things even more difficult this was one-to-one relationship and i needed it from both sides and i needed to use it on a ThenInclude as i want to include data from one of the models on the results of the other one. So even if i was ok with cross modules reference which i was trying to avoid i will fall for circular reference trap as you would need to use each class on the other to create the relationship. After many hours of banging my head against the wall, and trying a couple of suggestions from EF core team through the issu

Tabulator on Bootstrap tab

As i was going on my project WorkNxt , i found a new interesting problem. i mean this one of the main reasons i started this anyway, is to find and solve interesting problems!  i am using Tabulator and Bootstrap along with other JS and CSS libraries on this project, and what i wanted was very simple, to have a bootstrap tab navigator with two tabs each with a Tabulator table on it. Simple?, not really, see what i found out is for some reason Tabulator might have trouble rendering in a Div with css display set to none, which is exactly the not shown yet tab(s) would be. How did i resolve this, and i would dare to say it's a very good solution, is the little JS script below function redrawTable() { tabulatorTable.redraw(); $('#detials-tab a[href="#TargetTab"]').unbind('shown.bs.tab', redrawTable); } $('#detials-tab a[href="#TargetTab"]').on('shown.bs.tab', redrawTable);

How to load a DLL and runtime, invoke a method my name, get result object and use it as a parameter on another unkown DLL .NET Core

That post title took me a while to come up with, but my idea is pretty simple, what id you need sort of a bootstrap that don't reference DLLs, still be able to manage a simple operation of of invoking methods and pass results to the next DLL on the list. C# and .NET Core as a strong type based doesn't really have obvious ways to accomplish this, but i think i got to it with the following code, what do you think? string sourceAsmName = "DllToLoadName"; Assembly sourceAsm = AssemblyLoadContext.Default.LoadFromAssemblyPath(AppContext.BaseDirectory + sourceAsmName + @".dll"); AssemblyLoadHelper.LoadReferencedAssemblies(sourceAsm); Type sourceType = sourceAsm.GetType(sourceAsmName + "." + source); MethodInfo? sourceMethod = sourceType.GetMethod("extract"); object? sourceInstance = Activator.CreateInstance(sourceType, new object[] { _config, _logger }); Task sourceTask = (Task)sourceMethod.Invoke(sourceInstance, null); _logger.LogInformati

Vue ajax search component

So as i was on my journey learning and creating www.worknxt.com , i needed a Vue component that: when user type it goes and call an end point. replace part of the URL with search text. coming back with results, user can select one but then the value that go up to parent is like and Id value of selected item while keep the display text of the component on another value. everything should be assigned through props so this can be reused. i googled but couldn't find any free Vue component that accomplish this and satisfy my requirements. below code is what i ended up with, let me know what you think, it needs some work on responding to keyboard keys like down arrow but i think it's a good start, so i though to share. Vue.component('vue-autocompleteajax', { props: { placeHolderText: String, minLengthToSearch: { type: Number, default: 1 }, ajaxUrl: String, partToReplace: String, idProperty: String, textProperty: String,

how to copy NuGet packages from one project to another

You probably faced that problem at least once, here you are working on your modules trying to build a new model for your solution, create a new dll project and ... here it comes, NuGet packages, you need to have manually install all these NuGet packages that you know form the base of needed libraries for your new module or plug-in, and you need to get every package plus the versions right. If you are like me this would be a soul crushing task to do, so in order for me to be more "efficient" i searched for a way to copy that to the new project, at first i thought well that is easy, just copy "package.json" file, right? , wrong see for some reason this didn't work for me, i was not able to simply do this and restore packages, things went crazy and it seems it's like taking forever! so i have to come up with something even more "efficient" so here you go, hope this save you sometime and but smile on your face just execute below on Visual Studio