Yesterday I was googling how to merge two files and came across an awk snippet.  I need a simple merge, so sort -u is not the way to go, but the code below works.  Could some one please explain what this awk code does?  awk '!a[$0]++' file_1 file_2
This one-liner removes duplicate lines from text input without pre-sorting.  For example:  $ cat &gt;f q w e w r $ awk '!a[$0]++' &lt;f q w e r $    The original code I have found on the internets read:  awk '!_[$0]++'  This was even more perplexing to me as I took _ to have a special meaning in awk, like in Perl, but it turned out to be just a name of an array.  Now, I understand the logic behind the one-liner:  each input line is used as a key in a hash array, thus, upon completion, the hash contains unique lines in the order of arrival.  What I would like to learn is how exactly this notation is interpreted by awk. E.g. what the bang sign (!) means and the other elements of this code snippet.  How does it work?
I'm developing a site using Drupal 8 beta-14. I've created a view block of different terms and now I want to display it using code. How can I display it programatically?  I used to do it in Drupal 7 using this code but I'm confused about Drupal 8.  $block = module_invoke('block', 'block_view', '4'); $text_block = render($block['content']); Are there any non-green, non-artifact mana ramp cards? I have looked and can't seem to find any.  I have seen many green cards and some artifacts that do this, but nothing in Red, Blue, Black or White.    Are there any?  Note: By "Mana Ramp" I mean a card that generates mana, or one that lets you play more than one land per turn.  The end result, for example, would be on turn 4, playing a white only deck, I could tap more than 4 mana.  (Normally you only get one land per turn so a max of 4 mana on turn 4.) How do I exclude plugins from getting automatically updated? There is an opt-in filter that allows all plugins on my site to receive automatic updates:  add_filter( 'auto_update_plugin', '__return_true' );  I like this feature, but I don't want all my plugins to be updated automatically. How can I allow some plugins to be updated automatically, while excluding those I want to do manually? I use  on Windows 7 and I want to know if there is a good substitution for it on Ubuntu.   I want something that is good for editing html files. In .NET why is String.Empty read only instead of a constant? I'm just wondering if anyone knows what the reasoning was behind that decision. Efficient list intersection algorithm Given two lists (not necessarily sorted), what is the most efficient non-recursive algorithm to find the intersection of those lists? I have 1-band GeoTIFF file. The color interpretation for band is gray. I want a color table in order to transform my Col.tiff to Col.jpeg or Col.png.  I tried putting a color table in this tiff via a .vrt:  gdal_translate -of VRT  Col.tiff Col.vrt   then adding in the .vrt:  &lt;ColorInterp&gt;Palette&lt;/ColorInterp&gt; &lt;ColorTable&gt;    &lt;Entry c1="0" c2="0" c3="255" c4="240"/&gt;    &lt;Entry c1="0" c2="0" c3="254" c4="240"/&gt;    &lt;Entry c1="0" c2="0" c3="253" c4="240"/&gt;    &lt;Entry c1="0" c2="0" c3="252" c4="240"/&gt; &lt;/ColorTable&gt;   And translate again :  gdal_translate Col.vrt Col.tiff   But it answered:  Warning 1: Unable to export color table to GeoTIFF file.  Color tables can only be written to 1 band or 2 bands Byte or UInt16 GeoTIFF files.   How can I do it?  For information, there is gdalinfo for the Band:  Band 1 Block=55x18 Type=Float64, ColorInterp=Gray   Description = Something   Metadata:     GRIB_COMMENT=Something[p]     GRIB_ELEMENT=TMP     GRIB_FORECAST_SECONDS=0 sec     GRIB_REF_TIME=1401926400 sec UTC     GRIB_SHORT_NAME=SMTHG     GRIB_UNIT=[p]     GRIB_VALID_TIME=1401926400 sec UTC A non orientable closed surface cannot be embedded into $\mathbb{R}^3$ One of the mysteries that my numerics class left me with are "stiff systems". Our prof didn't really manage to explain what they are. Now that the class (and the test) are over, I'm still curious.   The most concise definition about "stiff systems" I've found so far is: "There is no universally accepted definition of stiffness". So, if there is none, I don't expect one.   I'd be thankful about information on both of the following points:   From what kind of (real-world) problems do stiff systems arise? What's so "stiff" about them? What's the good thing - or the bad thing - that I'd worry about when I have to numerically solve such a real-world problem? Title says it all. It seems to be random and is really annoying. I have recently started reading and watching Naruto. I was wondering in what aspect does the clones made by different techniques differ? They all have the same potential and capabilities. How to import a .max model into Blender? I've tried to import but I don't see the (.max) file as an option when importing. Is there another way to import the 3DMax model into Blender for rigging and animation? What's difference between shadowing and overriding a method in C#? The drive is constantly filling up. You've hunted down all the spare and random files you can. grep'd for coredump files and even removed some of the un-needed backups...  What would be your next move.  The actual server in question has 10GB of website files and the OS shouldn't take any more than 10GB so how do you track down what's filling a 50GB (virtual) drive? Which site deals with career development questions for programmers? Is there any site in the network where career development questions about the programming profession can be asked ? I thought Programmer's was the site for it, but that doesn't appear to be the case. Proof of infinitely many primes, clarification How can PPAs be removed? I've added many PPAs using the add-apt-repository command. Is there a simple way to remove these PPAs? I've checked in /etc/apt/sources.list for the appropriate deb lines but they aren't there.   This is on a server system so a command line solution would be great! Why does my regular expression work in X but not in Y? I wrote a regular expression which works well in a certain program (grep, sed, awk, perl, python, ruby, ksh, bash, zsh, find, emacs, vi, vim, gedit, …). But when I use it in a different program (or on a different unix variant), it stops matching. Why? Counting unique records across 2 columns and computing a score based on boolean values I have a table that looks like this in Google Big Query:  custID  InteractionDate Purchased?  Sales 1       20150312           F         0 1       20150312           T         200 1       20150314           T         150 2       20150221           T         400 2       20150221           F         0 2       20150221           T         120   ..that I need to transform to the following structure:   custID InteractionDate Success Sales  1     20150312          0.5    200  1     20150314           1     150  2     20150221         0.66    520   ..where in this second table the success column is defined as  count(purchase=Yes)/(count(purchase=Yes) + count(purchase=No)),   and sales is just the sum.  I'm quite new to BQ and no-SQL languages. I simply don't know how to do this, I've searched and seen examples that suggest using partition over but I simply haven't seen any example that does just this. Thanks a lot in advance. How to get video duration, dimension and size in PHP?