Ruri

u/Ruri


r/nim•

Is it possible to call a function from an external library, such as a Windows DLL, by calling its identifying ordinal rather than the function name? As an example, see the below DLLImport statement from C#:

[DllImport("user32.dll", EntryPoint = "#2155", CharSet = CharSet.Unicode)]
static extern int TotallyLegitAPI(IntPtr hWnd, string lpText, string lpCaption, uint uType);

This function prototype is just for MessageBoxW; the entrypoint is defined as decimal "#2155", which is its ordinal within user32.dll. Calling a function this way is a bit faster than calling by function name; I'm just wondering if Nim has a way to do this. Here's a sample function prototype for this function in N

120

r/tryhackme•

Hey there hackers, charlatans, sorcerers of the dark arts! I am Alh4zr3d, and three times a week I'm bringing you more ways to add wrinkles to your brain through thorough study, stubbornness, dedication, and MALDING.

Today, chat is going to select some brain busters from TryHackMe and we are going to take them head on! I do all the boxes on stream completely blind and LIVE, so you'll see my authentic thought process, my frustration, my troubleshooting, and most importantly my inevitable success! Come hang out in chat with us and have some fun!

LIVE NOW: https://twitch.tv/alh4zr3d

241

r/csharp•

Hello, friends.

I'm having an issue with BinaryFormatter serialization through a named pipe here and it's really making me scratch my head. Firstly, let me make clear that I'm aware this class is deprecated and there are more modern options. I'm dealing with legacy software here that is, for all intents and purposes, static. I'm trying to work around it rather than playing with the actual service that is doing the deserialization.

Background: I'll try to keep this brief. I have a service listening on a named pipe for messages, and when it receives one, it runs BinaryFormatter.Deserialize() on it. Here's the relevant code snippet:

Server.waiting = true;
Server.serverStream
411

r/nim•

Got an (I think) fairly simple question that should have a fairly simple answer, but I'm having a surprisingly hard time finding answers in the documentation.

Take this simple example of a procedure from Nim by Example:

proc zip[I, T](a, b: array[I, T]): array[I, tuple[a, b: T]] = 
    for i in low(a)..high(a): 
        result[i] = (a[i], b[i]) 

let nameAndAddresses = names.zip(addresses)

For reference, this example is included with an explanation of arrays, showing that a dynamic array's size must be passed to a procedure with its value(s).

All I want to know is what that [I, T] after the procedure name (zip) is. I suspect it indicates something about the return t

146


r/ClashOfClans•

I’m seriously at a loss with Builder Base. I have maxed out offenses and I’ve experimented with every unit and composition I can think of to try, but absolutely none are effective past about 5000 trophies. The most effective is Dropships and Minions, but even that falls off at the higher trophy levels.

Every other unit is complete and total garbage. The Battle Machine is the worst unit in the entire game with the most inexplicable and worthless AI to boot. Hog Gliders get melted by the Guard Post and are similarly completely useless. Everything else gets melted by the Lava Launcher.

Legitimately what do you do to climb to the higher levels? Few people are playing builder base and I’ve ha

66

r/Eldenring•

Melania Bug/Easy Phase 2

Discussion & Info

I wish I had a video to demonstrate this, but it should be reproducible with some trying.

While fighting Melania, Blade of Miquella tonight, I ended her first phase with a visceral attack (I know that isn’t what they are called in this game but it’s the same mechanic from Bloodborne so stay with me). Her posture was broken at very low HP, such that the stabbing blow was the final hit to trigger phase 2. It did not happen right away; she collapsed after pulling the sword out and a few seconds passed.

At this point, the cutscene for phase 2 seemed to play as normal, but when completed, Melania did NOT dive bomb immediately as she is programmed to do and instead went into her aerial shadow

11

r/nim•

Hello friends,

I'm trying to teach myself how to perform low-level Windows API calls from Nim, and I'm running into a number of issues that I believe are related to variable types. I am aware that the Winim library exists (and I do use it as part of my learning process), not all Win32 API calls are defined in Winim so I'm trying to learn how to define them (both the functions themselves and the types of the parameters).

Take a look at this sample code:

import system

type
    LPSTR* = cstring
    LPDWORD* = uint32

proc GetUserNameA*(lpBuffer: LPSTR, pcbBuffer: LPDWORD): bool 
  {.discardable, stdcall, dynlib: "advapi32", importc: "GetUserNameA".}

106

r/nim•

Hey there, friends.

Working on a project in Nim right now and it involves initializing a CLR runspace and then executing PowerShell inside of it. This works just fine; the PowerShell executes without issue as expected. However, I'm having a lot of trouble printing the output.

import winim/clr

var Automation = load("System.Management.Automation")
var RunspaceFactory = Automation.GetType("System.Management.Automation.Runspaces.RunspaceFactory")

var runspace = @RunspaceFactory.CreateRunspace()

runspace.Open()

var pipeline = runspace.CreatePipeline()
pipeline.Commands.AddScript("Get-Process")

var results = pipeline.Invoke()

runspace.Close() 

The "results" variable is a CLRVaria

106

r/ClashOfClans•

I recently returned to the game from a few years’ hiatus, and obviously significant changes/additions have been made. I am an engineered TH11 with no Eagle Artillery, Inferno Towers, additional point defenses past TH9, TH9 Wizard Towers and mortars, etc. I see that now (and apparently ever since they added TH12) I cannot upgrade my Town Hall without building these structures. This makes sense and I respect the change.

That being said, when it comes to clan wars, is there still value in keeping my “high weight” defenses low for as long as possible, or is it better to just go ahead and start building/upgrading those structures now? Just trying to figure out what to focus on upgrading going f

13