I am working on a progress bar, so I need to print several consecutive # characters. I am using Bash shell operation.    This is the case example:  $ a=20 $ printf "#%.0s" {1..a} #$ printf "#%.0s" {1..$a} #$ printf "#%.0s" {1.."$a"} #$ printf "#%.0s" {1..20} ####################   Note that it is only generated one only #, except when using the direct 20 value in the command line. Invoking the a variable seems not to work.    I need to do this programmatically, because 20 could be any other number.   What am I missing? Something obvious/stupid? Thanks you.
How do I iterate over a range of numbers in Bash when the range is given by a variable?  I know I can do this (called "sequence expression" in the Bash ):   for i in {1..5}; do echo $i; done   Which gives:     1    2    3    4    5   Yet, how can I replace either of the range endpoints with a variable? This doesn't work:  END=5 for i in {1..$END}; do echo $i; done   Which prints:     {1..5}
I didn't know how to solve this problem.  How to prove $$\sum_{n=0}^{\infty}\sin(e\pi n!)$$ converges? Opposite of "straight talk" Comparing signatures of apks I have two .apk files that are supposed to be different versions of the same app. What is the best way to check if they where both signed with the same key?  I want to make sure no mistakes were done and the newer version would be treated as an update of the same app. Global variables in AngularJS How do I resolve unmet dependencies after adding a PPA? the largest integer $n$ for which $n+5$ divivides $n^5+5$? When we divide $n^5+5$ by $n+5$, we get a remainder $-620$, i.e., $n^5+5=K(n+5)-620$ , now how to proceed further? I want to get records from custom object sort by a field as number. The field I want to sort is string type. Is there any way to do that? I am storing result in list, is there a way to sort list based on the string field but sort it as number? Does the sum of reciprocals of primes converge? There are many lengths in LaTeX. For instance, \enskip, \enspace, \quad, \parskip, \smallskip, ...  Some of them are mostly used for vertical spacing, some others are mostly used for horizontal spacing, and perhaps some of them are used in both cases. I wonder whether there is a list that indicates the meaning and intended use of each length in LaTeX.  By "intended use" I mean not only whether the length is vertical or horizontal, but in which circumstances it is a good practice to use that specific length. What is likely to happen when you plug two ends of a network cable to a single switch/router? Will this create problems on the network, or just be ignored? Possible to create new Application Handler? Blender's application handlers are listed , but is it possible to create a new one?  For example, I'd like an application handler which is a callback for every time I add a strip to the Video Sequence Editor. Roots of polynomials in field of prime characteristic p Let $F$ be a field of characteristic $p$, and let $\alpha \in F$. Let $f \in \mathbb{Z}_p[x]$ be such that $f(\alpha) = 0$. Apparently, we have $f(\alpha^p) = 0$. This was mentioned but not proved in my lectures. Can someone explain why please?  Thanks. How to automatically reinvest in non-dividend paying funds I've read Einsteins quote stating "The most powerful force in the universe is compound interest." However, everywhere I read this is basically only possible with dividend paying stocks and then applying a dividend reinvestment plan.  Is there a re-investing strategy like this for non-dividend paying mutual funds (or even non-dividend paying stock)? I figured that the only way would be to sell all your funds and then buy x+1 funds again, but this would cause a big loss because of transaction costs from the broker. I have a scenario where I have multiple threads adding to a queue and multiple threads reading from the same queue. If the queue reaches a specific size all threads that are filling the queue will be blocked on add until an item is removed from the queue.  The solution below is what I am using right now and my question is: How can this be improved?  Is there an object that already enables this behavior in the BCL that I should be using?  internal class BlockingCollection&lt;T&gt; : CollectionBase, IEnumerable {     //todo: might be worth changing this into a proper QUEUE      private AutoResetEvent _FullEvent = new AutoResetEvent(false);      internal T this[int i]     {         get { return (T) List[i]; }     }      private int _MaxSize;     internal int MaxSize     {         get { return _MaxSize; }         set         {             _MaxSize = value;             checkSize();         }     }      internal BlockingCollection(int maxSize)     {         MaxSize = maxSize;     }      internal void Add(T item)     {         Trace.WriteLine(string.Format("BlockingCollection add waiting: {0}", Thread.CurrentThread.ManagedThreadId));          _FullEvent.WaitOne();          List.Add(item);          Trace.WriteLine(string.Format("BlockingCollection item added: {0}", Thread.CurrentThread.ManagedThreadId));          checkSize();     }      internal void Remove(T item)     {         lock (List)         {             List.Remove(item);         }          Trace.WriteLine(string.Format("BlockingCollection item removed: {0}", Thread.CurrentThread.ManagedThreadId));     }      protected override void OnRemoveComplete(int index, object value)     {         checkSize();         base.OnRemoveComplete(index, value);     }      internal new IEnumerator GetEnumerator()     {         return List.GetEnumerator();     }      private void checkSize()     {         if (Count &lt; MaxSize)         {             Trace.WriteLine(string.Format("BlockingCollection FullEvent set: {0}", Thread.CurrentThread.ManagedThreadId));             _FullEvent.Set();         }         else         {             Trace.WriteLine(string.Format("BlockingCollection FullEvent reset: {0}", Thread.CurrentThread.ManagedThreadId));             _FullEvent.Reset();         }     } } Transparent textured planes produce black artifacts "detached entity passed to persist error" with JPA/EJB code What is the best way to check whether a given object is of a given type? How about checking whether the object inherits from a given type?  Let's say I have an object o. How do I check whether it's a str? I want to disable the internal Microphone on my laptop and the internal Webcam completely that they're no longer selectable, and no longer available?  I will only use my external Webcam, and my external (USB) headset.  The internal audio should still be available for playback. How to connect two Dell P2415Q 4k displays to MacBook Pro 2016 What's the best way of connecting two Dell P2415Q 4k displays to the MacBook Pro 2016 with TouchBar and TouchID?  I have the monitors connected to an older MacBook Pro currently with two mini-DisplayPort cables. Can I somehow reuse those cables or do I need new ones?  Apple's support page  lets me know that:  "Note that although it uses a Mini DisplayPort connector, the Thunderbolt 3 (USB-C) to Thunderbolt 2 Adapter doesn't support connections to Mini DisplayPort displays."  So I guess reusing the cables is not the way to go? bases and binary I can not figure this out.   I started off by making a table and putting the base(2) on one side, the number in the middle and the remainder in the third row and for 2010 I got 11111011010 but I cant find the next two numbers please help and please explain in detail.  Thank you =)   to express 2010 in base 2, we use exactly 8 ones and 3 zeros. find the next two integers in base 2 that use the same number of ones and zeros