Icelandic language process in R - arrays

I'm a student doing some research with R.
I tried to put some icelandic language in array but R automatically convert this to english.
artist = vector()
artist[1] = "CHVRCHES"
artist[2] = "Fall-Out-Boy"
artist[3] = "Green-day"
artist[4] = "Sigur-Rós"
When I try to call 4th item of 'artist' array, console's output is like
Sigur-Ros
not
Sigur-Rós
Thus, I looked out for some question that might help me with encoding mess like
artist[4] = stri_conv("Sigur-Rós","","UTF-8")
or
artist[4] = iconv("Sigur-Rós","","UTF-8")
But console showed the same output.
I'm doing this on Rstudio and my R version is 3.1.2 . Workspace is Windows 8.1, 64-bit.
Can anyone know how to deal with this encoding problem? I really need some help.

Related

Biblatex doesn't compile. Probably .bib file not recognised

I've spent many hours trying to get my bibliography working - unsuccessfully. I suspect that, somehow, my .bib file doesn't get recognised.
Help would be greatly appreciated.
MWE:
\documentclass[a4paper, 12pt]{article}
\usepackage{array}
\usepackage{lscape}
\usepackage[paper=portrait,pagesize]{typearea}
\usepackage[showframe=false]{geometry}
\usepackage{changepage}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage[utf8]{inputenc}
\usepackage{babel,csquotes,xpatch}
\usepackage[backend=biber,style=authoryear, natbib]{biblatex}
\addbibresource{test.bib}
\usepackage{xurl}
\usepackage[colorlinks,allcolors=blue]{hyperref}
\begin{document}
This is a test... test test\\
\cite{glaeser_gyourko}\\
\cite{hsieh-moretti:2019}\\
\cite{glaeser_gyourko}\\
\printbibliography
\end{document}
test.bib file:
#article{hsieh-moretti:2019,
Author = {Hsieh, Chang-Tai and Moretti, Enrico},
Title = {Housing Constraints and Spatial Misallocation},
Journal = {American Economic Journal: Macroeconomics},
Volume = {11},
Number = {2},
Year = {2019},
Month = {4},
Pages = {1-39},
DOI = {10.1257/mac.20170388},
URL = {https://www.aeaweb.org/articles?id=10.1257/mac.20170388}
}
#article{glaeser_gyourko,
Author = {Glaeser, Edward and Gyourko, Joseph},
Title = {The Economic Implications of Housing Supply},
Journal = {Journal of Economic Perspectives},
Volume = {32},
Number = {1},
Year = {2018},
Month = {2},
Pages = {3-30},
DOI = {10.1257/jep.32.1.3},
URL = {https://www.aeaweb.org/articles?id=10.1257/jep.32.1.3}
}
In PDF it looks like this: enter image description here
I get the following information in the source viewer:
Process started
INFO - This is Biber 2.14 INFO - Logfile is 'test.blg' INFO - Reading
'test.bcf' INFO - Found 2 citekeys in bib section 0 INFO - Processing
section 0 INFO - Globbing data source 'test.bib' INFO - Globbed data
source 'test.bib' to test.bib INFO - Looking for bibtex format file
'test.bib' for section 0 INFO - LaTeX decoding ... INFO - Found
BibTeX data source 'test.bib'
Process exited with error(s)
I use texmaker 5.0.4 on MacOS and I post my configurations here:
enter image description here enter image description here
I really have very little idea on what goes on. Today, I started a work session, added a new source and it didn't work. I deleted the new source so that the bibliography would be the same as prior to me changing it, and it didn't work either. So, this let's me assume that, somehow, the program doesn't understand where the bibliography is. The .bib file and the document are in the same folder.
What I tried:
Triple checked code in bibliography using tools such as https://biblatex-linter.herokuapp.com/
Clear the cache of all documents.
change the natbib in the command \usepackage[backend=biber,style=authoryear, natbib]{biblatex} to biber -> doesn't seem to work.
Left out natbib and got same result. \usepackage[backend=biber,style=authoryear, natbib]{biblatex} => \usepackage[backend=biber,style=authoryear]{biblatex}
Add the command \usepackgage{natbitb} in addition to biblatex but this produces compatibility issues.
Add the codes \usepackage[utf8]{inputenc} &
\usepackage{babel,csquotes,xpatch} because they are recommendet by this biblatex cheat sheet: http://tug.ctan.org/info/biblatex-cheatsheet/biblatex-cheatsheet.pdf. Didn't change anything.
Thanks for your time!
I had a similar problem, what helped me was looking up the articles and rewriting them via the Google Scholar bibTex version.
The problem arose as I changed the name manually. This results in an error which is not recognized. And this threw me into researching exactly the same kind of .bib file not recognized error.
Your housing article should be formatted like this:
#article{hsieh2019housing,
title={Housing constraints and spatial misallocation},
author={Hsieh, Chang-Tai and Moretti, Enrico},
journal={American Economic Journal: Macroeconomics},
volume={11},
number={2},
pages={1--39},
year={2019}
}
I found another source of this problem Citavi generates invalid bibtex syntax. Often the year field is not correctly filled or special characters are not escaped properly. Maybe these are data errors which have their origin in the sources not in Citavi, but nonetheless often Citavi does not export valid bibtex format.

