When I try to run any c++ program in vs code an exception occur and do not run the program
Oops, something went wrong. Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
-----------------------------------------------------------------------
Last 101 Keys:
c d Space " c : \ U s e r s \ U S E R
\ D o c u m e n t s \ p r o g r a m m i n g \ " Space ; Space i f Space ( $ ?
) Space { Space g + + Space c o d e 2 . c p p Space - o Space c o d e 2 Space
} Space ; Space i f Space ( $ ? ) Space { Space . \ c o d e 2 Space } Enter
Exception:
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: left
Actual value was -1.
at System.Console.SetCursorPosition(Int32 left, Int32 top)
at Microsoft.PowerShell.Internal.VirtualTerminal.set_CursorLeft(Int32 value)
at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable`1 key, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)
-----------------------------------------------------------------------
By using manual command in terminal , I can run my c++ program.
I can find some issues in vscode github repository about this problem but can not understand any solution
I have a simple problem below
f2:{[x;y]
r:sum(x)*sum(y);
r
};
tm:([] pr:(100.01 100.02;100.03 100.04); rv:(15.72 55.64; 16.92 15.17 12.21 34.99))
f2 each [tm`rv][tm`pr]
The result I get is
{[x;y]
r:sum(x)*sum(y);
r
}[(15.72 55.64;16.92 15.17 12.21 34.99)'[(100.01 100.02;100.03 100.04)]]
The result I want is to add tm`rv and add tm`pr and multiply.
tm
pr rv
-------------------------------------
100.01 100.02 15.72 55.64
100.03 100.04 16.92 15.17 12.21 34.99
Hi, you can sum each nested list then do the multiplication:
select result:(sum each pr)*sum each rv from tm
result
--------
14274.14
15863.55
q)
But if you want to use your f2 function:{[x;y] r:sum(x)*sum(y); r }
You should do this:
f2'[tm`rv;tm`pr]
14274.14 15863.55
q)
' apply f2 over pairwise combinations of arguments
When we have repeated measurements on an experimental unit, typically these units cannot be considered 'independent' and need to be modeled in a way that we get valid estimates for our standard errors.
When I compare the intervals obtained by computing the marginal means for the treatment using a mixed model (treating the unit as a random effect) and in the other case, first averaging over the unit and THEN runnning a simple linear model on the averaged responses, I get the exact same uncertainty intervals.
How do we incorporate the uncertainty of the measurements of the unit, into the uncertainty of what we think our treatments look like?
In order to really propogate all the uncertainty, shouldn't we see what the treatment looks like, averaged over "all possible measurements" on a unit?
``` r
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(emmeans)
library(lme4)
#> Loading required package: Matrix
library(ggplot2)
tmp <- structure(list(treatment = c("A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "B", "B",
"B", "B", "B", "B"), response = c(151.27333548, 162.3933313,
159.2199999, 159.16666725, 210.82, 204.18666667, 196.97333333,
194.54666667, 154.18666667, 194.99333333, 193.48, 191.71333333,
124.1, 109.32666667, 105.32, 102.22, 110.83333333, 114.66666667,
110.54, 107.82, 105.62000069, 79.79999821, 77.58666557, 75.78666928
), experimental_unit = c("A-1", "A-1", "A-1", "A-1", "A-2", "A-2",
"A-2", "A-2", "A-3", "A-3", "A-3", "A-3", "B-1", "B-1", "B-1",
"B-1", "B-2", "B-2", "B-2", "B-2", "B-3", "B-3", "B-3", "B-3"
)), row.names = c(NA, -24L), class = c("tbl_df", "tbl", "data.frame"
))
### Option 1 - Treat the experimental unit as a random effect since there are
### 4 repeat observations for the same unit
lme4::lmer(response ~ treatment + (1 | experimental_unit), data = tmp) %>%
emmeans::emmeans(., ~ treatment) %>%
as.data.frame()
#> treatment emmean SE df lower.CL upper.CL
#> 1 A 181.0794 10.83359 4 151.00058 211.1583
#> 2 B 101.9683 10.83359 4 71.88947 132.0472
#ggplot(.,aes(treatment, emmean)) +
#geom_pointrange(aes(ymin = lower.CL, ymax = upper.CL))
### Option 2 - instead of treating the unit as random effect, we average over the
### 4 repeat observations, and run a simple linear model
tmp %>%
group_by(experimental_unit) %>%
summarise(mean_response = mean(response)) %>%
mutate(treatment = c(rep("A", 3), rep("B", 3))) %>%
lm(mean_response ~ treatment, data = .) %>%
emmeans::emmeans(., ~ treatment) %>%
as.data.frame()
#> treatment emmean SE df lower.CL upper.CL
#> 1 A 181.0794 10.83359 4 151.00058 211.1583
#> 2 B 101.9683 10.83359 4 71.88947 132.0472
#ggplot(., aes(treatment, emmean)) +
#geom_pointrange(aes(ymin = lower.CL, ymax = upper.CL))
### Whether we include a random effect for the unit, or average over it and THEN model it, we find no difference in the
### marginal means for the treatments
### How do we incoporate the variation of the repeat measurments to the marginal means of the treatments?
### Do we then ignore the variation in the 'subsamples' and simply average over them PRIOR to modeling?
<sup>Created on 2021-07-31 by the [reprex package](https://reprex.tidyverse.org) (v2.0.0)</sup>
emmeans() does take into account the errors of random effects. This is what I get when I remove the complex sequences of pipes:
> mmod = lme4::lmer(response ~ treatment + (1 | experimental_unit), data = tmp)
> emmeans(mmod, "treatment")
treatment emmean SE df lower.CL upper.CL
A 181 10.8 4 151.0 211
B 102 10.8 4 71.9 132
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
This is as shown. If I fit a fixed-effects model that accounts for experimental units as a fixed effect, I get:
> fmod = lm(response ~ treatment + experimental_unit, data = tmp)
> emmeans(fmod, "treatment")
NOTE: A nesting structure was detected in the fitted model:
experimental_unit %in% treatment
treatment emmean SE df lower.CL upper.CL
A 181 3.25 18 174.2 188
B 102 3.25 18 95.1 109
Results are averaged over the levels of: experimental_unit
Confidence level used: 0.95
The SEs of the latter results are considerably lower, and that is because the random variations in experimental_unit are modeled as fixed variations.
Apparently the piping you did accounts for the variation of the random effects and includes those in the EMMs. I think that is because you did things separately for each experimental unit and somehow combined those results. I'm not very comfortable with a sequence of pipes that is 7 steps long, and I don't understand why that results in just one set of means.
I recommend against the as.data.frame() at the end. That zaps out annotations that can be helpful in understanding what you have. If you are doing that to get more digits precision, I'll claim that those are digits you don't need, it just exaggerates the precision you are entitled to claim.
Notes on some follow-up comments
Subsequently, I am convinced that what we see in the piped operations in the second part of the OP doe indeed comprise computing the mean of each EU, then analyzing those.
Let's look at that in the context of the formal model. We have (sorry MathJax doesn't work on stackoverflow, but I'll leave the markup there anyway)
$$ Y_{ijk} = \mu + \tau_i + U_{ij} + E_{ijk} $$
where $Y_{ijk}$ is the kth response measurement on the ith treatment and jth EU in the ith treatment, and the rhs terms represent respectively the overall mean, the (fixed) treatment effects, the (random) EU effects, and the (random) error effects. We assume the random effects are all mutually independent. With a balanced design, the EMMs are just the marginal means:
$$ \bar Y_{i..} = \mu + \tau_i + \bar U_{i.} + \bar E_{i..} $$
where a '.' subscript means we averaged over that subscript. If there are n EUs per treatment and m measurements on each EU, we get that
$$ Var(\bar Y_{i..} = \sigma^2_U / n + \sigma^2_E / mn $$
Now, if we aggregate the data on EUs ahead of time, we are starting with
$$ \bar Y_{ij.} = \mu + U_{ij} + \bar E_{ij.} $$
However, if we then compute marginal means by averaging over j, we get exactly the same thing as we did before with $\bar Y_{i..}$, and the variance is exactly as already shown. That is why it doesn't matter if we aggregated first or not.
I would like to import a table from another postgress database (9.1.7) to mine which is (9.1.11). I tried to import the dump but I get a bunch of syntax errors, I'm assuming there is some issue with the version mismatch?
Is there a better solution other than downgrading my postgress installation to match the desired input file?
This is the command I used to export the database on the 9.1.7 system:
pg_dump superdb -U tester -a -t guidedata > /tmp/guidedata.sql
This is the command I used to import the dump file guidedata.sql
psql linuxdb -U tester -h localhost < guidedata.sql
This is the top portion of the database dump file which I am attempting to import:
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET search_path = public, pg_catalog;
--
-- Data for Name: epg; Type: TABLE DATA; Schema: public; Owner: spy
--
COPY epg (id, channel, sdate, stime, duration, stitle, ltitle, theme, sdesc, ldesc, mpaa, rating, stereo, surround, sap, closedcaptioned, animated, blackwhite, rerun, live, ismovie, nudity, language, violence, adulttheme, halfstars, field1) FROM stdin;
90056520 AMC 01092014 0100 270 Titanic Titanic 8,15 A woman falls for an artist aboard the ill-fated ship. Leonardo DiCaprio, Kate Winslet (1997) A society girl abandons her haughty fiance for a penniless artist on the ill-fated ship's maiden voyage. (3:15) MPAAPG13 TVPG f f f t f f t f t t t t t 8 f
90056521 AMC 01092014 0530 180 Love Actually Love Actually 23,15 Various people deal with relationships in London. Hugh Grant, Laura Linney (2003) A prime minister, an office worker, a pop star, a jilted writer, married couples and various others deal with relationships in London. (2:15) MPAAR TVPG f f t t f f t f t t t f t 6 f
90056522 AMC 01092014 0830 150 Four Four Weddings and a Funeral 23,15 An English charmer meets a lusty American. Hugh Grant, Andie MacDowell (1994) An English charmer and a lusty American make love over a course of surprising events. (1:56) MPAAR TV14 f f t t f f t f t f t f t 7 f
90056523 AMC 01092014 1100 30 Paid Prog. Paid Programming 0 Paid programming. Paid programming. f f f f f f t f f f f f f 0 f
90056524 AMC 01092014 1130 30 Williams Montel Williams 19 Living well with Montel and the effects of identity theft. Living well with Montel and the devastating effects of identity theft. f f f f f f t f f f f f f 0 f
90056525 AMC 01092014 1200 30 Cindy Crawford Cindy Crawford Reveals Secret to Ageless Beauty 19 Cindy Crawford's skin secret with Meaningful Beauty. Cindy Crawford's supermodel secret to youthful, radiant-looking skin with Meaningful Beauty. f f f f f f t f f f f f f 0 f
90056526 AMC 01092014 1230 30 More Sex More Sex, Less Stress 19 Androzene promotes male sexual health & nourishes the body. Androzene promotes male sexual health and nourishes the body. f f f f f f t f f f f f f 0 f
90056527 AMC 01092014 1300 30 WEN Hair Care WEN by Chaz Dean Revolutionary Hair Care System 19 WEN by Chaz Dean is revolutionary hair care. WEN by Chaz Dean is revolutionary hair care that cleans and conditions without many shampoo's harsh detergents or sulfates. Natural ingredients help make hair shinier, fuller, softer and more manageable! By trusted GuthyRenker. f f f f f f t f f f f f f 0 f
90056528 AMC 01092014 1330 30 Medicare Looking for a Medicare plan? Tune in now! 19 Watch and learn about Humana Medicare Advantage plans. Watch and learn about Humana Medicare Advantage plans. f f f f f f t f f f f f f 0 f
90056529 AMC 01092014 1400 5 Stooges The Three Stooges 6 The caveman boys meet cavewomen. Moe Howard, Larry Fine ''I'm a Monkey's Unc
Here is some of the error output I see on the console when attempting to import:
ERROR: syntax error at or near "Route"
LINE 1: Route 66 renovation gives Ron a change of heart. TVPG t f f...
^
ERROR: syntax error at or near "Ron"
LINE 1: Ron and Jason bring out the Pontiac GTO. TVPG t f f t f f t...
^
ERROR: syntax error at or near "repairing"
LINE 1: repairing the clutch and drive shaft on the 1995 BMW. TVPG ...
^
ERROR: syntax error at or near "classic"
LINE 1: classic Bucik;
Thanks
My guess - one system is linux/unix/mac and the other is Windows.
It's complaining about the first line of the block of data because there is a stray carriage-return (\r) character.
Solution: use the (recommended unless you have a good reason not to) "custom" format with -Fc or --format=custom on your dump command. That should sort it.
I am working on a project(I have to implement it in Perl but I am not good at it) that reads DNA and finds its RNA. Divide that RNA's into triplets to get the equivalent protein name of it. I will explain the steps:
1) Transcribe the following DNA to RNA, then use the genetic code to translate it to a sequence of amino acids
Example:
TCATAATACGTTTTGTATTCGCCAGCGCTTCGGTGT
2) To transcribe the DNA, first substitute each DNA for it’s counterpart (i.e., G for C, C for G, T for A and A for T):
TCATAATACGTTTTGTATTCGCCAGCGCTTCGGTGT
AGTATTATGCAAAACATAAGCGGTCGCGAAGCCACA
Next, remember that the Thymine (T) bases become a Uracil (U). Hence our sequence becomes:
AGUAUUAUGCAAAACAUAAGCGGUCGCGAAGCCACA
Using the genetic code is like that
AGU AUU AUG CAA AAC AUA AGC GGU CGC GAA GCC ACA
then look each triplet (codon) up in the genetic code table. So AGU becomes Serine, which we can write as Ser, or
just S. AUU becomes Isoleucine (Ile), which we write as I. Carrying on in this way, we get:
SIMQNISGREAT
I will give the protein table:
So how can I write that code in Perl? I will edit my question and write the code that what I did.
Try the script below, it accepts input on STDIN (or in file given as parameter) and read it by line. I also presume, that "STOP" in the image attached is some stop state. Hope I read it all well from that picture.
#!/usr/bin/perl
use strict;
use warnings;
my %proteins = qw/
UUU F UUC F UUA L UUG L UCU S UCC S UCA S UCG S UAU Y UAC Y UGU C UGC C UGG W
CUU L CUC L CUA L CUG L CCU P CCC P CCA P CCG P CAU H CAC H CAA Q CAG Q CGU R CGC R CGA R CGG R
AUU I AUC I AUA I AUG M ACU T ACC T ACA T ACG T AAU N AAC N AAA K AAG K AGU S AGC S AGA R AGG R
GUU V GUC V GUA V GUG V GCU A GCC A GCA A GCG A GAU D GAC D GAA E GAG E GGU G GGC G GGA G GGG G
/;
LINE: while (<>) {
chomp;
y/GCTA/CGAU/; # translate (point 1&2 mixed)
foreach my $protein (/(...)/g) {
if (defined $proteins{$protein}) {
print $proteins{$protein};
}
else {
print "Whoops, stop state?\n";
next LINE;
}
}
print "\n"
}