3d – How to project a vector onto a plane, but not along plane normal?

Given a plane with normal vector $vec n$ and any arbitrary point $vec p$ on that plane, then for any other point $vec p^prime$ in that plane the following equation holds:

$$vec n cdot vec p ^ prime = vec n cdot vec p$$

Now let’s take your off-plane point $vec q = (q_x, q_y, q_z)$. We’re going to slide it along the y axis to a new point $vec q ^prime = (q_x, y, q_z)$ so that it lies in that plane. That means…

$$begin{align}vec n cdot vec q^prime &= vec n cdot vec p\
n_x q_x + n_y y + n_z q_z &= vec n cdot vec p\
n_y y &= vec n cdot vec p – n_x q_x – n_z q_z\
y &= frac {vec n cdot vec p – n_x q_x – n_z q_z} {n_y}
end{align}$$

So, substitute your normal, point on plane, and x/z coordinates of your off-plane point $ vec q$, and you’ll get the new y coordinate that will project it vertically onto this plane.

c# – Asp.Net overall design pattern integrating REST, dependency injection, and Hosted Services (See full project at Github)

I’m new to C#, and want to conform as much as possible to good design patterns. This code is the beginning of a Microservice, running as Asp.Net. It is based on a Microsoft tutorial doing similar work.

It has three functional components currently:

  1. Converts a CSV file to JSON, for return via REST
  2. A REST controller to test the conversion of the CSV to JSON return
  3. A background service which monitors a directory looking for changed files. The file attributes (Path, Date, Checksum) are stored in a MongoDB database via a Repository.

Opinions/Recommendations regarding the design patterns welcomed.

The full code can be found at: https://github.com/BioComSoftware/unite-radimaging-source-n2m2.git

BONUS: Notice in FileSearchHostedService.cs, I instantiate the Repository objects explicitly. I think it would be more appropriate to have them as Dependency Injection – but I couldn’t get it to work. Notice the commented-out lines that would have done this. My understanding is; I would need to do this with IScopedProcessingService – but I have no idea how to do this with this specific code.

Structure

(Startup.cs)

using unite.radimaging.source.n2m2.Data;
using unite.radimaging.source.n2m2.Repositories;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
//using Microsoft.OpenApi.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace unite.radimaging.source.n2m2 {
    public class Startup {
        public Startup(IConfiguration configuration) {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime.
        // Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services) {

            services.AddControllers();

            services.AddScoped<IFoundFileContext, FoundFileContext>();
            services.AddScoped<IFoundFileRepository, FoundFileRepository>();
        }

        // This method gets called by the runtime.
        // Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
            if (env.IsDevelopment()) {
                app.UseDeveloperExceptionPage();
            }
            app.UseExceptionHandler("/error");
            app.UseRouting();
            app.UseAuthorization();
            app.UseEndpoints(endpoints => { 
                endpoints.MapControllers(); 
            });
        }
    }
}

(FoundFileRepository.cs)

using unite.radimaging.source.n2m2.Data;
using unite.radimaging.source.n2m2.Entities;
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace unite.radimaging.source.n2m2.Repositories {
   public class FoundFileRepository : IFoundFileRepository {
       private readonly IFoundFileContext _context;
       public FoundFileRepository(IFoundFileContext context) {
           _context = context ?? throw new ArgumentNullException(nameof(context));
       }

       public async Task<IEnumerable<FoundFile>> GetFiles() {
       return await _context
           .FoundFiles
           .Find(p => true)
           .ToListAsync();
       }

       public async Task<FoundFile> GetFile(string id) {
           return await _context
                          .FoundFiles
                          .Find(p => p.Id == id)
                          .FirstOrDefaultAsync();
       }

       public async Task<FoundFile> GetFileByPath(string path) {
           return await _context
                          .FoundFiles
                          .Find(p => p.Path == path)
                          .FirstOrDefaultAsync();
       }

       public async Task<FoundFile> GetFileByChecksum(string checksum) {
           return await _context
                          .FoundFiles
                          .Find(p => p.Checksum == checksum)
                          .FirstOrDefaultAsync();
       }

       //public async Task<IEnumerable<FoundFile>> GetFileByMtime(string mtime) {
       //    FilterDefinition<FoundFile> filter = Builders<FoundFile>.Filter.ElemMatch<DateTime>(p => p.Mtime, mtime);

       //    return await _context
       //                    .FoundFiles
       //                    .Find(filter)
       //                    .ToListAsync();
       //}

       //public async Task<IEnumerable<FoundFile>> GetFileBySize(long size) {
       //    FilterDefinition<FoundFile> filter = Builders<FoundFile>.Filter.ElemMatch<long>(p => p.Size, size);

       //    return await _context
       //                    .FoundFiles
       //                    .Find(filter)
       //                    .ToListAsync();
       //}

       public async Task CreateFile(FoundFile foundFile) {
           await _context.FoundFiles.InsertOneAsync(foundFile);
       }

       public async Task<bool> UpdateFile(FoundFile foundFile) {
           var updateResult = await _context.FoundFiles.ReplaceOneAsync(
               filter: g => g.Path == foundFile.Path, replacement: foundFile);
           return updateResult.IsAcknowledged && updateResult.ModifiedCount > 0;
       }

       public async Task<bool> DeleteFile(string path) {
           FilterDefinition<FoundFile> filter = Builders<FoundFile>.Filter.Eq(p => p.Path, path);

           DeleteResult deleteResult = await _context
                                               .FoundFiles
                                               .DeleteOneAsync(filter);

           return deleteResult.IsAcknowledged
               && deleteResult.DeletedCount > 0;
       }
   }
}

