The purpose of this page is to convert this org to markdown using regular expressions.

org_text <- r"{To do the homeworks you need to use emacs and python; it is
recommended to install/use [[https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html][anaconda/miniconda]],
- emacs is the required IDE for the class. It allows you to write/edit
  code without using the mouse, and has great python support,
  including conda environments, interactive execution, completion, ...
  - [[https://www.youtube.com/playlist?list=PLwc48KSH3D1OeAHFQhWpd8Fz8rLhTaD7t][My emacs and python screencasts show you how to install emacs and configure it to work with python]].
  - [[https://www.gnu.org/software/emacs/download.html][Download and Install GNU Emacs]].
  - [[https://elpy.readthedocs.io/en/latest/introduction.html#installation][Installation instructions for Elpy, which is a python IDE for emacs]].
  - [[https://www.emacswiki.org/emacs/PythonProgrammingInEmacs][PythonProgrammingInEmacs on the emacswiki has instructions for setting up other emacs python IDEs]].
- If you want to use a different IDE (not emacs), then you need to
  come to office hours and show me that you can do interactive python
  code execution in that other IDE. That means having one window with
  python code, another window with python console, and you can use a
  keyboard command to execute one or more lines of code at a time, and
  immediately see the output in the console.

** Instructions for conda

After [[https://docs.conda.io/en/latest/miniconda.html][downloading conda]], and before you activate an environment, you need to
setup your shell for the first time.

#+begin_src shell-script
conda init bash
#+end_src

That should put some code in your ~/.bash_profile, I had to copy it to
my ~/.bashrc to get it to work on my setup (git bash in emacs shell on
windows). After restarting your shell you should see a (base) prefix
in your prompt, which indicates the name of the currently activated
conda environment.  

After that, you can install python, with the same version that I use,
via:

#+begin_src shell-script
  conda create -n 2023-08-deep-learning
  conda activate 2023-08-deep-learning
  conda install python=3.11.4
#+end_src

That should create and activate a new conda environment with the
required python version.
After activation, that environment will be used for new python
processes, looking for python modules, etc.

** Python support in emacs

First of all, if this is your first time ever using emacs, please type
C-h t (type h while holding down control, then let go of control and
type t) to open the emacs tutorial. Read through the entire tutorial
and do all of the exercises, which will teach you the most important
keyboard shortcuts for navigating and editing code. Keep re-doing
the tutorial every day until you remember all of the keyboard shortcuts.

To get python support in emacs I had to install emacs packages
(elpy,conda). To do that first you need to put the following in your
~/.emacs file (which contains user-specific commands to run on emacs startup)
to tell it to download packages from the MELPA
repository,

#+BEGIN_SRC elisp
(require 'package)
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/") t)
#+END_SRC

After putting the above in your ~/.emacs you need to restart emacs,
then run M-x package-list-packages (M-x means hold down the option/alt
key and type x) to see a list of packages you can install. Search for
elpy and conda (maybe with C-s, meaning hold down control key and type
s), mark for installation by typing i, then type x to install all
packages marked for installation. Finally to tell emacs to use elpy
with python code, and my conda environments, I put the following in my
~/.emacs file:

#+begin_src elisp
  (elpy-enable)
  (setq elpy-shell-starting-directory 'current-directory)
  (setq conda-anaconda-home (expand-file-name "~/miniconda3"))
  (setq conda-env-home-directory conda-anaconda-home)
#+end_src

Make sure to change the path above from "~/miniconda3" to 
wherever you have installed miniconda, then again restart emacs.
In emacs When editing a python file we can "activate" the conda
environment via M-x conda-env-activate RET 2023-08-deep-learning RET then C-c C-z
to get an interactive shell, then
- C-RET to send line and step,
- C-c to send highlighted region.

See
https://elpy.readthedocs.io/en/latest/ide.html for more elpy key
commands (sending code from python code files to the interactive
shell), and https://realpython.com/emacs-the-best-python-editor/ for a
nice tutorial about emacs and python.

** FAQ 

On windows python not found error, or emacs can't find the python in
your conda env, please fix by

#+begin_src elisp
  (setq python-shell-interpreter "python");not "python3" !
#+end_src

Also if you have a space in your username, and you get an error about
version "is" when you try conda-env-activate, then please try this fix:
https://github.com/necaris/conda.el/pull/150}"

library(data.table)
## data.table 1.18.0 using 3 threads (see ?getDTthreads).  Latest news: r-datatable.com
sub_dt <- rowwiseDT(
  find=, replace=,
  "(?<=\n)\\*\\*", "##",
  "(?i)#\\+(BEGIN|END)_SRC *", "```",
  "\\[\\[(.+?)\\]\\[(.+?)\\]\\]", "[\\2](\\1)")
subject <- org_text
for(row_i in 1:nrow(sub_dt)){
  sub_row <- sub_dt[row_i]
  subject <- sub_row[, gsub(find, replace, subject, perl=TRUE)]
}
cat(subject)
## To do the homeworks you need to use emacs and python; it is
## recommended to install/use [anaconda/miniconda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html),
## - emacs is the required IDE for the class. It allows you to write/edit
##   code without using the mouse, and has great python support,
##   including conda environments, interactive execution, completion, ...
##   - [My emacs and python screencasts show you how to install emacs and configure it to work with python](https://www.youtube.com/playlist?list=PLwc48KSH3D1OeAHFQhWpd8Fz8rLhTaD7t).
##   - [Download and Install GNU Emacs](https://www.gnu.org/software/emacs/download.html).
##   - [Installation instructions for Elpy, which is a python IDE for emacs](https://elpy.readthedocs.io/en/latest/introduction.html#installation).
##   - [PythonProgrammingInEmacs on the emacswiki has instructions for setting up other emacs python IDEs](https://www.emacswiki.org/emacs/PythonProgrammingInEmacs).
## - If you want to use a different IDE (not emacs), then you need to
##   come to office hours and show me that you can do interactive python
##   code execution in that other IDE. That means having one window with
##   python code, another window with python console, and you can use a
##   keyboard command to execute one or more lines of code at a time, and
##   immediately see the output in the console.
## 
## ## Instructions for conda
## 
## After [downloading conda](https://docs.conda.io/en/latest/miniconda.html), and before you activate an environment, you need to
## setup your shell for the first time.
## 
## ```shell-script
## conda init bash
## ```
## 
## That should put some code in your ~/.bash_profile, I had to copy it to
## my ~/.bashrc to get it to work on my setup (git bash in emacs shell on
## windows). After restarting your shell you should see a (base) prefix
## in your prompt, which indicates the name of the currently activated
## conda environment.  
## 
## After that, you can install python, with the same version that I use,
## via:
## 
## ```shell-script
##   conda create -n 2023-08-deep-learning
##   conda activate 2023-08-deep-learning
##   conda install python=3.11.4
## ```
## 
## That should create and activate a new conda environment with the
## required python version.
## After activation, that environment will be used for new python
## processes, looking for python modules, etc.
## 
## ## Python support in emacs
## 
## First of all, if this is your first time ever using emacs, please type
## C-h t (type h while holding down control, then let go of control and
## type t) to open the emacs tutorial. Read through the entire tutorial
## and do all of the exercises, which will teach you the most important
## keyboard shortcuts for navigating and editing code. Keep re-doing
## the tutorial every day until you remember all of the keyboard shortcuts.
## 
## To get python support in emacs I had to install emacs packages
## (elpy,conda). To do that first you need to put the following in your
## ~/.emacs file (which contains user-specific commands to run on emacs startup)
## to tell it to download packages from the MELPA
## repository,
## 
## ```elisp
## (require 'package)
## (add-to-list 'package-archives
##              '("melpa" . "https://melpa.org/packages/") t)
## ```
## 
## After putting the above in your ~/.emacs you need to restart emacs,
## then run M-x package-list-packages (M-x means hold down the option/alt
## key and type x) to see a list of packages you can install. Search for
## elpy and conda (maybe with C-s, meaning hold down control key and type
## s), mark for installation by typing i, then type x to install all
## packages marked for installation. Finally to tell emacs to use elpy
## with python code, and my conda environments, I put the following in my
## ~/.emacs file:
## 
## ```elisp
##   (elpy-enable)
##   (setq elpy-shell-starting-directory 'current-directory)
##   (setq conda-anaconda-home (expand-file-name "~/miniconda3"))
##   (setq conda-env-home-directory conda-anaconda-home)
## ```
## 
## Make sure to change the path above from "~/miniconda3" to 
## wherever you have installed miniconda, then again restart emacs.
## In emacs When editing a python file we can "activate" the conda
## environment via M-x conda-env-activate RET 2023-08-deep-learning RET then C-c C-z
## to get an interactive shell, then
## - C-RET to send line and step,
## - C-c to send highlighted region.
## 
## See
## https://elpy.readthedocs.io/en/latest/ide.html for more elpy key
## commands (sending code from python code files to the interactive
## shell), and https://realpython.com/emacs-the-best-python-editor/ for a
## nice tutorial about emacs and python.
## 
## ## FAQ 
## 
## On windows python not found error, or emacs can't find the python in
## your conda env, please fix by
## 
## ```elisp
##   (setq python-shell-interpreter "python");not "python3" !
## ```
## 
## Also if you have a space in your username, and you get an error about
## version "is" when you try conda-env-activate, then please try this fix:
## https://github.com/necaris/conda.el/pull/150

session info

sessionInfo()
## R version 4.5.2 (2025-10-31 ucrt)
## Platform: x86_64-w64-mingw32/x64
## Running under: Windows 11 x64 (build 26100)
## 
## Matrix products: default
##   LAPACK version 3.12.1
## 
## locale:
## [1] LC_COLLATE=English_United States.utf8 
## [2] LC_CTYPE=English_United States.utf8   
## [3] LC_MONETARY=English_United States.utf8
## [4] LC_NUMERIC=C                          
## [5] LC_TIME=English_United States.utf8    
## 
## time zone: America/Toronto
## tzcode source: internal
## 
## attached base packages:
## [1] stats     graphics  utils     datasets  grDevices methods   base     
## 
## other attached packages:
## [1] data.table_1.18.0
## 
## loaded via a namespace (and not attached):
## [1] compiler_4.5.2 cli_3.6.5      tools_4.5.2    otel_0.2.0     knitr_1.51    
## [6] xfun_0.56      rlang_1.1.7    evaluate_1.0.5