What is the most efficient way to read the last symbol or line of a large text file using C#?
I need to process a large file, around 400K lines and 200 M. But sometimes I have to process from bottom up. How can I use iterator (yield return) here? Basically I don't like to load everything in memory. I know it is more efficient to use iterator in .NET.
On every boot up I get this:    For about 10 seconds (or more) before the "normal" Ubuntu Gnome loading screen and the login screen comes up.  I've read some questions and a bug report about this already, but this problem was dismissed as a minor inconvenience or there were no real solutions (that worked for me). For me, this problem leads to an unacceptable slow boot compared to Ubuntu (Unity) or Windows.  Does anybody know how to fix this or is this a "feature" of Ubuntu Gnome and not a bug? I've been given a proof that shows the following:  If $f:[a,b]\to \mathbb C$ is a continuous function and $f(t)=u(t)+iv(t)$ then $$\left| \int_a^b f(t) dt \right| \leq \int_a^b \left| f(t) \right| dt$$ The proof begins by letting $\theta$ be the principle argument of the complex number $\int_a^b f(t)dt$ and there is one step in the proof I don't understand; can anyone explain to me why $$\int_a^b e^{-i\theta}f(t) dt=\Re\bigg(\int_a^be^{-i\theta}f(t)dt\bigg)$$  Would this not imply that the imaginary part of the left hand side is equal to $0$? I'm not sure why the LHS and RHS would be equal here. How to find and replace in linux on a large file? Oh, hi; So I've got this big json file and I'm trying to find and replace a few things but when I've used sed I get an error and I need a sed or awk string to find and replace it, without getting an error.  prajwal  Current: {&quot;telephone_numbers&quot;:[&quot;1-  Future: {&quot;telephone_numbers&quot;:[&quot;+1-  This is the command i tried and the error i got. sed -i 's/{&quot;telephone_numbers&quot;:[&quot;1-/{&quot;telephone_numbers&quot;:[&quot;+1-/g' output.json sed: -e expression #1, char 56: unterminated `s' command Hide Accesibility icon from Panel I have Ubuntu 18.04 and set the Scaling Factor in Tweaks to 1,10 because the 1920x1080 resolution makes stuff on my screen look a bit too small for my taste. That toggled this stickman icon, which now seems to not want to go away from my Panel unless I disable "Large Text".    Is there any way to hide this icon while keeping my settings? I've been studying about the command line and learned that | (pipeline) is meant to redirect the output from a command to the input of another one. So why does the command ls | file doesn't work?  file input is one of more filenames, like file filename1 filename2  ls output is a list of directories and files on a folder, so I thought ls | file was supposed to show the file type of every file on a folder.  When I use it however, the output is:      Usage: file [-bcEhikLlNnprsvz0] [--apple] [--mime-encoding] [--mime-type]         [-e testname] [-F separator] [-f namefile] [-m magicfiles] file ...     file -C [-m magicfiles]     file [--help]   As there was some error with the usage of the file command What do I call the ′ in mathematical formulae? As in x′ = x + t  "Ex (?) equals ex plus tee".  In Russian it is called "штрих" (shtrikch). How do I troubleshoot random rebooting? Why are there $736$ matrices $M\in \mathcal M_2(\mathbb{Z}_{26})$ for which it holds that $M=M^{-1}$? I'm currently trying to introduce myself to cryptography.  I'm reading about the Hill Cipher currently in the book Applied Abstract Algebra. The Hill Cipher uses an invertible matrix $M$ for encryption and the inverse matrix $M^{-1}$ for decryption. The book recommends to use a matrix $M$ for which it holds that $M=M^{-1}$, since we then have the same key for encryption and decryption.  In the book, they use a $2 \times 2$ matrix $M$ over $\mathbb{Z}_{26}$ as example, and state that for there are 736 $2 \times 2$ matrices for which it hold that $M=M^{-1}$.  I'm trying to pick up on as much as possible when reading things, since I find it counter-productive for learning to skip something, when you don't get the theory behind it. Can someone enlighten to me, as to why it is that there are 736 possible $2 \times 2$ $M=M^{-1}$ matrices and how to find them? Install Linux from Linux What is LINQ? I know it's for databases, but what does it do? How can I add a class to a block with code (development) For theming reasons I'd like to add a specific class at the "block" level to some of the blocks I'm generating with a custom module. I know there is a module , but I would rather like to do it directly in code (there is no need to change is afterwards).   I also know of , but that does not seem to allow adding or editing classes.  Is it possible to add a class with to a block from within my module code? I'm using Drupal 7. I want to know a proof of an alternative form of Fermat-Euler's theorem   $$a^{\phi (n) +1} \equiv a \pmod n$$   when $a$ and $n$ are not relatively prime.   I searched some number theory books and a cryptography book and internet, but there were only proofs of the original theorem  $a^{\phi (n)} \equiv 1 \pmod n$ or in case n=pq which is used for RSA. So I would be very thankful if someone show me a proof or book I should read. Pullback of a Volume Form Under a Diffeomorphism. I have an exercise here, which I have no idea how to do.     Problem: Let $ U $ and $ V $ be open sets in $ \mathbb{R}^{n} $ and $ f: U \to V $ an orientation-preserving diffeomorphism. Then show that   $$   {f^{*}}(\text{vol}_{V}) = \sqrt{\det \! \left( \left[   \left\langle {\partial_{i} f}(\bullet),{\partial_{j} f}(\bullet) \right\rangle   \right]_{i,j = 1}^{n} \right)} \cdot   \text{vol}_{U}. $$   Notation:         $ \text{vol}_{U} $ and $ \text{vol}_{V} $ denote the volume forms on $ U $ and $ V $ respectively.   $ f^{*}: {\Lambda^{n}}(T^{*} V) \to {\Lambda^{n}}(T^{*} U) $ denotes the pullback operation on differential $ n $-forms corresponding to $ f $. What font is used in this image? A game called  is making rounds on social media. I am trying to determine the maximum score attainable for this game.  Let's assume WLOG that only 2s are returned (if 4s are possible the max score is doubled).  First, I'll relax some of the rules to create a game, $\mathcal{G}$, that can achieve a score at least as high as the original, 2048 game.  A run $R$  of $\mathcal{G}_n$ consists of a sequence of moves $m_1,\ldots,m_k$ which manipulate a multiset, $\mathcal{S}$ of maximum size n.  Each $m_i$ is either:   a put $p$, which inserts a 2 into $\mathcal{S}$, or a merge, $\alpha_i$, which replaces two $2^i$ elements from $\mathcal{S}$ with a single $2^{i+1}$ elt.   I allow sequential moves of the same type because 2048 allows multiple merges or no-merge turns.  The score of a position is the sum of $\mathcal{S}$.  What is the maximum score possible on a game of order n?  Note: The final position must have only unique values, else a merge and put would be possible in increase score.  I claim it is $\sum_{i=1}^{n} 2^i$, but couldn't come up with any good induction arguments.  It's pretty easy to prove that an element $2^k$ is producible in a game $\mathcal{G}_k$, but proving an upper bound for production got a bit hairy, and also doesn't cover the full space. How to print paragraphs in twig template? I have a content type, basic, where i have added a Paragraph field field_pr that has two fields: field_text, field_color. I have a twig template node--basic--full.html.twig where I want to print the value of the paragraph field node.field_pr.   node.field_pr can have between one and ten paragraph values.   When I print the array for content.field_pr, I get a huge array. However, I only want the values from the field_pr.field_text and field_pr.field_color. How would I be able to do this from the node twig template?   I have tried the following but cannot seem to access the values. What am I missing?  {% for field in content.field_pr %}    {{ field[loop.index0].entity.field_text.value }}    {{ field[loop.index0].entity.field_color.value }} {% endfor %}  {% for field in content.field_pr %}    {{ field[loop.index0]['#paragraph'].field_text.value }}    {{ field[loop.index0]['#paragraph'].field_color.value }} {% endfor %}   Here is an image of the array that is printed for the node.field_pr field. What is Peter Quill's status after Guardians of the Galaxy Vol. 2? Calculating Image boundary / footprint of satellite images using open source tools? How to get the entity ID for a custom field in Apex? I am looking for a way to get the 15 character entity ID for a custom field on my Lead object in an Apex controller. I have tried this:  private String getEntityIdFor(String fieldName) {         Map&lt;String, Schema.SObjectField&gt; fieldMap = Schema.SObjectType.Lead.fields.getMap();         return fieldMap.get(fieldName).getDescribe().getId();     }    Of course, there is no getId() method, but this is the closest I got.   Thanks for any help. Identify this YA book series about dragons, acid blood, and dangerously cold nights