Line numbers in dotnet-stack report - .net-core

With dotnet-stack report -p <pid> I can see the stack traces, but I don't see the line numbers. Is it possible to display line numbers (like jstack does)? Is there an alternative?

Try adding the following properties to csproj files:
<PropertyGroup>
<DebugSymbols>true</DebugSymbols>
<DebugType>embedded</DebugType>
<!-- The following is to fix error line numbers mismatch -->
<Optimize>false</Optimize>
</PropertyGroup>

Related

qmake: custom step for each make call

I can easily edit Makefile to add custom step. For example, I have a line:
first: release
If I change it to
first: pre-build release
Then I'll be able to place some operations after "pre-build:" label.
The question is how to write corresponding instruction to .pro file, to force qmake tool generate required lines in Makefile?
You can add a custom target to your resulting Makefile using QMAKE_EXTRA_TARGETS variable, kind of that:
QMAKE_EXTRA_TARGETS += beforebuild
beforebuild.commands = echo Hello world!
beforebuild.CONFIG = phony
However, you cannot put this target onto first: all line, unless you've patched qmake's source code (consider the following snippet from makefile.cpp: t << "first: " << targets.first()->target << endl).
In principle, it's possible to induce some dependency between all (or release / debug) and your beforebuild target, so beforebuild would still get executed by make automatically, as described in this article (Russian language). Yet the resulting solution seems to me too ugly and error-prone.
I think that simply executing make beforebuild first (probably, using a shell script) is much easier. Unless you're using Qt Creator, in this case you should try the recipe from the link above.

How can I use this shell command in control-m command line

How can I use shell command in control-m command line?
/Path/somescript.ksh 1>some.log 2>&1.
Thanks in advance
You can do it very easily like below:-
MEMLIB="/Path/" <!-- example "/usr/bin" -->
MEMNAME="somescript.ksh" <!-- example ls -->
<AUTOEDIT2 NAME="%%PARM1" VALUE="1>some.log"/>
<SHOUT DEST="xxx" MESSAGE="%%JOBNAME FAILED REVIEW DOC" URGENCY="U" WHEN="NOTOK"/>
<AUTOEDIT2 NAME="%%PARM2" VALUE="2>&1"/>
<SHOUT DEST="xxx" MESSAGE="*N*2 %%JOBNAME HAS FAILED, REVIEW DOC" URGENCY="V" WHEN="NOTOK"/>
Now in reality it will execute like:-
/Path/somescript.ksh 1>some.log 2>&1
Please let me know if you need any more help.

Passing multiple arguments to SQLite via Ant

I need to use both .separator and .import when calling SQLite from my Ant script but can't seem to get the syntax right. Based on an answer here on SO about doing the same in a bash script, my latest attempt is this.
<exec executable="sqlite3">
<arg value="${sqlite.db}" />
<arg value=".separator ';'\n.import ${data.dir}/DISTRICT_BOUNDARY.txt DISTRICT_BOUNDARY" />
</exec>
Unfortunately this results in the following error message.
Error: unknown command or invalid arguments: "separator". Enter ".help" for help
What is the proper syntax for what I am trying to do?
Final solution:
<exec executable="sqlite3" inputstring=".separator ';'
.import ${data.dir}/METADATA_DESCRIPTION.txt METADATA_DESCRIPTION">
<arg value="${sqlite.db}" />
</exec>
It appears that you can't pass meta-commands (i.e., commands that start with a .) via the final argument to sqlite3; only actual SQL statements seem to work there[*]. There are two possible fixes; either write the meta-commands to a file and use the -file filename option (two arguments, before database name) to load them, or pass the whole multi-statement set of instructions in on sqlite3's standard input. This second option should be simpler for you to implement with ant, via the inputstring parameter:
<exec executable="sqlite3" inputstring=".separator ';'
.import ${data.dir}/DISTRICT_BOUNDARY.txt DISTRICT_BOUNDARY">
<arg value="${sqlite.db}" />
</exec>
Yes, that has a real newline in it. Unlike real SQL statements, you can't separate meta-commands with semicolons. You may encode the newline as
if you wish.
[*] Actually, a single meta-command would work, but you can't put two.
I think Ant is interpreting the single quotes in your second arg value as string delimiters. Try escaping the single quotes:
<arg value=".separator \';\'\n.import${data.dir}/DISTRICT_BOUNDARY.txt DISTRICT_BOUNDARY" />
I'm not familiar with SQLite syntax, but the .import parameter may also need to be a separate arg value.

