I have a file like this:
define service {
host_name MyHOST
service_description Uptime
obsess_over_service 1
low_flap_threshold 0.000000
high_flap_threshold 0.000000
stalking_options n
freshness_threshold 5
}
define service {
host_name MyHOST
service_description Users - Memory usage
event_handler notify-service-by-email
obsess_over_service 1
low_flap_threshold 0.000000
high_flap_threshold 0.000000
stalking_options n
freshness_threshold 5
notes_url rrd2graph.cgi?hostname=$HOSTNAME$&service=$SERVICEDESC$
}
define service {
host_name MyHOST
service_description Users - Nr of Processes
event_handler notify-service-by-email
obsess_over_service 1
low_flap_threshold 0.000000
high_flap_threshold 0.000000
stalking_options n
freshness_threshold 5
notes_url rrd2graph.cgi?hostname=$HOSTNAME$&service=$SERVICEDESC$
}
define service {
host_name MyHOST
service_description Users - Processor usage
event_handler notify-service-by-email
obsess_over_service 1
low_flap_threshold 0.000000
high_flap_threshold 0.000000
stalking_options n
freshness_threshold 5
notes_url rrd2graph.cgi?hostname=$HOSTNAME$&service=$SERVICEDESC$
}
and I want to retrieve the text in between { and } where I match host_name and service_description.
What I have tried but it only returns the host_name, service_description and freshness_threshold:
sed -n -e "/define service[[:space:]]*{/,/}/ {
/host_name/ h
/service_description/ H
/freshness_threshold/G
s/freshness_threshold.*$HOST.*service_description.*$SERVICE.*$/\0/p
}" objects.cache
With awk:
awk -v RS="define service {|}" '/host_name *HOST/ && /service_description *SERVICE/' File
Eample:
awk -v RS="define service {|}" '/host_name *MyHOST/ && /service_description *Users - Memory usage/' File
host_name MyHOST
service_description Users - Memory usage
event_handler notify-service-by-email
obsess_over_service 1
low_flap_threshold 0.000000
high_flap_threshold 0.000000
stalking_options n
freshness_threshold 5
notes_url rrd2graph.cgi?hostname=$HOSTNAME$&service=$SERVICEDESC$
Related
I've been trying to render this model in ARKit: https://free3d.com/3d-model/traditional-ceiling-light-485.html. I have OBJ/MTL files for both the on and off version of the light. When I render them in Blender, they look like this:
When I drop them into my ARKit test app, however, they look like this:
In Blender, you can clearly see that the "on" version of the light is kind of glowing whereas in ARKit both models look exactly the same. I'm guessing that the MTL file contains something that ARKit does not support. The MTL on the "on" version is as follows:
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 19.03.2018 16:33:20
newmtl Traditional_Ceiling_Light_Metal
Ns 100.000000
Ni 15.000000
d 1.000000
Tr 0.000000
Tf 1.000000 1.000000 1.000000
illum 2
Ka 0.588000 0.588000 0.588000
Kd 0.500000 0.500000 0.500000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
map_Ka Traditional_Ceiling_Light_Visual_Diffuse.png
map_Kd Traditional_Ceiling_Light_Visual_Diffuse.png
map_Ks Traditional_Ceiling_Light_Visual_Specular.png
map_bump Traditional_Ceiling_Light_Visual_Normal.png
bump Traditional_Ceiling_Light_Visual_Normal.png
newmtl Traditional_Ceiling_Light_Glass
Ns 100.000000
Ni 1.600000
d 1.000000
Tr 0.000000
Tf 1.000000 1.000000 1.000000
illum 2
Ka 0.588000 0.588000 0.588000
Kd 0.500000 0.500000 0.500000
Ks 0.000000 0.000000 0.000000
Ke 7.500000 7.500000 7.500000
map_Ka Traditional_Ceiling_Light_Visual_Diffuse.png
map_Kd Traditional_Ceiling_Light_Visual_Diffuse.png
map_Ks Traditional_Ceiling_Light_Visual_Specular.png
map_Ke Traditional_Ceiling_Light_Visual_Emissive.png
map_bump Traditional_Ceiling_Light_Visual_Normal.png
bump Traditional_Ceiling_Light_Visual_Normal.png
newmtl Traditional_Ceiling_Light
Ns 100.000000
Ni 1.600000
d 1.000000
Tr 0.000000
Tf 1.000000 1.000000 1.000000
illum 2
Ka 0.588000 0.588000 0.588000
Kd 0.500000 0.500000 0.500000
Ks 0.000000 0.000000 0.000000
Ke 7.500000 7.500000 7.500000
map_Ka Traditional_Ceiling_Light_Visual_Diffuse.png
map_Kd Traditional_Ceiling_Light_Visual_Diffuse.png
map_Ks Traditional_Ceiling_Light_Visual_Specular.png
map_Ke Traditional_Ceiling_Light_Visual_Emissive.png
map_bump Traditional_Ceiling_Light_Visual_Normal.png
bump Traditional_Ceiling_Light_Visual_Normal.png
Is it simply the case that ARKit can't render this model properly?
Looks like there is no light in your scene (or lighting environment) but it's hard to tell from your picture.
Make sure both assets have PBR materials and to get the best results, go through every single one of them. Pay close attention to the emission property, as obj files usually have them on white/clear grey. this is what will make the difference between the 2 objects. In fact, you only need to change the emissive property for 1 material to go from OFF to ON.
I have created a running windows process list to a text file using the command:
tasklist > c:\mytasklist.txt. The result something like this:
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
System Idle Process 0 Services 0 24 K
System 4 Services 0 12.408 K
smss.exe 320 Services 0 1.236 K
csrss.exe 424 Services 0 4.720 K
wininit.exe 516 Services 0 4.684 K
csrss.exe 524 Console 1 7.888 K
winlogon.exe 572 Console 1 7.764 K
services.exe 620 Services 0 9.532 K
and so on...
My question:
How I parsing the line on the text file, so I get output like the following format using Lua script:
PID - Process Name - Memory Usage
And the output automatic sorted by the biggest memory usage
local tasklist = io.popen"tasklist /fo csv /nh"
local list = {}
for line in tasklist:lines() do
local exe, pid, mem = line:match'^"(.-)","(%d+)",.-"([^"]+)"$'
table.insert(list, {pid = tonumber(pid), exe = exe, mem = tonumber((mem:gsub("%D", "")))})
end
tasklist:close()
table.sort(list, function(a, b) return a.mem > b.mem end)
for j = 1, math.min(10, #list) do
print(list[j].pid, list[j].mem, list[j].exe)
end
Output:
1036 549416 svchost.exe
4972 439524 firefox.exe
6540 214476 plugin-container.exe
7144 169268 OUTLOOK.EXE
532 75320 svchost.exe
1948 71644 avp.exe
3752 62704 svchost.exe
5268 61100 explorer.exe
596 56732 csrss.exe
5048 50248 CcmExec.exe
I want to use Matlab to replace every floating point number in a text file with another number. (let's say half the original value)
Other data (integer and string) should not change.
A few lines of my text file (each variable is in a new line):
VERTEX
8
0
10
0.000000
20
110.500000
42
0.000000
0
VERTEX
8
0
10
0.000000
20
0.000000
42
0.000000
0
VERTEX
8
0
10
124.000000
20
0.000000
42
0.000000
0
VERTEX
8
0
10
248.000000
20
0.000000
42
0.000000
0
VERTEX
8
0
10
248.000000
20
110.500000
42
0.000000
0
VERTEX
8
0
10
248.000000
20
221.000000
42
0.000000
0
Any help is appreciated.
Here is a solution using fgetl and regexp
rid = fopen('test.txt','r');
wid = fopen('test2.txt','w');
while ~feof(rid)
s = fgetl(rid); % read a line
if regexp(s, '\d+\.\d+') % float founded
fprintf(wid, '42\n'); % wite "another integer"
else
fprintf(wid, '%s\n', s); % write original data
end
end
fclose(rid);
fclose(wid);
I am use the following command to list all users and there pending jobs in LSF:
busers -w all
Example output:
USER/GROUP JL/P MAX NJOBS PEND RUN SSUSP USUSP RSV MPEND
aaaaa - - 0 0 0 0 0 0 200
bbbbb - - 100 50 50 0 0 0 200
ccccc - - 1 0 1 0 0 0 200
I'm looking for a command that will only display the users whose NJOBS value is greater than 0, i.e. those who have actually submitted at least one job.
In the example, that would mean that only the lines for users 'bbbbb' and 'ccccc' should appear.
To check all users jobs the simpler method would be:
bjobs -u all
To check suspended ones just use:
bjobs -u all | grep SUSP
When I ran the following code and killed it immediately(that means to abnormally exit), the CPU rate of Mongodb would go extremely high(around 100%):
#-*- encoding:UTF-8 -*-
import threading
import time
import pymongo
single_conn = pymongo.Connection('localhost', 27017)
class SimpleExampleThread(threading.Thread):
def run(self):
print single_conn['scrapy'].zhaodll.count(), self.getName()
time.sleep(20)
for i in range(100):
SimpleExampleThread().start()
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
VIRT RES SHR S %CPU %MEM TIME+ COMMAND
696m 35m 6404 S 1181.7 0.1 391:45.31 mongod
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
My Mongodb version is 2.2.3. When the Mongodb worked well, ran the command "strace -c -p " for 1 minute giving the following output:
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
33.50 0.322951 173 1867 nanosleep
33.19 0.319950 730 438 recvfrom
21.16 0.203969 16 12440 select
12.13 0.116983 19497 6 restart_syscall
0.02 0.000170 2 73 write
0.00 0.000016 0 146 sendto
0.00 0.000007 0 73 lseek
0.00 0.000000 0 2 read
0.00 0.000000 0 3 open
0.00 0.000000 0 3 close
0.00 0.000000 0 2 fstat
0.00 0.000000 0 87 mmap
0.00 0.000000 0 2 munmap
0.00 0.000000 0 1 pwrite
0.00 0.000000 0 3 msync
0.00 0.000000 0 29 mincore
0.00 0.000000 0 73 fdatasync
------ ----------- ----------- --------- --------- ----------------
100.00 0.964046 15248 total
When the cpu rate of Mongodb went very high(around 100%), ran the same command giving the following output:
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
29.12 5.064230 3088 1640 nanosleep
28.83 5.013239 27851 180 recvfrom
22.72 3.950399 658400 6 restart_syscall
19.30 3.356491 327 10268 select
0.02 0.004026 67 60 sendto
0.01 0.001000 333 3 msync
0.00 0.000269 9 30 write
0.00 0.000125 4 30 fdatasync
0.00 0.000031 10 3 open
0.00 0.000000 0 2 read
0.00 0.000000 0 3 close
0.00 0.000000 0 2 fstat
0.00 0.000000 0 30 lseek
0.00 0.000000 0 57 mmap
0.00 0.000000 0 2 munmap
0.00 0.000000 0 1 pwrite
0.00 0.000000 0 14 mincore
------ ----------- ----------- --------- --------- ----------------
100.00 17.389810 12331 total
And if I run the command "lsof", there are many socks with the description "can't identify protocol". I don't know what goes wrong. Are there some bugs in Mongodb?
Thanks!