How can I represent a matrix in Github markdown? - mathjax

I am trying to represent a basic vector, the following code works in Visual Studio Code.
I am using the following line $\begin{bmatrix}X\\Y\end{bmatrix}$
All whitespace removed. It should look like this,
However, when pushed to Github it does not render correctly and instead just renders to entire text letter for letter like it is unsupported. Does anybody know how to get get the following vector to display correctly?

Related

Unable to paste text in readable format from a PDF

I have a PDF document with the following sample text (screenshot) -
But when I copy and paste it to either word or other text editors all I see is the weird characters :





I am not quite sure why does it giving me weird square boxes instead of pasting the clear human-readable letters (just like the screenshot). Can someone help me how can I get rid of this issue ? Or at least what shall I do to identify the root cause of this strange issue ?
================== Workaround found ==================
I tried converting the document's corrupted unicode to a standard ANSCI unicode formats. But most of the online services couldn't recognize these garbage/weird characters.
This issue could be resolved by some programming, but I don't want to invest time with the programming approach and preferred on the fly approach.
Finally, as suggested by the user 'mkl', converting this document by using the OCR services like "Sedja"/ "Adobe OCR" resolved by issue.

Python script in Colab keeps throwing error message: IndentationError: unindent does not match any outer indentation level

I'm currently using Google Colab in order to take advantage of its free GPU. I was trying to modify a code that I copy and pasted from machinelearningmaster.com. However, whenever I try to add a new code line, for example "print("some words"), I get an indention error.
I have tried adding tabs or spaces before the print call but I still get the error. for example:
space,space,print("some words")
tab, tab ,print("some words")
I have also checked the colab editor settings, currently the indention width setting are set to two spaces.
The first three lines are part of the original code, the print statement is
my addition. I copy and pasted this directly from the colab editor. In Colab all four lines are aligned. As you can see here only the first three lines are aligned. I don't know what's going on.
img_path = images_dir + filename
ann_path = annotations_dir + image_id + '.xml'
count=count+1
print("this is count: ", count)
I expected this to print the value of count, instead I get an error message telling me:
IndentationError: unindent does not match any outer indentation level
Okay, after much searching and frustration, I have an idea of what went wrong, but even better, a solution to fix it.
It appears that the Google Collaborator (Colab) editor does not have a way to set it for tabs "\t" versus space (space-bar entries). From the settings tab on the cell you can set the width of the tab from 2 to 4, but these will be interpreted as 2 to 4 space-bar entries. Usually, this isn't a problem. However, if you're like me and you want to test out code from the web, or be lazy and just copy paste from your editor, problems can arise.
Here's how I fixed it. Before pasting the copied code into Colab, first put it into notepad++. Go to View> Show Symbols >Show All Characters, click on this, you should now be able so see all the characters in the code. Find a tab, it will look like an arrow pointing to the right -->, right click and copy it. Open Search> Find, open the Replace tab. Depending on your version of notepad++ the tab you copied will automatically be entered and the replace will already be set to four spaces. Hit "Replace all". This will automatically replace all tabs with equivalent spaces. Copy the code from notepad++ back to Colab. Now there will be no more conflicts.
I think using a simple find and replace tool will just work fine. I also came across this error recently in Colab and I went through #Rice Man solution. The only difference was I used Libre office writer instead of Notepad++. I also found this tool to be helpful. I am not proficient in using Colab but this solution worked for me.
Another quick fix that worked for me related to this question.
I was trying to run a python script in colab and faced this error though the line seems at an appropriate indentation in that script.
I checked with the !cat filename.py cmd, and found out that the actual indentation appears different than it is in the script (hence the error).
Taking that unindented line (according to the colab) at the start of the line and using space afterward fixed the error.
I used this website to fix the error.
Copy your code to the site, then click beautify button on top left. This will remove indention errors.
If you want to know where the indention error is coming from, use #Prachi answer.

How to write square brackets in markdown

I need to write in my gitlab project wiki page a code block that contains square brackets. Unfortunately the square brackets are turn into a link.
I assume gitlab is using markdown language or the gfm flavor.
This is my code:
```javascript
"{bla, """", [[foo],[]]}"
```
The foo],[ part is turn into a link. So basicaly I need a way to write a square brackets tah are not treated as a link. Surprisingly google doesn't provide any answer for such a trivial issue.
The current answer is that you can't do this. It is a know bug in GitLab, specifically in Wiki pages. GitLab markdown correctly handles square brackets in comments, and code blocks entered in issues, but NOT in wiki pages.
Please add your vote (thumbs up) on the issue to try and get it resolved:
https://gitlab.com/gitlab-org/gitlab-ce/issues/18725
Your (not very appealing) options boil down to these:
Use a single line code entry `"{bla, """", [[foo],[]]}"`
Use another syntax in your code block (e.g. {{), and include a note outside the code block saying to replace {{ with [[, etc - Note that you can use double brackets inside single quote blocks in GitLab Markdown.
Use a screenshot of your code.
None of these are very nice solutions, but all you have at the moment.

how to write a snippet than can toggle text like snippet Get Element

In snippet Get Element, when i type get and push tab, it will show
getElementsByTagName('')
and the letter T is highlight and editable, then typed letter I, it will change to
getElementById('')
automatically.
I want to create a snippet which can toggle text by the letter i typed, just like the snippet Get Element do, but i can't find where the snippet location.
Anyone know its location or know how to create a snippet like that?
The snippet is inside the archived JavaScript package, which is located in the installation directory, and then Packages/JavaScript.sublime-package. Inside that package, the file's name is Snippets/Get-Elements.sublime-snippet and it has the following contents:
<snippet>
<content><![CDATA[getElement${1/(T)|.*/(?1:s)/}By${1:T}${1/(T)|(I)|.*/(?1:agName)(?2:d)/}('$2')]]></content>
<tabTrigger>get</tabTrigger>
<scope>source.js</scope>
<description>Get Elements</description>
</snippet>
Basically, it works with conditional replace format strings. You can find the documentation for those in the boost regex docs, however I suggest to just have two different snippets in this situation with the triggers gett and geti respectively, since those still require the same number of key strokes but are way easier to create and maintain.
You can open archived resource files like this easily with the PackageResourceViewer package.
Details on what archived packages are: http://docs.sublimetext.info/en/latest/extensibility/packages.html

Using LocationTextExtractionStrategy in itextSharp for text coordinate

My goal is to retrieve data from PDF which may be in table structure to an excel file.
using LocationTextExtractionStrategy with iTextSharp we can get the string data in plain text with page content in left to right manner.
How can I move forward such that during
PdfTextExtractor.GetTextFromPage(reader, i, new LocationTextExtractionStrategy())
I could make the text retain its coordinate in the resulting string.
As for instance if the first line in the pdf has text aligned to right, then the resulting string must be containing trailing space or spaces keeping the content right aligned.
Please give some suggestions, how I may proceed to achieve the same.
Its very important to understand that PDFs have no support for tables. Anything that looks like a table is really just a bunch of text placed at specific locations over a background of lines. This is very important and you need to keep this in mind as you work on this.
That said, you need to subclass TextExtractionStrategy and pass that into GetTextFromPage(). See this post for a simple example of that. Then see this post for a more complex example of subclassing. The latter isn't completely relevant to your goal but it does show some more complex things that you can do.

Resources