xml parsing error xml or text declaration not at start of entity in wordpress feed

i'm getting following error in my wordpress site,
XML Parsing Error: XML or text declaration not at start of entity
Location: http://www.domain.com/news/feed/rss/
Line Number 3, Column 3: <?xml version="1.0" encoding="UTF-8"?><rss version="0.92">
----------------^
i have tried almost all solutions found via google, also tried the answers of same questions here in stackoverflow, but still i'm getting this error.
do any one have any idea about how to come out of it??
Try installing fix-rss-feed plugin.
Also I think you have a space before <?xml version="1.0" encoding="UTF-8"?>. Getting rid of it should do the trick.
fix-rss-feed plugin is outdated. I had the same problem with the RSS feeds, try the solution provided here http://wejn.org/stuff/wejnswpwhitespacefix.php.html it works like charm!
In my opinion, rather than using a plugin, a better solution would be to remove all trailing white space across all PHP files in your theme directory. In a terminal window run:
cd yoursite/wp-content/themes/yourtheme
then run
find ./ -name "*.php" -exec sed -i -e '/^\n*$/d' {} \;
After that runs, try navigating to yoursite.com/feed

simple shell script in cygwin

#!/bin/bash
echo 'first line' >foo.xml
echo 'second line' >>foo.xml
I am a total newbie to shell scripting.
I am trying to run the above script in cygwin. I want to be able to write one line after the other to a new file.
However, when I execute the above script, I see the follwoing contents in foo.xml:
second line
The second time I run the script, I see in foo.xml:
second line
second line
and so on.
Also, I see the following error displayed at the command prompt after running the script:
: No such file or directory.xml
I will eventually be running this script on a unix box, I am just trying to develop it using cygwin. So I would appreciate it if you could point out if it is a cygwin oddity and if so, should I avoid trying to use cygwin for development of such scripts?
Thanks in advance.
Run dos2unix on your shell script. That will fix the problem.
I had the same kind of problem as the original poster: A very simple script file was not working in Cygwin.
Thanks to Don Branson for the clue.
The fix for me was built into the text editor I'm using. (Most programmer's editors have a feature like this.) For example, in my case I'm using Notepad++, which has a menu item to convert the file line endings to Unix-style. From the menu: [Edit]->[EOL Conversion]->[Unix (LF)]
Then the script behaved as expected.
But there must be something else that is wrong here. When I try it, it works as expected.
> foo.xml puts the line into foo.xml, replacing any previous contents.
>> foo.xml appends to file
It sounds like you may have a typo somewhere. Also keep in mind that while the Windows command prompt can be forgiving about paths with embedded spaces, cygwin's shells will not be, so if you have a filename that contains embedded spaces, you need to either quote the filename or escape the spaces:
echo 'first line' > 'My File.txt'
echo 'first line' > My\ File.txt
The same goes for certain "special" characters including quotes, ampersand (&), semicolons (;) and generally most punctuation other than period/full-stop (.).
So if you are seeing those issues using the exact script that you are running (i.e. you copy and pasted it, there is no possibility of transcription errors) then something truly strange may be happening that I can't explain. Otherwise, there may be a misplaced space or unquoted character somewhere.
I cannot reproduce your results. The script you quote looks correct, and indeed works as expected in my installation of Cygwin here, producing the file foo.xml containing the lines first line and second line; implying that what you are actually running differs from what you quoted in some way that is causing the problem.
The error message implies some sort of problem with the filename in the first echo line. Do you have some nonprintable characters in the script you are running? Have you missed escaping a space in the filename? Are you subsituting shell variables and mistyping the name of the variable or failing to escape the resulting string?
The above should work normally..
However you can always specify a heredoc:
#!/bin/bash
cat <<EOF > foo.xml
first line
second line
EOF

Resources