Find words in files txt
How do I compare strings in Java?
Convert a string representation of a hex dump to a byte array using Java? I am looking for a way to convert a long string (from a dump), that represents hex values into a byte array.  I couldn't have phrased it better than the person that posted .  But to keep it original, I'll phrase it my own way: suppose I have a string "00A0BF" that I would like interpreted as the  byte[] {0x00,0xA0,0xBf}   what should I do?  I am a Java novice and ended up using BigInteger and watching out for leading hex zeros. But I think it is ugly and I am sure I am missing something simple. How to show  tag literally in / tag? I have an ArrayList that I want to output completely as a String. Essentially I want to output it in order using the toString of each element separated by tabs. Is there any fast way to do this? You could loop through it (or remove each element) and concatenate it to a String but I think this will be very slow. Prove that $||x|-|y||\le |x-y|$ html - how to remove right margin completely? Are there any tools that I can use to defrag my Windows partition from Linux? How can I filter items with a certain enchantement? I am trying to build a custom Adventure Island. At this moment I am trying to limit the allowed items on this island. I'm trying to do this by filtering on a certain enchantment which is not item-specific.  For example.   When you want to filter an wooden sword with a custom name, you use this command:  /testfor @p[r=5] {Inventory:[{tag:{display:{Name:"Custom Sword"}}}]} &lt;   When you want to filter a wooden sword with a custom name and specific enchantement, you can use:  /testfor @p[r=5] {Inventory:[{tag:{display:{Name:"Custom Sword"},ench:[{id:16,lvl:1}]}}]} &lt;   But how can I filter on items with a specific enchantment on ANY item? I tried:  /testfor @p[r=5] {Inventory:[{tag:{ench:[{id:16,lvl:1}]}}]} &lt;   But this ain't work. Does anyone know how to solve this issue? What is the sign of the work done on the system and by the system? What is the sign of the  done on the system and by the system?  My chemistry book says when work is done on the system, it is positive. When work is done by the system, it is negative.  My physics book says the opposite. It says that when work is done on the system, it is negative. When work is done by the system, it is positive.  Why do they differ? I was trying to concatenate text files in sub-folders and tried:  cat ./{mainfolder1,mainfolder2,mainfolder3}/{subfolder1}/book.txt &gt; out$var   However this did not return anything. So, tried adding a non existing 'subfolder2'  cat ./{mainfolder1,mainfolder2,mainfolder3}/{subfolder1,subfolder2}/book.txt &gt; out$var   And this time it did work out, concatenating the files successfully. Why does this happens? If I create a file and then change its permissions to 444 (read-only), how come rm can remove it?  If I do this:  echo test &gt; test.txt chmod 444 test.txt rm test.txt   ...rm will ask if I want to remove the write-protected file test.txt. I would have expected that rm can not remove such a file and that I would have to do a chmod +w test.txt first. If I do rm -f test.txt then rm will remove the file without even asking, even though it's read-only.   Can anyone clarify? I'm using Ubuntu 12.04/bash. In how many ways can a number be expressed as a sum of consecutive numbers? We noticed that lots of bugs in our software developed in C# (or Java) cause a NullReferenceException.  Is there a reason why "null" has even been included in the language?  After all, if there were no "null", I would have no bug, right?  In other words, what feature in the language couldn't work without null? I use XeTeX, Version 3.1415926-2.4-0.9998 (TeX Live 2012/W32TeX).  I am using the crop package to add bleed and crop marks to a document. This works fine for pages with white background, but how do I achieve this for pages which have another colour in the bakckground?  I tried the pagecolor package, and see that it somehow extends the pagecolour to around 2 to 3 mm into the bleed but not beyond. How do I make the entire bleed region of the same colour as the page?  \documentclass[12pt]{article} \usepackage[dvips=false,pdftex=false,vtex=false,paperwidth=138mm,paperheight=216mm]{geometry} \usepackage[noaxes,noinfo,cam,dvips,pdftex,center,width=168mm,height=246mm]{crop} \usepackage{xcolor} \usepackage[english]{babel} \usepackage{blindtext} \begin{document} \pagecolor{orange} \blinddocument \end{document} Prove that there are infinitely many primes and non-primes in the numbers $10^n+1$, where $n$ is a natural number. So numbers are 101, 1001, 10001 etc. C++ pointer address issue Show a connected metric space (X,d) is $\epsilon$-chainable for $\epsilon &gt;0$       $\epsilon$-chainable Definition      (X,d) is $\epsilon$-chainable if given any two points $a,b \in X$, $\exists$ a finite set $\{ x_0,x_1,...,x_n\}$ of points in X with $x_0 = a$, $x_n=b$ and $d(x_{n-1},x_n)&lt;\epsilon$, $\forall$ n      Clopen Definition      A set is clopen $iff$ its boundary is empty      Connected Metric Definition      Let $(X,d)$ be a metric space. It is connected $iff$ it has no proper subsets which are clopen      The following are equivalent:         $X$ is connected   The only subsets of $X$ that are clopen are $\emptyset$ and $X$   $\nexists$ non-empty, disjoint, open sets $A$ and $B$ such that $X=A\bigcup B$   $\nexists$ non-empty, disjoint, closed sets $A$ and $B$ such that $X=A\bigcup B$         Theorem      Let $(X,d)$ be a metric space, and let $S$ be any subset of $X$. Then $S$ is closed $iff$ $S^c$ is open.     So how would someone show this exactly?  Let the set $A$ be the set of all elements in $(X,d)$ that can be reached from $a\in X$ in a finite number of steps with length less than $\epsilon$.  Does this mean that there should be no isolated points? (an isolated point would be at distance infinity from any other point, or distance zero from itself, since $\epsilon &gt;0$ we don't want this?)  Knowing that $X$ is connected $\implies$the only subsets of X that are clopen are $\emptyset$ and $X$  Also, by construction of A;   A is the set of all $\epsilon$-chains between any element and $a$  And, so $A^c = \emptyset$ if $A$ was $\epsilon$-chainable (because A has to have a path from all elements to a, for this to be true, the complement wouldn't have anything in it)  Leaving only $A$ as the remaining clopen set  Does this make any sense? Or should an alternative be used, and how to formalize it.  Thanks. $x^3+x+1$ irreducible over $\mathbb{F}_2$, $\theta$ root, compute powers of $\theta$ Problem statement:     Show that $x^3+x+1$ is irreducible over $\mathbb{F}_2$ and let $\theta$ be a root. Compute the powers of $\theta$ in $\mathbb{F}_2$.   I am having trouble computing the powers of $\theta$. $x^3+x+1$ is irreducible, since any cubic polynomial over a field is reducible if and only if it has a root in the field. Since $\mathbb{F}_2=\{0,1\}$, we see that none of these is a root of $x^3+x+1$.  To compute the powers of $\theta$, note that $\theta^3+\theta+1=0$. Hence $\theta^3=-(\theta+1)$. Is this a good enough answer for $\theta^3$?  To compute $\theta^2$, note that $\theta = -(\theta^3+1)$. Therefore, $$\theta^2=(\theta^3+1)^2 = \theta^6 + 2\theta^3 + 1 = (-\theta-1)^2-2\theta-2+1,$$ which just reduces to $\theta^2$. Any ideas for computing these powers?  Thanks! Calculation of $\lim_{n\to \infty}\prod_{r=1}^{n} \left(1+\frac{r}{n}\right)^{\frac{1}{n}}$ Is infinite scrolling justifiable? Recently I've noticed a new trend in user interfaces. Facebook and Twitter do this, and I've come across it on other random, less famous sites. However, to keep things simple, I'll just use Facebook as an example.  When you first log into Facebook, you are presented with a "News Feed" that has a certain amount of posts from your friends. The feed extends down past the bottom of the viewport.  Then, when you scroll down, to see the feeds "below the fold", at some point as you move downward, it loads in more items. Apparently, this is called "infinite scrolling".  On my computer, this often causes my position in the feed to jump while I'm in the action of scrolling, which is really annoying.  What's particularly egregious about this UI concept is that there is footer information at the bottom of the page. I advertise on Facebook, and use the link at the bottom of the page to get to the advertisement management interface.  Because of this incremental load feature I'm describing, I often scroll down to the bottom to get to the link I want, when I reach the bottom of the page, it will suddenly load in new data, pushing the footer down again, and I have to scroll down again.  This whole thing seems completely pointless to me. What's the upside? A Facebook page is near a megabyte of data, so saving the few extra kilobytes of feed data for when the user scrolls down is just not worth it.  What's wrong with a link that just says "show more"?  Since this additional data retrieval thing seems to happen as soon as I start scrolling even a little anyway, why not just load that data in the first place?  To me this minor annoyance reeks of some engineers concept of a "neat trick" that does not have any actual appreciable upside.  Or am I wrong about that? Is there an advantage that I'm not seeing? Am I the only one who thinks it's stupid? Do some people like it? Why are drivers and firmwares almost always written in C or ASM and not C++?