CMD specifying columns to save? - variables

I looked at a code by someone previously and saw them do code that went like:
set Today=%DATE:~0,3%
And if the variable (%DATE%) was executed (echo %DATE%) it would come out with the first 3 letters of the date it was, this worked for other commands such as %TIME%, etc... But I was wondering if it was possible to specify what it takes instead of a first section, the reason I want this is cause I am attempting to make a logging system that logs with the times and date, though the %time% variable consists of colons, which can't be put as folder names,
Some attempts:
set Today=%TIME:~0,2 ~4,5%
set Today=%TIME:~0,2:4,5%
The list goes on, so to specify in more detail what I want, it is simply a way to take only the numbers of the %time% variable, or to remove the colons with a filtering method, if either are possible or you have a suggestion, please go ahead and tell me.
Thanks for reading. :)

You can't specify multiple regions from the variable but it is very easy to accomplish what you want:
set Today=%TIME:~0,2%%TIME:~3,2%
I assume you see the pattern...
Remember that DATE and TIME might look different on different locals so this may work fine on your local system but not if you go to a different system or change your local settings!
Reference: set /?

Related

Setting up multiple schedules for a ResourcePool

I am doing a simulation of a production line, which is built through Excel.
Now there is one, which needs free setting of worker shifts for each machine, three shifts in total.
My idea is to create three different Schedules, representing each of the three shifts, and then in the ResourcePool, use the If statement to set up the use of each shift. As shown in the picture enter image description here
But it didn't work. If it is possable, Could you please tell me if there is something wrong with the Java statement or the idea is wrong.
If possible, could you please tell me how to set multiple schedules in ResourcePool?
Additions to the question:
The model is to do the evaluation of the production system and the shift of the workers is an important evaluation parameter. What I want to do is to enter the shift of the workers directly in the Excel sheet and ResourcePool recognizes and uses the corresponding Schedule.
I tried to generate the corresponding Schedule by code, but the Schedule of Resourcepool cannot be set dynamically. So I would like to try to manually input multiple Schedules into the model and then set the corresponding Schedule in ResourcePool by If statement like the image.
Thanks in advance
The first thing you need to know is that the location where you placed the code is a static parameter, thus it is only evaluated once, when the object is created and not checked continuously.
This is indicated by the little popup when you hover over the button that change the entry field from code to value
If it was dynamic it would state Dynamic Value instead of Static Value
Secondly, inside that field you must use a ternary operator, not an if statement, so that the result of the formula is a scheduled object, else you will get a "misplaced construct(s)" error
If you changed the code to
v_Shift == "Shift1" ?
s_Shift1 : v_Shift == "Shift2" ? s_Shift2 : s_Shift3
It will work BUT:
It will only be evaluated when the object is created and not again
Rather not use == on Strings, always use .equals(), on Strings it might work, and sometimes it might not. You can do some research as to why ;-)
Solution: You will have to use a function to change the schedule of the resource pool. Call this function whenever the v_Shift variable changes

How to execute if there's a certain block within a radius

I'm trying to figure out how to execute (for example /say hi) when there's Yellow Terracotta in a certain radius or field, however I can't figure out how to do it.
Anyone knows?
Using Minecraft 1.16,
"Execute" command has several syntax options. You can use the form "execute if block run "
Using the proper block name, we can get:
execute if block 1015 63 989 minecraft:yellow_glazed_terracotta run say hi
This targets a specific position.
I am a little less clear on how to achieve specifically what you are asking, but here are my thoughts:
The syntax provides for another form "execute if blocks..." This form allows you to select a range by corners, but it must be compared against a third selection of the exact same size (only the corner can be specified). I think the regions must be exactly the same, and may not allow for random placement of the block anywhere within the region.
Another way might be using different execute if commands instead to select an entity, and test where the entity is standing.
If you put a button on a command block and set it to:
execute at #p if block ~ ~-1 ~ minecraft:yellow_glazed_terracotta run say hi
When the player hits the button on the command block (obviously they must be within range of the button to press it) it shall check if the block -1 under the #p is "yellow_glazed_terracotta", and it will run say hi.
#p can be modified with [distance=..3] which means the player targeted by the command block must be within 3 blocks of the command block:
execute at #p[distance=..3] if block ~ ~-1 ~ minecraft:yellow_glazed_terracotta run say hi
So, this is sort of creating that range that you were looking for.
Some sources use "execute as #a at #s..." as a way to target any player when they step on a certain block anywhere at anytime. It may be possible to modify this into a distance as well, but it seems that the player will need to stand at a specific relative position to the terracotta.
If I find a better way to achieve this, I'll follow up.
The subreddit r/MinecraftCommands has a decent community that messes with Minecraft commands and command blocks. They may have further insight.
If I find a better way to achieve this, I'll follow up.
Edit- The only other thing I can think at this point is to take the first command I suggested and repeat it for every single coordinate in an area. If a terracotta block is any of those spaces, it will run the say hi command.
If you place all of these command lines into a function file you can call for the function when the command block is activated.

