In my previous post, I brought up a question about Cyrillic symbols in R.
Today I have faced another one.
For example, we want to see our running processes:
test <- system2(command="tasklist",
stdout=TRUE,
stderr=TRUE,
wait = TRUE)
and what we see...
[1] ""
[2] "€¬п ®Ўа § PID €¬п бҐббЁЁ ь бҐ б Џ ¬пвм"
[3] "========================= ======== ================ =========== ============"
[4] "System Idle Process 0 Services 0 24 ЉЃ"
[5] "System 4 Services 0 580 ЉЃ"
***
"Iconv", which helped in the previous task - couldn't help here.
sys.setlocale - too.
What can solve this problem?
I found a solution.
#/c - Carries out the command specified by string and then stops.
command <- function(command,
intern = TRUE,
wait = FALSE)
system(paste("cmd.exe /c", command),
intern = T,
wait = wait)
#changing our charset
command("chcp 1251")
[1] "’ҐЄгй п Є®¤®ў п бва Ёж : 1251" //say bye-bye to mojibake)
# and voila!
command("tasklist")
[1] ""
[2] "Имя образа PID Имя сессии № сеанса Память"
[3] "========================= ======== ================ =========== ============"
[4] "System Idle Process 0 Services 0 24 КБ"
[5] "System 4 Services 0 580 КБ"
[6] "smss.exe 380 Services 0 1 232 КБ"
***
Related
I have a wordpress/woocommerce stack with a couple of plugins activated, once or twice a day MariaDB database (AWS RDS MariaDB 10.6) hangs and becomes completely unreachable to the point where I need to reboot the instance.
The error log shows too many connections errors and the connections indeed reach their max_connections value. I set up slow query logging to examine what happens when this occurs.
When the problem occured again, indeed the slow query log got written to the point where the RDS instance hanged again and needed a reboot.
It seems to be an update statement :
https://aws.amazon.com/rds/). started with:
Tcp port: 3306 Unix socket: /tmp/mysql.sock
Time Id Command Argument
# Time: 221108 14:00:54
# User#Host: wordpress[wordpress] # [10.0.0.191]
# Thread_id: 151359 Schema: wp_multisite_002 QC_hit: No
# Query_time: 50.027958 Lock_time: 0.050058 Rows_sent: 0 Rows_examined: 0
# Rows_affected: 0 Bytes_sent: 67
use wp_multisite_002;
SET timestamp=1667916054;
UPDATE `wp_2_options` SET `option_value` = '1668002404' WHERE `option_name` = '_transient_timeout_et_core_path';
# User#Host: wordpress[wordpress] # [10.0.0.191]
# Thread_id: 151362 Schema: wp_multisite_002 QC_hit: No
# Query_time: 50.053338 Lock_time: 0.050050 Rows_sent: 0 Rows_examined: 0
# Rows_affected: 0 Bytes_sent: 67
SET timestamp=1667916054;
UPDATE `wp_2_options` SET `option_value` = '1668002404' WHERE `option_name` = '_transient_timeout_et_core_path';
# Time: 221108 14:00:55
# User#Host: wordpress[wordpress] # [10.0.0.191]
# Thread_id: 151364 Schema: wp_multisite_002 QC_hit: No
# Query_time: 50.047369 Lock_time: 0.050090 Rows_sent: 0 Rows_examined: 0
# Rows_affected: 0 Bytes_sent: 67
SET timestamp=1667916055;
UPDATE `wp_2_options` SET `option_value` = '1668002405' WHERE `option_name` = '_transient_timeout_et_core_path';
# Time: 221108 14:00:58
# User#Host: wordpress[wordpress] # [10.0.0.191]
# Thread_id: 151371 Schema: wp_multisite_002 QC_hit: No
# Query_time: 50.001565 Lock_time: 0.050071 Rows_sent: 0 Rows_examined: 0
# Rows_affected: 0 Bytes_sent: 67
SET timestamp=1667916058;
Is there anyone who knows what could cause this and what's the use of this statement , google search on _transient_timeout_et_core_path doesn't give me much information.
I can't replicate the problem because I don't know what's the reason it occurs.
It does happen everyday, once or twice, also no excessive amounts of users , mostly 1 or 2 at the same time and I'm not even sure if anyone is actively using the site when it happens.
Thanks
I am trying to run the following command in ubuntu terminal
patch -p0 -i adjustmentFile.patch
That is giving the following error
patching file ./src/helpStructures/CastaliaModule.cc
patching file ./src/node/communication/mac/tunableMac/TunableMAC.cc
Hunk #2 FAILED at 456.
1 out of 2 hunks FAILED -- saving rejects to file ./src/node/communication/mac/tunableMac/TunableMAC.cc.rej
I tried almost all the ways suggested in the link Hunk #1 FAILED at 1. What's that mean?. However, nothing worked.
Here is my version detail
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 06 2019 17:31:41)
Included patches: 1-1453
The patch file:
diff -r -u ./src/helpStructures/CastaliaModule.cc ./src/helpStructures/CastaliaModule.cc
--- ./src/helpStructures/CastaliaModule.cc 2010-12-09 09:56:47.000000000 -0300
+++ ./src/helpStructures/CastaliaModule.cc 2011-12-20 00:16:39.944320051 -0300
## -180,6 +180,8 ##
classPointers.resourceManager = getParentModule()->getParentModule()->getSubmodule("ResourceManager");
else if (name.compare("SensorManager") == 0)
classPointers.resourceManager = getParentModule()->getSubmodule("ResourceManager");
+ else if (name.compare("Routing") == 0)
+ classPointers.resourceManager = getParentModule()->getParentModule()->getSubmodule("ResourceManager");
else
opp_error("%s module has no rights to call drawPower() function", getFullPath().c_str());
if (!classPointers.resourceManager)
Only in ./src/helpStructures: CastaliaModule.cc~
diff -r -u ./src/node/communication/mac/tunableMac/TunableMAC.cc ./src/node/communication/mac/tunableMac/TunableMAC.cc
--- ./src/node/communication/mac/tunableMac/TunableMAC.cc 2011-03-30 02:14:34.000000000 -0300
+++ ./src/node/communication/mac/tunableMac/TunableMAC.cc 2011-12-19 23:57:43.894686687 -0300
## -405,6 +405,8 ##
void TunableMAC::fromRadioLayer(cPacket * pkt, double rssi, double lqi)
{
TunableMacPacket *macFrame = dynamic_cast <TunableMacPacket*>(pkt);
+ macFrame->getMacRadioInfoExchange().RSSI = rssi;
+ macFrame->getMacRadioInfoExchange().LQI = lqi;
if (macFrame == NULL){
collectOutput("TunableMAC packet breakdown", "filtered, other MAC");
return;
## -454,7 +456,8 ##
}
case DATA_FRAME:{
- toNetworkLayer(macFrame->decapsulate());
+ cPacket *netPkt = decapsulatePacket(macFrame);
+ toNetworkLayer(netPkt);
collectOutput("TunableMAC packet breakdown", "received data pkts");
if (macState == MAC_STATE_RX) {
cancelTimer(ATTEMPT_TX);
Only in ./src/node/communication/mac/tunableMac: TunableMAC.cc~
Patching takes some changes made to a file X, and applies them to a different instance of file X. That is, suppose you start with generation 1 of file X; you make changes to get generation 2-a, and someone else starts with generation 1 to make generation 2-b. Now you want to take his edits that created his generation 2-b, and apply them to your generation 2-a.
If 'his' changes clash with 'your' changes, they cannot be automatically patched.
You'll need to look at the changes being made in hunk 2.
- toNetworkLayer(macFrame->decapsulate());
+ cPacket *netPkt = decapsulatePacket(macFrame);
+ toNetworkLayer(netPkt);
and figure out what you want the result to look like. Someone needs to know what the result is supposed to be. You can't resolve conflicts without knowledge of intent.
I was using the foreign package in R to import the MTP file, but it only shows file read error. I already set up the default directory, but it does not work. I would really appreciate if I could get some help. Thank you in advance.
library(foreign)
d44<-read.mtp("PERAGGR.MTP")
Here is the file that I was using
The read.mtp function is fairly ancient. And since that file is actually an ASCII file, just read it with `readLines:
d44<-readLines("~/Downloads/PERAGGR.MTP")
head(d44)
# ============== top of output==================
[1] "Minitab Portable Worksheet P1.1 2007 523 Rel 15.0 ."
[2] "% 3 1 109 0 Study ."
[3] " 1.000000000E+00 2.000000000E+00 3.000000000E+00 4.000000000E+00 5.000000000E+00"
[4] " 6.000000000E+00 7.000000000E+00 8.000000000E+00 9.000000000E+00 1.000000000E+01"
[5] " 1.100000000E+01 1.200000000E+01 1.300000000E+01 1.400000000E+01 1.500000000E+01"
[6] " 1.600000000E+01 1.700000000E+01 1.800000000E+01 1.900000000E+01 2.000000000E+01"
I'm running example programs (hello-world & pi) with mvapich2 2.2.
After computing I see info that looks like debug (in error thread).
output thread
Process 2 of 5 is on 37eff7e817ee
Process 0 of 5 is on cb1479885879
Process 4 of 5 is on 6511b189f06b
Process 1 of 5 is on 6511b189f06b
Process 3 of 5 is on cb1479885879
pi is approximately 3.1415926544231230, Error is 0.0000000008333298
wall clock time = 0.051757
errors thread
[2] 40 at [0x0000000001d8dd28], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1123]
[2] 136 at [0x0000000001d8dbf8], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1110]
[4] 40 at [0x0000000000df3868], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1123]
[4] 136 at [0x0000000000df3738], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1110]
[3] 40 at [0x0000000001bf32c8], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1123]
[3] 136 at [0x0000000001bf3198], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1110]
[0] 40 at [0x00000000012ebda8], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1123]
[0] 136 at [0x00000000013029b8], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1110]
[1] 40 at [0x0000000001514788], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1123]
[1] 136 at [0x0000000001514658], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1110]
Environment:
CentOS 7;
Mellanox MT25204;
mvapich2-2.2 (installed from yum).
screenshot
How can I disable it?
These prints are caused by memory leaks inside the MPI library or the application itself. It also shows that you are using a debug build of MVAPICH2. If you built MVAPICH2 yourself, remove the options --enable-g=all --enable-fast=none --disable-fast from configure. This will also improve your performance.
I am trying to accomplish a task using R to scrape data on a website.
I would like to go through each link on the following page:
http://capitol.hawaii.gov/advreports/advreport.aspx?year=2013&report=deadline&rpt_type=&measuretype=hb&title=House Bills
Select only items with Current Status showing "transmitted to the governor". For example, http://capitol.hawaii.gov/measure_indiv.aspx?billtype=HB&billnumber=17&year=2013
And then scrapping the cells within STATUS TEXT for the following clause" Passed Final Reading". For example: Passed Final Reading as amended in SD 2 with Representative(s) Fale, Jordan, Tsuji voting aye with reservations; Representative(s) Cabanilla, Morikawa, Oshiro, Tokioka voting no (4) and none excused (0).
I have tried using previous examples with packages Rcurl and XML (in R), but I don't know how to use them correctly for aspx sites. So what I would love to have is: 1. Some suggestion on how to build such a code. 2. And recommendation for how to learn the knowledge needed for performing such a task.
Thanks for any help,
Tom
require(httr)
require(XML)
basePage <- "http://capitol.hawaii.gov"
h <- handle(basePage)
GET(handle = h)
res <- GET(handle = h, path = "/advreports/advreport.aspx?year=2013&report=deadline&rpt_type=&measuretype=hb&title=House")
# parse content for "Transmitted to Governor" text
resXML <- htmlParse(content(res, as = "text"))
resTable <- getNodeSet(resXML, '//*/table[#id ="GridViewReports"]/tr/td[3]')
appRows <-sapply(resTable, xmlValue)
include <- grepl("Transmitted to Governor", appRows)
resUrls <- xpathSApply(resXML, '//*/table[#id ="GridViewReports"]/tr/td[2]//#href')
appUrls <- resUrls[include]
# look at just the first
res <- GET(handle = h, path = appUrls[1])
resXML <- htmlParse(content(res, as = "text"))
xpathSApply(resXML, '//*[text()[contains(.,"Passed Final Reading")]]', xmlValue)
[1] "Passed Final Reading as amended in SD 2 with Representative(s) Fale, Jordan,
Tsuji voting aye with reservations; Representative(s) Cabanilla, Morikawa, Oshiro,
Tokioka voting no (4) and none excused (0)."
Let package httr handle all the background work by setting up a handle.
If you want to run over all 92 links:
# get all the links returned as a list (will take sometime)
# print statement included for sanity
res <- lapply(appUrls, function(x){print(sprintf("Got url no. %d",which(appUrls%in%x)));
GET(handle = h, path = x)})
resXML <- lapply(res, function(x){htmlParse(content(x, as = "text"))})
appString <- sapply(resXML, function(x){
xpathSApply(x, '//*[text()[contains(.,"Passed Final Reading")]]', xmlValue)
})
head(appString)
> head(appString)
$href
[1] "Passed Final Reading as amended in SD 2 with Representative(s) Fale, Jordan, Tsuji voting aye with reservations; Representative(s) Cabanilla, Morikawa, Oshiro, Tokioka voting no (4) and none excused (0)."
$href
[1] "Passed Final Reading, as amended (CD 1). 25 Aye(s); Aye(s) with reservations: none . 0 No(es): none. 0 Excused: none."
[2] "Passed Final Reading as amended in CD 1 with Representative(s) Cullen, Har voting aye with reservations; Representative(s) McDermott voting no (1) and none excused (0)."
$href
[1] "Passed Final Reading, as amended (CD 1). 25 Aye(s); Aye(s) with reservations: none . 0 No(es): none. 0 Excused: none."
[2] "Passed Final Reading as amended in CD 1 with none voting aye with reservations; Representative(s) Hashem, McDermott voting no (2) and none excused (0)."
$href
[1] "Passed Final Reading, as amended (CD 1). 24 Aye(s); Aye(s) with reservations: none . 0 No(es): none. 1 Excused: Ige."
[2] "Passed Final Reading as amended in CD 1 with none voting aye with reservations; none voting no (0) and Representative(s) Say excused (1)."
$href
[1] "Passed Final Reading, as amended (CD 1). 25 Aye(s); Aye(s) with reservations: none . 0 No(es): none. 0 Excused: none."
[2] "Passed Final Reading as amended in CD 1 with Representative(s) Johanson voting aye with reservations; none voting no (0) and none excused (0)."
$href
[1] "Passed Final Reading, as amended (CD 1). 25 Aye(s); Aye(s) with reservations: none . 0 No(es): none. 0 Excused: none."
[2] "Passed Final Reading as amended in CD 1 with none voting aye with reservations; none voting no (0) and none excused (0)."