how to display version number on winform

i want to show the assembly version number on the form and i am stuck. the code will compile without errors and yet does not run. when i remove the lines below then the code will compile and run. i know that i am missing something here and i cannot see what it is. can someone point me in the right direction?
string Version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
string version = "Version: " + Version;
Form1.ActiveForm.Text = Version;
I always use this method to get the version number.
versionInfo contains much more info than just the productversion so I am sure you can get from it what you need.
private string GetAppVersion()
{
var versionInfo = FileVersionInfo.GetVersionInfo(Application.ExecutablePath);
return versionInfo.ProductVersion;
}

Octave won't exort LaTex symbols

I'm having a problem where Octave will render figures just fine in the figure box, but then refuses to properly export to PNG when I use the print() command. This is also true when I try other formats like EPS or JPG.
My current version of Octave is 3.8.1-1ubuntu1, which is up to date at the time of this post. My Ubuntu version is also 14.04. I do not receive any error messages when the code runs.
The script commands used to plot are pretty basic. For example:
linewidth = 4;
xStr = 'Particle Diameter (\mum)';
yStr = 'Scattering Cross-Section (\mum^2)';
FontName = 'Times New Roman';
LabelFontSize = 22;
AxisFontSize = 18;
F1 = figure(1);
clf('reset');
plot(diameter*1e6,sigma_0*1e12,'k','linewidth',linewidth);
hold on
plot(diameter*1e6,sigma_1*1e12,'r','linewidth',linewidth);
X = xlabel(xStr);
set(X,'FontName',FontName,'fontsize',LabelFontSize);
Y = ylabel(yStr);
set(Y,'FontName',FontName,'fontsize',LabelFontSize);
axis([xMin xMax sigMin sigMax]);
set(gca,'fontsize',AxisFontSize,'linewidth',2);
legend('2.0 \mum','3.8 \mum',4);
print(F1,'Mie.png','-dpng');
The strange thing is that I have other images from months ago that rendered the LaTex bits just fine, and even used nearly identical code. That almost seems like some recent software upgrade may have killed my plotting.
I appreciate any help you can give me. This issue is driving me nuts.
This is a known problem when using the OpenGL toolkits (graphics_toolkit FLTK) which is default in octave3.8.x. Previous versions used gnuplot for printing.
So you have two choices:
Switch back to gnuplot with "graphics_toolkit gnuplot" before doing any plotting. You may also add this to your .octaverc so it's set every time you start octave
Use LaTex output: http://wiki.octave.org/Printing_with_FLTK

Obfuscating code in AutoIt3