Maya crashes when duplicate special

I try to make instance copies of my character using Duplicate Special. But unfortunately it crashes every time I try.
For this I select my character's group "rig_group", then go to Edit → Duplicate Special ⊡
And I want to use these settings:
And it crashes Maya when I hit "Apply" or "Duplicate Special".
Note that it works on this character on a fresh file.
Test file - M01_WalkNeutral.0080.mb
Remember that duplicate special doesn't work properly on rig's. You can use duplicate special for polygons, curves or etc.
Ps. If you wanted to duplicate special a high-poly mesh I would say that to reduce the vertex then run that but about rig_group I'm not sure.
I hope to help that to you.

Extracting information from a file variable in d3 pick basic

I have a file variable in d3 pick basic and I am trying to figure out what file it corresponds to.
I tried the obvious thing which was to say:
print f *suppose the file variable's name is f in this case
but that didn't work, because:
SELECTION: 58[B34] in program "FILEPRINTER", Line 7: File variable used
where string expression expected.
I also tried things like:
list f *didn't compile
execute list dict f *same error
execute list f *same error
but those also did not work.
In case any one is wondering, the reason I am trying to do this in the first place is that there is a global variable that is passed up and down in the code base I am working with, but I can't find where the global variable gets its value from.
That file pointer variable is called a "file descriptor". You can't get any information from it.
You can use the file-of-files to log Write events, and after a Write is performed by the code, check to see what file was updated. The details for doing this would be a bit cumbersome. You really should rely on the Value-Add Reseller or contract with competent assistance for this.
If this is not a live end-user system, you can also modify an item getting written with some very unique text like "WHAT!FILE!IS!THIS?". Then you can do a Search-System command to search the entire account (or system) to find that text. See docs for proper use of that command.
This is probably the best option... Inject the following:
IF #USER = "CRISZ" THEN ; * substitute your user ID
READU FOO FROM F,"BLAH" ELSE
DEBUG
RELEASE F,"BLAH"
END
END
That code will stop only for one person - for everyone else it will flow as normal. When it does stop, use the LIST-LOCKS command to see which file has a read lock for item "BLAH". That's your file! Don't forget to remove and recompile the code. Note that recompiling code while users are actively using it results in aborts. It's best to do this kind of thing after hours or on a test system.
If you can't modify the code like that, diagnostics like this can be difficult. If the above suggestions don't help, I think this challenge might be beyond your personal level of experience yet and recommend you get some help.
If suggestion here Does help, please flag this as the answer. :)

Linux Kernel Process Management

First, i admit all the things i will ask are about our homework but i assure you i am not asking without struggling at least two hours.
Description: We are supposed to add a field called max_cpu_percent to task_struct data type and manipulate process scheduling algorithm so that processes can not use an higher percentage of the cpu.
for example if i set max_cpu_percent field as 20 for the process firefox, firefox will not be able to use more than 20% of the cpu.
We wrote a system call to set max_cpu_percent field. Now we need to see if the system call works or not but we could not get the value of the max_cpu_percent field from a user-spaced program.
Can we do this? and how?
We tried proc/pid/ etc can we get the value using this util?
By the way, We may add additional questions here if we could not get rid of something else
Thanks All
Solution:
The reason was we did not modify the code block writing the output to the proc queries.
There are some methods in array.c file (fs/proc/array.c) we modified the function so that also print the newly added fields value. kernel is now compiling we'll see the result after about an hour =)
It Worked...
(If you simply extended getrlimit/setrlimit, then you'd be done by now…)
There's already a mechanism where similar parts of task_struct are exposed: /proc/$PID/stat (and /proc/$PID/$TID/stat). Look for functions proc_tgid_stat and proc_tid_stat. You can add new fields to the ends of these files.