I need to get id of the current thread in Dart. Something similar to how I would do this in Java (or C#):
Thread.currentThread().getId()
Coming in a bit late but I think Isolate.current.debugName should give you what you're looking for.
Are you talking about the Process ID of the running program? Because that is possible with the pid property from dart:io:
https://api.dartlang.org/stable/2.3.1/dart-io/pid.html
Related
I just want to know how to find/create a function to list all crontables already scheduled in NodeMCU.
(http://nodemcu.readthedocs.io/en/dev/en/modules/cron/)
Thanks.
That feature is currently not available. There's a discussion about that at https://github.com/nodemcu/nodemcu-firmware/issues/1751.
Solved on github by https://github.com/djphoenix
>>>>>
Hi there.
So, there is some issues with it.
Now, schedule string description (like 0 1 * * *) is being parsed once you call :schedule method, and stored in packed bitmask format. There is difficult thing to process it back to string.
So list of entries without something that describing them is totally unusable (correct me if I wrong).
As module initiator and maintainer I prefer to keep it simple as possible, but if we can make it better - this is good :)
In my company's codebase I'm seeing pageScope.actionName being used. Is it safe to droppageScope?
Update:
I am interested in knowing whether actionName is a late addition to the framework that makes pageScope.actionName obsolete.
Update 2:
Here is how it is used in one taglib:
def url = "/${pageScope.controllerName}/${attrs.action}"
pageScope. As for the usage in your company code, I guess it depends on how long ago it was written. Referring to docs in 2010 like: grails_pagescope_variable_in_gsps_and_taglibraries and overriding-plugin-templates-in-grails-application there are a few more around people were using it then, can't comment on if it was essential back then.
Without any further context it's difficult to say definitively, but in general, yes it's safe.
I am trying to get the file path of a thread id.
I was hoping that this will work..but it doesn't
NtOpenThread(#hProc, THREAD_ALL_ACCESS, #ObjAttr, #ClientID) ;
pBuf := AllocMem(MAX_PATH);
GetModuleFileNameEx(hProc, 0, pBuf, MAX_PATH);
Any idea how it is done ?
GetModuleFileNameEx requires a process handle, not a thread handle, which explains why your code doesn't work. There are two main ways to get a process handle. The first is from CreateProcess, but that's no good unless you're the one starting the process, and if you're doing that, you don't need GetModuleFileNameEx in the first place.
The second way to get a process handle is from OpenProcess. That requires a process ID. You can get a thread's process ID with GetProcessIdOfThread, which takes a thread handle. You already know how to get a thread handle from a thread ID with NtOpenThread, although the usual function is plain old OpenThread.
If your Windows version doesn't support GetProcessIdOfThread, you can go another route with Thread32First and Thread32Next. Call CreateToolhelp32Snapshot, and then walk the thread list. Look for an entry where th32ThreadID equals the thread ID you're interested in. When you find it, th32OwnerProcessID will hold the corresponding process ID. Call OpenProcess and proceed as above.
Also note that you should not have to request ALL_ACCESS permissions when opening threads or processes, and attempting to do so may cause your program to fail. Request only the minimum permissions you need to accomplish your task. Requesting all access is the lazy way when you don't know what you need, but it will only work when your program already has administrative privileges. Instead, spend the time to figure out what permissions you really need.
In One major difference - ZeroMQ and Erlang author mentions briefly "request as a process" idea. I'm new to Erlang and I'd like to see an example or an article how to do it.
Any resource or hint will be highly appreciated.
I am a newbie too but to me the idea seems simple. For each request, whatever it is, spawn a new process and let it handle the request. That is all. This guy talks about that too: http://vimeo.com/19806728
So my understanding is that when you receive a request, you spawn a process by calling spawn(Module, Name, Args), or another variant of this function (see http://www.erlang.org/doc/reference_manual/processes.html) and pass the request data in the Args list. Module and Name identify a function that is executed when the process starts and that deals with the Args.
How do you make a combo of two emotes in lua in World of Warcraft work?
function Button2_OnClick()
PlaySoundFile("Interface\\Addons\\Fart\\common_fart[1].wav");
DoEmote("moon");
DoEmote("sit");
DoEmote("dance");
DoEmote("beckon");
end
I am using Wow Addon Studio to make a fart application on Wow.
I used this function, and only the sit motion showed, and beckon and moon only showed on the chat window. The dance emote didn't show up anywhere.
Blizzard has explicitly prohibited anything that can be used to make lua wait or pause because it is an essential ingredient to making a gold mining or grinding bot.
There isn't a native (i.e. lua only) way to have lua wait without using all the CPU. Outside of the WOW client, you'd use win.sleep or some other 3rd party API call that calls into the host application or operating systems threading functions.
It may be possible to simulate a wait by having code execute on a frequent event (such as text arriving at the chat window) and then in the event handler checking to see if enough time has passed to permit executing the next command in the sequence. This probably wouldn't be a very accurate timer and it would be rather complex as you'd have to create a data structure to hold the sequence of commands, the timings between each, the current command, etc. and so on.
This may be an intentional limitation of the API to prevent in game automation (botting).
What has worked for me is to have a global variable that is incremented through the loop. Such as
Integer count = 0;
function Button2_OnClick()
i++
switch
case(1)
PlaySoundFile("Interface\\Addons\\Fart\\common_fart[1].wav");
case(2)
DoEmote("moon");
case(3)
DoEmote("sit");
case(4)
DoEmote("dance");
case(5)
DoEmote("beckon");
default
i=0;
end
end
What you would have to do then is to click the button multiple times, but you would get the effect you're going for.
I would suggest you wait some time before doing the next emote. As far as I know, the server disconnects you if you spam too much. This might just trigger it sometimes.
Besides that, I guess maybe the client has a way of preventing it? In either case, I would suggest you add some sort of fraction-of-a-second delay between the emotes.
Cheers,
Amit Ron
Could it be that the last two can't be done while sitting?
infact, integer i = 0, because defining integer 'count' and then using i is incorrect. :)