(FileSearchHostedService.cs)

using unite.radimaging.source.n2m2.Repositories;
using unite.radimaging.source.n2m2.Entities;
using unite.radimaging.source.n2m2.Data;
using Serilog;
using Microsoft.Extensions.Configuration;
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace unite.radimaging.source.n2m2.HostedServices {
    public class FileSearchHostedService : BackgroundService {
        private readonly IConfiguration _configuration;
        //private IFoundFileRepository _repository;

        public FileSearchHostedService(
            //IFoundFileRepository repository,
            IConfiguration configuration
            ) {
            //_repository = repository ?? throw new ArgumentNullException(nameof(repository));
            _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
        }

        protected override async Task ExecuteAsync(CancellationToken cancellationToken) {
            Log.Information("FileSearchHostedService: File searching started.");

            cancellationToken.Register(() => Log.Information("Processing service stopped"));

            //string checksum;
            string _current_path;
            FileInfo _current_file;
            FoundFile _foundFile;
            FoundFile _existingFile;
            FoundFile _addFoundFile;
            FoundFileContext FoundfileContext = new FoundFileContext(_configuration); // Normal instantiation, in leiu of injection
            FoundFileRepository _repository = new FoundFileRepository(FoundfileContext);  // Normal instantiation, in leiu of injection

            while (!cancellationToken.IsCancellationRequested) {
                Log.Information("Searching files...");
                string dir = _configuration.GetValue<string>("FileSearchSettings:SearchDir");
                string() files = Directory.GetFiles(dir);
                foreach (string filename in files) {
                    Log.Debug($"Parsing '{filename}'");

                    _current_file     = new FileInfo(filename);
                    _current_path = Path.GetFullPath(Path.Combine(_current_file.Directory.ToString(), _current_file.Name));

                    _foundFile = new FoundFile() {
                        Path = _current_path,
                        Size = _current_file.Length,
                        Mtime = _current_file.LastWriteTime,
                        Checksum = FileChecksum.getChecksum(filename)
                    };
                    Console.WriteLine("==========================");
                    _existingFile = await _repository.GetFileByPath (_current_path);
                    Console.WriteLine("past _repository.GetFileByPath");

                    try {
                        Console.WriteLine($"{_existingFile.Path} exists!!!");
                        Console.WriteLine($"     _existingFile.Checksum: {_existingFile.Checksum}");
                        Console.WriteLine($"     _existingFile.Length = {_existingFile.Size}");
                        Console.WriteLine($"     _existingFile.LastWriteTime = ({_existingFile.Mtime}");
                    }
                    catch {
                        Console.WriteLine($"Creating MongoDB for file {_foundFile.Path} ");
                        _addFoundFile = new FoundFile() {
                            Path = _foundFile.Path,
                            Size = _foundFile.Size,
                            Mtime = _foundFile.Mtime,
                            Checksum = _foundFile.Checksum
                        };
                        await _repository.CreateFile(_addFoundFile);
                    }
                }

                await Task.Delay(
                    _configuration.GetValue<int>("FileSearchSettings:Delay"),
                    cancellationToken
                    );
            }
        }
    }
}