Some1 know which obfuscator obfuscate variables like this?
$a3a83605e4a
And functions like this?
Func a2060102a0b($a0c9b315f62, $a199bf1090b = 0, $a58ab015626 = False)
If NOT IsDeclared("SSA2060102A0B") Then
Global $a40ab115d31 = a2a0000482b($os[3999]), $a4fab210961 = a2a0000482b($os[4000]), $a09ab311939 = a2a0000482b($os[4001]), $a25ab415f29 = a2a0000482b($os[4002]), $a53ab510350 = a2a0000482b($os[4003]), $a06ab61560c = a2a0000482b($os[4004]), $a57ab714857 = a2a0000482b($os[4005]), $a2dab81175c = a2a0000482b($os[4006]), $a0aab91562a = a2a0000482b($os[4007]), $a26aba10a40 = a2a0000482b($os[4008]), $a31abb11452 = a2a0000482b($os[4009]), $a19abc1013c = a2a0000482b($os[4010]), $a46abd1244d = a2a0000482b($os[4011]), $a61abe16335 = a2a0000482b($os[4012]), $a02abf1395e = a2a0000482b($os[4013])
Global $ssa2060102a0b = 1
EndIf
If $a199bf1090b = Number($a40ab115d31) Then $a199bf1090b = a05a0d0391a()
If #error Then Return SetError(Number($a4fab210961), #extended, Number($a09ab311939))
Local $a49f0d12024 = DllCall($a25ab415f29, $a53ab510350, $a06ab61560c, $a57ab714857, $a199bf1090b, $a2dab81175c, $a0c9b315f62, $a0aab91562a, $a58ab015626, $a26aba10a40, Number($a31abb11452))
If #error OR NOT $a49f0d12024[Number($a19abc1013c)] Then Return SetError(Number($a46abd1244d), #extended, Number($a61abe16335))
Return $a49f0d12024[Number($a02abf1395e)]
EndFunc
Until recently, the full version of the SciTE editor was shipped with an obfuscator, which with correct flags would just change variable names (though by default does much more). This has since changed to a "stripper" which performs a similar function, but for the primary purpose of making scripts smaller as opposed to difficult to read.
Au3Stripper is available for download here (scroll to the bottom of the page for the standalone version)
You may be able to find previous versions of the Obfuscator online (there is no official page for downloading old versions as far as I know).
There are some alternatives, such as one on the German forums here, though I haven't used it so can't say how good it is, or if the output matches what you are looking for.
It might be AutoIt Obfuscator from https://www.pelock.com/products/autoit-obfuscator
It seems it's using similar obfuscation techniques.

Octave select a file?

Does Octave have a good way to let the user select an input file? I've seen code like this for Matlab, but doesn't work in Octave.
A gui based method would be preferred, but some sort of command-line choice would work also. It would be great if there were some way to do this that would work in both Matlab and Octave.
I found this for Matlab but it does not work in Octave, even when you install Octave Forge Java package for the listdlg function. In Octave, dir() gives you:
647x1 struct array containing the fields:
name
date
bytes
isdir
datenum
statinfo
but I don't know how to convert this to an array of strings listdlg expects.
You have already the Octave Forge java package installed, so you can create instances of any java class and call any java method.
For example to create a JFileChooser and call the JFileChooser.showOpenDialog(Component parent) method:
frame = javaObject("javax.swing.JFrame");
frame.setBounds(0,0,100,100);
frame.setVisible(true);
fc = javaObject ("javax.swing.JFileChooser")
returnVal = fc.showOpenDialog(frame);
file = fc.getSelectedFile();
file.getName()
Btw. I had some troubles installing the package.
Here is a fix for Ubuntu. that worked also for my Debian Testing.
EDIT
#NoBugs In reply to your comment:
If you need to use listdlg you can do the following:
d = dir;
str = {d.name};
[sel,ok] = listdlg('PromptString','Select a file:',...
'SelectionMode','single',...
'ListString',str);
if ok == 1
disp(str{sel(1)});
end
This should be compatible with matlab, by I cannot test it right now.
If you want to select multiple files use this:
d = dir;
str = {d.name};
[sel,ok] = listdlg('PromptString','Select a file:',...
'SelectionMode','multiple',...
'ListString',str);
if ok == 1
imax = length(sel);
for i=1:1:imax
disp(str{sel(i)});
end
end
I never came across an open-file-dialog in octave.
If you are looking for a gui based method maybe guioctave can help you. I never used it, because it appears only be available for windows machines.
A possible solution would be to write a little script in octave, that would allow the user to parse through the directories and select a file like that.
Thought I'd provide an updated answer to this old question, since it is appearing in the 'related questions' field for other questions.
Octave provides the uigetdir and uigetfile functions, which do what you expect.

Resources