project management – Does exist any methodology, which helps decide which elements to choose into the technology stack?

In most cases, it is prescribed what kind of programming language to use with what framework. In my question, I’m pointing to those situations when there is no requirement for the stack.

I understand that many people are limited by their previous experience, what kind of languages they used before, but I would like to abandon this factor.

When a project is starting and the participants have the freedom to select the elements of the technology stack, they have to decide somehow why do they choose one option despite the other alternatives.

Due to my previous search, I identified some website, which has a categorization and review system for technologies:

The list is not complete, and I’m curious if there is a “best” for these “comparative” sites. Like there is a “best” for searching something on the internet, although it has working and available alternatives.

To show an example: It’s about a web development project, there is a frontend, backend, and a database. It must be determined which language and technologies to use for each part of the system.
It is obvious that popularity and support is an important factor, but that’s lead to my question of detail:

How can someone determine the popularity and supportability of the options?

Newbie question – what will happen after project Stop? — 👉 GSA SEO and Marketing Forum 👈

Planning to run GSA SER, and did not find answer to my question.

Lets say i import target URLs from bought list file.

Run a campaign for some time. Then i stop, and start it again after some time.

Does link building starts from beginning of that list file over again, or is any way to start from that point where i stopped, even when the program was closed ?

Thanks.

beginner – Android Code – First Kotlin Project

I am learning Kotlin for Android dev. I do not have anyone to review my code and give feedback.
Please review the following project and let me know how I can make it better in terms of scalability if I add 3-4 different modules like login, detail pages

Kotlin-MVVM-Room-DataBinding

I am using ObservableField to make ProgressBar show/hide.
How can I make the following code in ViewModel work the same way using LiveData/MutableLiveData as it did not work for me. Except for syntax, I should not be changing the code.

val dataLoading = ObservableField(false)

    val result: LiveData<List<Post>> = liveData(IO, 5000) {
        dataLoading.set(true)
        try {
            val res = Repository.getInstance(app.applicationContext).getPosts()
            if (res.isNotEmpty()) {
                emit(res)
            } else {
                emit(emptyList<Post>())
            }
        } catch (ioException: Exception) {
            emit(emptyList<Post>())
        } finally {
            dataLoading.set(false)
        }
    }

c++ – Creating an external tool to edit Unreal project optimization settings

INTRO

I am creating a C++ app that will help users to set up optimization settings in the Unreal game engine. I want to let the program make all this work on its own. This application is being written for Windows 10 platform (maybe it will be cross-platform in the future).


PROBLEM DESCRIPTION

To make the program working as intended, I must be able to change configuration files, add some UE objects to the project and call editor functions (e.g. rebuild lights).


MY SOLUTION

I can parse some of the .ini files and edit them. However, the real problem is with UE objects and editor functions. One of the possible ways is to get symbols from the .dll and run that function in a separate process. Another way is to use the actual UE4 code for these tasks.


QUESTION

Is there any easier and safer way to achieve what I need?

Looking for someone who can use teamviewer to add 2 .pyo files (3D objects) into a LUA project

Hi all,

I’m currently looking for someone who can use teamviewer to add 2 or 3 .pyo files of 3D objects into a Lua project.

.pyo file you cannot open usually, but it can only be opened using the client’s computer so this project will be done using teamviewer.
SEMrush

PM me your quotation if you can do, thanks a lot

 

Best Source to find project

I would like to know, what are the best sources to get digital marketing project for a company?
Any one have any idea and view, please do share here.

Thank you so much for your valuable time for sharing information well in advance.

mathematics – How to project a Matcap correctly in Amplify Shader Editor

Unity’s Amplify Shader Editor comes with an example of matcap nodes setup, however, the matcap projection in this example is incorrect.
As you can see the texture becomes distorted when it’s on de edges of the screen, that shouldn’t happen with a correct matcap:

enter image description here

enter image description here

On the secoud image, this is how a matcap should look, without major distortions.

Does any expert in shaders knows the right way to project a matcap using the nodes? I’ve done my search and there is absolutelly no information about this around the internet, any response would add for this Shader documentation.
I’m extremelly in need that matcap works with this shader.