AR-15 Parts List: Building a Rifle? Start Here!

So you’re building an AR-15, or an AR-10, or an AR-47, or an AR-whatever.  

Awesome!

Building a rifle is one of the best things you can do to improve your knowledge as a shooter, and it means you end up with a rifle that’s uniquely yours.

custom ar-15
Building an AR let’s you create a rifle that’s uniquely yours.

What’s the most important thing to have when you’re building your rifle?

Bingo, your parts list!

Today, we’re going to talk about all the little parts and pieces you need to build an AR-15, where you can buy them, how to choose them, and the tools you’ll need to assemble everything.  

This should cover basically everything you need to build an AR of any caliber, except for the actual build process, which you can find here.

The actual parts you will need are:

Lower Parts List

  • Stripped Lower
  • Lower Parts Kit
  • Trigger (If not using parts kit trigger)
  • Buffer Kit  (Buffer, buffer tube, buffer spring)
  • Stock
  • Pistol Grip

Upper Parts List

  • Stripped or Assembled Upper
  • Forward Assist (If using a Stripped Upper)
  • Dust Cover (If using Stripped Upper)
  • Barrel
  • Handguard
  • Gas Tube
  • Gas Block
  • Bolt Carrier Group
  • Charging Handle
  • Muzzle Device

Tools Needed

  • Vice
  • Upper Vice Block
  • Lower Vice Block
  • Pin Punches
  • Armorer’s Wrench
  • Mallet
  • Utility Knife
  • Hex Key Set
  • C-Clamp or Roll Pin Pusher

Alright, if you just wanted to make sure you weren’t missing a part, you’re all done!  Good luck with your build, and make sure to let us know how it went in the comments below!

If you want a little more info about each of these parts, keep reading.

AR-15 Lower Parts List

  • Stripped Lower: You can get a stripped lower from a lot of different places, and there’s not going to be a huge amount of difference between the best one and an average one.  In general, buy from a brand you like, or buy one you like the rollmark on. This is going to be the heart of your build, so make sure you go with something you’ll like looking at a year from now.  If you aren’t sure, check out our list of best AR-15 lowers.
Editor’s Pick (Forged)
Aero Precision Lower

Aero Precision Lower

Prices accurate at time of writing

  • Lower Parts Kit: This contains all the springs and pins and detents and other hardware that will go into holding your lower together.  You can also get them with or without a trigger, depending on if you want a basic Mil-Spec-style trigger, or want something a little bit nicer.
  • Trigger: The quality of your barrel is going to have a huge effect on your accuracy, so it makes sense to spend a little money here, even if it means saving a little money elsewhere.  Check out our list of Best AR-15 Triggers if that’s something you’re interested in.
Geissele AR-15 Enhanced Triggers

Geissele AR-15 Enhanced Triggers

Prices accurate at time of writing

  • Buffer Kit: Your buffer system is what manages the recoil of your rifle and allows the rifle to cycle.  There’s a lot to be said about choosing a buffer weight, so be sure to check out this article on how to choose the proper buffer for your system.
  • Stock: MagPul or gtfo.  Just kidding. There’s about a million AR stock manufacturers out there, so just pick one you like the look of, or choose one that fits your purpose for the rifle, so a nice light stock like the standard MagPul MOE stock for a run-and-gun rifle, or  something like a PRS stock for a precision rifle.
  • Pistol Grip: Same deal as the stock, unless you’re doing a featureless build and need something to comply with your state’s gun laws (I’m looking at you California).
AR-15 with Magpul M-LOK handguard
AR-15 with Magpul M-LOK handguard and Magpul pistol grip and stock.

That does it for your lower parts.  Be sure to follow our AR-15 lower build guide if you want to make sure you’ve got all your parts in the right place, or just want to take a look at how we build our rifles.

AR-15 Upper Parts List

  • Stripped or Assembled Upper:  A “stripped” upper is just the upper.  An “assembled” upper comes with your forward assist and dust/ejection port cover.  A “complete” upper will include the barrel, handguard…well, everything.  Hence “complete”.  The final option is good if you don’t want to buy the tools to build an upper, or if you don’t want to mess with an upper at all and just want to slap something on a complete lower that works.  Also, people are going to tell you that building an upper is hard. Those people are wrong.  It’s easy, it’s safe (AR’s are self-headspacing for the most part, so you’re not going to accidentally build a hand grenade, and if you’re worried, you can get a No-Go or headspace gauge.  So, I recommend getting a stripped or assembled upper, the latter of which just comes with your ejection port and forward assist installed, and is what I’d suggest if you don’t want a fancy dust cover.   If you absolutely have to have your Punisher logo or whatever, get a stripped one.  All our suggestions here.
Aero M4E1 Enhanced Upper

Aero M4E1 Enhanced Upper

Prices accurate at time of writing

  • Forward Assist: I have…never, in my life, needed a forward assist on a rifle.  I know people with multiple tours of duty in very dry, sandy places who have never touched a forward assist outside of training.  I can count one one hand the number of times I’ve heard of people ever needing a forward assist.  Ostensibly, it’s on there if you need a little extra help getting a round seated in a dirty gun.  Realistically, especially if you’re cleaning your AR the way you should be, you’ll never need one, and I’d be fine running an upper that doesn’t have a slot for one.  You may feel differently, and that’s fine. I totally understand the “better to have it and not need it” mindset as well.  That’s the great thing about building your AR, you can get exactly what you want, not what some asshole on the internet (me) tells you to get.
  • Dust cover:  Your dust cover (also called an ejection port cover) goes over your ejection port to keep out dust.  Pretty self-explanatory. The only thing I’ll say is that you can get ones with cool designs, so if looking fashionable at the range is important to you, or you want to do a custom build around a theme, like this Storm Trooper build from IACoatings.com.
stormtrooper Iacoating
Not every rifle has to be a scurry black gun. It’s okay to have fun with it.
  • Barrel: Other than the trigger, your barrel is going to be the biggest factor impacting your accuracy and the overall performance of the rifle.  There are a lot of factors to think about when choosing a barrel like rifling twist, length, steel or fancy-shmancy carbon fiber, lining options, and more.  Be sure to check out our list of the best AR-15 barrels if you want to learn more about solid options, or how to choose a barrel for your build.
  • Handguard: Your handguard should reflect what you’re using the rifle for, and there are literally hundreds of options out there.  Pick one that suits your needs, and you’ll be all good. This is an area of intense personal preference, so pick something you’ll like.  Personally, I likes my rifles nice and light, so I usually go for minimalist options without all the rails and such. If you want to hang four flashlights and a coffee grinder on your gun, you’ll want the rails though, so again, pick something that fits your purpose.  Here’s our picks of the best AR-15 Handguards.
Aero Precision M4E1 with ATLAS Handguards
Aero Precision M4E1 with ATLAS Handguards
  • Gas Tube: It’s a tube that transports gas.  Really, there’s not much to say here other than to match the gas tube to your barrel’s system length (carbine, rifle, mid-length) and pick from a brand you trust.  Worst case, they’re like $20 unless you’re building a piston-based upper, so don’t stress too much over it.
  • Gas Block: This is another area where you have to pick your poison yourself.  You might be fine with a plain old gas block, you might be running a suppressor sometimes and need an adjustable gas block.  Get something that matches your purpose. I’d recommend an adjustable gas block for all rifles if you have the money though, as it’ll let you fine-tune your gas system to minimize recoil.  More functionality is almost always a good thing because it let’s you get a rifle that’s more suited to your specific needs and style.
Seekins

Seekins’ Adjustable Gas Block

Prices accurate at time of writing

  • Bolt Carrier Group: The BCG is the part that handles the actual firing and extraction of your rounds.  In general, what you want to think is “light and smooth”. The lighter your BCG is, the less recoil you’ll have, the less muzzle movement, the more accurate you can be, especially during rapid fire.  The smoother the BCG is, the more reliable and the more consistent your AR will be, and the well, smoother it will be to shoot. There are a number of coating options that’ll make your gun a little smoother, and there are a number of lightweight BCGS out there.  The BCG is one of the easiest parts to swap out, and indeed you’ll be pulling it out every time you clean your gun anyway, so it’s okay to cheap out at first if you want to get a basic gun built that you can upgrade later.  Check out our BCG guide for more info.
Brownells Lightweight Bolt Carrier Group Finished in Titanium Nitride
Brownells Lightweight Bolt Carrier Group Finished in Titanium Nitride
  • Charging Handle:  This is what you will use to chamber a round in your AR.  If you’re going with a basic build, go with a basic charging handle.  If not, go with something nicer. I will say, if you’re a leftie, or building a rifle for someone who is, or you just want a slightly more useable rifle, get yourself an ambidextrous handle.  If you just want a quick, high-quality recommendation, BCM’s Gunfighter handle is on all my rifles, and I love it.
BCM Charging Handle
BCM Charging Handle
  • Muzzle Device:  Compensators, Flash Hiders, Suppressors, Brakes, there’s all kinds of things you can slap on the end of your rifle, and they all have their benefits.  Check out our muzzle device guide  to figure out what you need for your build.
VG6 Gamma 556
VG6 Gamma 556

 

That does it for our upper parts, so check out our AR-15 upper build guide if you want to make sure you got all your parts in the right way.

AR-15 Build Tools Parts List

  • Vice:  Necessary for keeping everything stable while you’re hammering and punching and such.  I use a basic bench vise, but you can use whatever works for the space you’re in. You can also get by without one if you’re very, very, very careful, and creative.  I’ve seen people building rifles in caves using nothing but a box cutter, a screwdriver, and an old brick, but I wouldn’t recommend it.
  • Upper Vice Block: This let’s you safely and effectively hold your upper in place, which is especially important while you’re installing your barrel.  I use this DPMS block
  • Lower Vice Block: Less important than the upper block, still highly recommended if you want to make your life easier while building your rifle.  
  • Pin Punches:  Brass is recommended so you don’t mar your finish.  I like these.
Trigger Hammer Pin with Punch
Trigger Hammer Pin with Punch
  • C-Clamp:  Buy a cheap 3 Pack off Amazon and use them as needed to install your roll pins.
  • Roll-Pin Pusher/Drift Tool:  Not strictly necessary, still highly recommended if you’re going to be building multiple rifles. Makes roll-pin installation much easier
  • Armorer’s Wrench: Needed for tightening your barrel nut, delta ring, castle nut, etc.  They’re relatively cheap, and is also one of the only purpose-built tools you’ll need.  We recommend this guy.
AR-15 Armorer's Wrench
AR-15 Armorer’s Wrench
  • Utility Knife: A box cutter is the best way to install some of your detents, trust me.
  • Hex Key Set:  Needed for installing some handguards, as well as things like your gas block, and often your trigger guard.

That about does it for the tools you’ll need.  I’m sure there’s a million and one other things out there that you can use, and I’d love to here about tools that could make the job easier, or about the…creative ways you all have built your rifles, so let me know in the comments below.

How To Build One

We’ve got you covered here too!

And for more recommendations down to individual parts…check out our AR-15 Definitive Resource.

Parting Shots

That about does it for our parts list.  There’s probably something I’m forgetting so let me know in the comments below if I left something out, and let me know about any builds this helps you with.  I can also help you out if you have any questions about the parts we’ve talked about today.

What did you think of our parts list?  Did this help you with your build? Let me know in the comments!

The post AR-15 Parts List: Building a Rifle? Start Here! appeared first on Pew Pew Tactical.

via Pew Pew Tactical
AR-15 Parts List: Building a Rifle? Start Here!

Comparison of Window Functions & CTEs in MySQL 8 vs MariaDB

Every MySQL database programmer should learn and apply the newly added MariaDB and MySQL Window Functions and Common Table Expressions(CTEs) in their daily work. Both CTEs and window functions enable easy solutions to many query challenges that in prior releases have been difficult and sometimes impossible to surmount. Mastering these features opens the door to query solutions that are more robust, execute faster, and are easier to maintain over time than prior solutions using older techniques.

In our last blog we compared User Roles in MySQL 8 vs. MariaDB.  Today, we will here compare Window Functions and Common Table Expressions in both databases.

Window Functions

While all database administrators are familiar with aggregate functions like COUNT(), SUM(), and AVG(), far less people make use of window functions in their queries.  Unlike aggregate functions, which operate on an entire table, window functions operate on a set of rows and return a single aggregated value for each row.

The main advantage of using window functions over regular aggregate functions is that window functions do not cause rows to become grouped into a single output row.  Instead, the rows retain their separate identities and an aggregated value is added to each row.

Window Functions in MariaDB

Windowing functions were added to the ANSI/ISO Standard SQL:2003 and then extended in ANSI/ISO Standard SQL:2008.  DB2, Oracle, Sybase, PostgreSQL and other products have had full implementations for years. Other vendors added support for window functions later on.  Case in point, Microsoft did not add Window Functions to SQL Server until SQL 2012.

After numerous wishes and feature requests for window functions over the years, they were finally introduced in MariaDB 10.2.0 to great fanfare!  Now MariaDB includes window functions such as ROW_NUMBER, RANK, DENSE_RANK, PERCENT_RANK, CUME_DIST, NTILE, COUNT, SUM, AVG, BIT_OR, BIT_AND and BIT_XOR.

The Syntax

Window function queries are characterised by the OVER keyword, following which the set of rows used for the calculation is specified. By default, the set of rows used for the calculation (the “window”) is the entire dataset, which can be ordered with the ORDER BY clause. The PARTITION BY clause is then employed to reduce the window to a particular group within the dataset.

Here’s an example:
Given the following table of student test scores:

+------------+---------+--------+
| name       | test    | score  |
+------------+---------+--------+
| Steve      | SQL     | 75     |
+------------+---------+--------+
| Robert     | SQL     | 43     |
+------------+---------+--------+
| Tracy      | SQL     | 56     |
+------------+---------+--------+
| Tatiana    | SQL     | 87     |
+------------+---------+--------+
| Steve      | Tuning  | 73     |
+------------+---------+--------+
| Robert     | Tuning  | 31     |
+------------+---------+--------+
| Tracy      | Tuning  | 88     |
+------------+---------+--------+
| Tatiana    | Tuning  | 83     |
+------------+---------+--------+

The following two queries return the average test scores partitioned by test and by name respectively – in other words, aggregated by test and by name:

SELECT name, test, score, AVG(score) OVER (PARTITION BY test) 

  AS average_by_test FROM test_scores;

+----------+--------+-------+-----------------+
| name     | test   | score | average_by_test |
+----------+--------+-------+-----------------+
| Steve    | SQL    |    75 |         65.2500 |
| Steve    | Tuning |    73 |         68.7500 |
| Robert   | SQL    |    43 |         65.2500 |
| Robert   | Tuning |    31 |         68.7500 |
| Tracy    | SQL    |    56 |         65.2500 |
| Tracy    | Tuning |    88 |         68.7500 |
| Tatiana  | SQL    |    87 |         65.2500 |
| Tatiana  | Tuning |    83 |         68.7500 |
+----------+--------+-------+-----------------+
SELECT name, test, score, AVG(score) OVER (PARTITION BY name) 

  AS average_by_name FROM student;

+---------+--------+-------+-----------------+
| name    | test   | score | average_by_name |
+---------+--------+-------+-----------------+
| Steve   | SQL    |    75 |         74.0000 |
| Steve   | Tuning |    73 |         74.0000 |
| Robert  | SQL    |    43 |         37.0000 |
| Robert  | Tuning |    31 |         37.0000 |
| Tracy   | SQL    |    56 |         72.0000 |
| Tracy   | Tuning |    88 |         72.0000 |
| Tatiana | SQL    |    87 |         85.0000 |
| Tatiana | Tuning |    83 |         85.0000 |
+---------+--------+-------+-----------------+

In both cases, note that the original scores are still available to each row.

Window Functions in MySQL 8

MySQL has been even later in adopting the Window Functions standard, with it being part of version 8.0 that is expected to be released later this year.   

MySQL employs the same ANSI/ISO Standard as other DBMSes whereby Window function queries are characterised by the OVER keyword and the PARTITION BY clause is employed to reduce the window to a specific group within the result set.

The currently supported functions include:

Name Description
CUME_DIST() Cumulative distribution value
DENSE_RANK() Rank of current row within its partition, without gaps
FIRST_VALUE() Value of argument from the first row of window frame
LAG() Value of argument from row lagging current row within partition
LAST_VALUE() Value of argument from the last row of window frame
LEAD() Value of argument from row leading current row within partition
NTH_VALUE() Value of argument from N-th row of window frame
NTILE() Bucket number of the current row within its partition.
PERCENT_RANK() Percentage rank value
RANK() Rank of current row within its partition, with gaps
ROW_NUMBER() Number of current row within its partition

As an example, we’ll explore the CUME_DIST() function.

It returns the cumulative distribution of a value within a group of values; that is, the percentage of partition values less than or equal to the value in the current row. This represents the number of rows preceding or peer with the current row in the window ordering of the window partition divided by the total number of rows in the window partition. Return values range from 0 to 1.

This function is usually used with ORDER BY to sort partition rows into the desired order. Without ORDER BY, all rows are peers having a value of 1.

The following query shows, for the set of values in the val column, the CUME_DIST() value for each row, as well as the percentage rank value returned by the similar PERCENT_RANK() function. For reference, the query also displays row numbers using ROW_NUMBER():

SELECT

  val,

  ROW_NUMBER()   OVER w AS 'row_number',

  CUME_DIST()    OVER w AS 'cume_dist',

  PERCENT_RANK() OVER w AS 'percent_rank'

FROM numbers

WINDOW w AS (ORDER BY val);

+------+------------+--------------------+--------------+
| val  | row_number | cume_dist          | percent_rank |
+------+------------+--------------------+--------------+
|    1 |          1 | 0.2222222222222222 |            0 |
|    1 |          2 | 0.2222222222222222 |            0 |
|    2 |          3 | 0.3333333333333333 |         0.25 |
|    3 |          4 | 0.6666666666666666 |        0.375 |
|    3 |          5 | 0.6666666666666666 |        0.375 |
|    3 |          6 | 0.6666666666666666 |        0.375 |
|    4 |          7 | 0.8888888888888888 |         0.75 |
|    4 |          8 | 0.8888888888888888 |         0.75 |
|    5 |          9 |                  1 |            1 |
+------+------------+--------------------+--------------+

The OVER clause is permitted for many aggregate functions, including:

  • AVG()
  • COUNT()
  • MAX()
  • MIN()
  • STDDEV_POP(), STDDEV(), STD()
  • STDDEV_SAMP()
  • SUM()
  • VAR_POP(), VARIANCE()
  • VAR_SAMP()

These can be used as window or non-window functions, depending on whether the OVER clause is present or absent:

MySQL also supports non-aggregate functions that are used only as window functions. For these, the OVER clause is mandatory:

  • CUME_DIST()
  • DENSE_RANK()
  • FIRST_VALUE()
  • LAG()
  • LAST_VALUE()
  • LEAD()
  • NTH_VALUE()
  • NTILE()
  • PERCENT_RANK()
  • RANK()
  • ROW_NUMBER()

As an example of a non-aggregate window functions, this query uses ROW_NUMBER(), which produces the row number of each row within its partition. In this case, rows are numbered per country. By default, partition rows are unordered and row numbering is indeterminate. To sort partition rows, include an ORDER BY clause within the window definition. The query uses unordered and ordered partitions (the row_num1 and row_num2 columns) to illustrate the difference that omitting and including ORDER BY makes:

SELECT

  year, country, product, profit,

  ROW_NUMBER() OVER(PARTITION BY country) AS row_num1,

  ROW_NUMBER() OVER(PARTITION BY country ORDER BY year, product) AS row_num2

FROM sales;

+------+---------+------------+--------+----------+----------+
| year | country | product    | profit | row_num1 | row_num2 |
+------+---------+------------+--------+----------+----------+
| 2000 | Finland | Computer   |   1500 |        2 |        1 |
| 2000 | Finland | Phone      |    100 |        1 |        2 |
| 2001 | Finland | Phone      |     10 |        3 |        3 |
| 2000 | India   | Calculator |     75 |        2 |        1 |
| 2000 | India   | Calculator |     75 |        3 |        2 |
| 2000 | India   | Computer   |   1200 |        1 |        3 |
| 2000 | USA     | Calculator |     75 |        5 |        1 |
| 2000 | USA     | Computer   |   1500 |        4 |        2 |
| 2001 | USA     | Calculator |     50 |        2 |        3 |
| 2001 | USA     | Computer   |   1500 |        3 |        4 |
| 2001 | USA     | Computer   |   1200 |        7 |        5 |
| 2001 | USA     | TV         |    150 |        1 |        6 |
| 2001 | USA     | TV         |    100 |        6 |        7 |
+------+---------+------------+--------+----------+----------+

Common Table Expressions (CTEs)

A common table expression (CTE) can be thought of as a temporary result set that is defined within the execution scope of a single SELECT, INSERT, UPDATE, DELETE, or CREATE VIEW statement. A CTE is similar to a derived table in that it is not stored as an object and lasts only for the duration of the query. However, unlike a derived table, a CTE can be self-referencing and can be referenced multiple times in the same query.

A CTE can be used to:

  • Create a recursive query.
  • Substitute for a view when the general use of a view is not required; that is, you do not have to store the definition in metadata.
  • Enable grouping by a column that is derived from a scalar subselect, or a function that is either not deterministic or has external access.
  • Reference the resulting table multiple times in the same statement.

Using a CTE offers the advantages of improved readability and ease in maintenance of complex queries. The query can be divided into separate, simple, logical building blocks. These simple blocks can then be used to build more complex, interim CTEs until the final result set is generated.

Recursive CTEs

Recursive common table expressions (CTEs) were an implementation of standard SQL:1999 for hierarchical queries.  The first implementations of Recursive CTEs began appearing in 2007. The recursive CTEs from the standard were relatively close to the existing implementation in IBM DB2 version 2.  Recursive CTEs were eventually supported by Microsoft SQL Server (since SQL Server 2008 R2), Firebird 2.1, PostgreSQL 8.4+, SQLite 3.8.3+, Oracle 11g Release 2, and IBM Informix version 11.50+.

Without Common-table-expressions or a connected-by clause it is still possible to achieve hierarchical queries with user-defined recursive functions, but these tend to result in very complex SQL.

CTEs in MariaDB

In MariaDB, a non-recursive CTE is basically considered to be a query-local VIEW whose syntax is more readable than nested FROM (SELECT …). A CTE can refer to another and it can be referenced from multiple places.

Thus, CTEs are similar to derived tables. For example,

SQL with derived table:

SELECT * FROM

   ( SELECT * FROM employees

     WHERE dept = 'Engineering' ) AS engineers

WHERE
...

SQL with CTE:

WITH engineers AS
 
   ( SELECT * FROM employees

     WHERE dept = 'Engineering' )

SELECT * FROM engineers

WHERE ...

SQL is generally poor at recursion.  One of the advantages of CTEs is that they permit a query to reference itself, hence recursive SQL. A recursive CTE will repeatedly execute subsets of the data until it obtains the complete result set. This makes it particularly useful for handling hierarchical or tree-structured data.

With recursive CTEs you can achieve things that would be very difficult to do with standard SQL and at a faster execution speed. They can help solve many types of business problems and even simplify some complex SQL/application logic down to a simple recursive call to the database.

Some example uses for recursive CTE are to find gaps in data, create organization charts and create test data.

WITH RECURSIVE signifies a recursive CTE. It is given a name, followed by a body (the main query) as follows:

Below is a recursive CTE that counts from 1 to 50.
WITH   cte

AS     (SELECT 1 AS n -- anchor member

        UNION ALL

        SELECT n + 1 -- recursive member

        FROM   cte

        WHERE  n < 50 -- terminator
       )

SELECT n

FROM   cte;

The above statement prints a number series from 1 to 49.

CTEs in MySQL

MySQL 8.0 adds CTEs via the standard WITH keyword, in much the same way it is implemented in competing products.

To specify common table expressions, use a WITH clause that has one or more comma-separated subclauses. Each subclause provides a subquery that produces a result set, and associates a name with the subquery. The following example defines CTEs named cte1 and cte2 in the WITH clause, and refers to them in the top-level SELECT that follows the WITH clause:

WITH

  cte1 AS (SELECT a, b FROM table1),

  cte2 AS (SELECT c, d FROM table2)

SELECT b, d FROM cte1 JOIN cte2

WHERE cte1.a = cte2.c;

Immediately preceding SELECT for statements that include a SELECT statement:

  • INSERT … WITH … SELECT …
  • REPLACE … WITH … SELECT …
  • CREATE TABLE … WITH … SELECT …
  • CREATE VIEW … WITH … SELECT …
  • DECLARE CURSOR … WITH … SELECT …
  • EXPLAIN … WITH … SELECT …

A recursive common table expression is one having a subquery that refers to its own name. For example:

WITH RECURSIVE cte (n) AS

(
  SELECT 1

  UNION ALL

  SELECT n + 1 FROM cte WHERE n < 5
)

SELECT * FROM cte;

+------+
| n    |
+------+
|    1 |
|    2 |
|    3 |
|    4 |
|    5 |
+------+

Conclusion
Window Functions and Common Table Expressions (CTEs) have been a mainstay of many popular database products for some time now.  With the release of MySQL version 8 and MariaDB 10.2.0, both vendors have caught up with competing DBMSes such as SQL Server and Oracle.

The post Comparison of Window Functions & CTEs in MySQL 8 vs MariaDB appeared first on SQLyog Blog.

via Planet MySQL
Comparison of Window Functions & CTEs in MySQL 8 vs MariaDB

Open and Concealed Carry are Protected by the Second Amendment

Constitutional We the People
We the People have the right to keep and bear arms. It says it right here on this Constitution.

Arizona -(Ammoland.com)- The natural right to bear arms includes the right to carry them concealed as well as openly. Both types of carry were practiced at the time of the ratification of the Bill of Rights. Flintlock “muff pistols” were widely available before 1791. Daggers, dirks and other assorted blades were commonly carried concealed. Sword canes conceal the blade inside of the cane, and are considered concealed weapons. They were commonly available.  They became popular, in part, to avoid any social reproach against the carry of swords, anticipating the condemnation of open carry today.

Historic examples of choices for concealed carry.
Historic examples of choices for concealed carry.

The Second Amendment does not differentiate between concealed and openly carried arms.  Such differentiation was not discussed during the debates about the Second Amendment.  It was decades after the Bill of Rights was ratified that concealed carry was questioned. Arms technology had not changed significantly.

Concealed weapons had and have military purposes. General Gage, the British Officer in charge of occupied Boston, had his officers conceal their sidearms when patrolling to prevent Paul Revere’s ride. From William Diamond’s Drum page 94:

And finally, unbeknown to him. Gage had that afternoon posted mounted officers, with their sidearms concealed as though they were on pleasure jaunts, along the Cambridge roads, just in case messengers should try to give out alarms that night.

There were no colonial statutes that separated the carrying of concealed weapons from the open carrying of weapons.

The Kentucky legislature passed a statute forbidding concealed arms in 1813. It was challenged in court.

The statute was found unconstitutional in Bliss v. Commonwealth of Kentucky, in the state Supreme Court. It was 1822, three decades after the Second Amendment was ratified.  Any restriction on bearing arms was contrary to “the right of the citizens to bear arms in defense of themselves and the state“, and was therefore void.

The court reasoned that any diminution of the right that existed when the Constitutional protection was adopted, was an infringement of the right, and was therefore unconstitutional. The logic is impeccable.

In 1833, the Supreme Court ruled that the Bill of Rights, including the Second Amendment, did not apply to the states.

In 1833, the Indiana Supreme Court ruled that concealed carry could be banned for people who were not travelers.

Five other state courts, with different state constitutions,  (Alabama, Tennessee, Arkansas, Georgia, and Louisiana), ruled their legislatures could ban concealed carry  from 1833 to 1850, to varying degrees.

In Kentucky, a Constitutional amendment was deemed necessary. The constitutional amendment to allow the legislature to regulate the concealed carry of weapons passed in 1849, as part of a constitutional convention. In 1850, the wording in bold was added:

  “That the rights of the citizens to bear arms in defense of themselves and the State shall not be questioned; but the General Assembly may pass laws to prevent persons from carrying concealed arms.”

All but Indiana were slave states.  Prohibiting the carry of concealed weapons is particularly important to keeping suspect minorities disarmed.  If the weapons are concealed, it is much harder to enforce legal or extralegal disarmament techniques, such as selective enforcement under color of law.

In 1859,  The Texas Supreme Court, in Cockrum v. state, held that “The right of a citizen to bear arms, in defense of himself or the State, is absolute.”  The court cited both the Second Amendment and the then current Texas Constitution. The case held that if inexpensive weapons were prohibited, the right of self defense would be chilled for poor people.

In 1868 the Fourteenth Amendment was passed to assure, in part, that the Second Amendment would be enforced to insure that freed slaves could keep and bear arms. The former slave states found ways to evade the requirement. In 1873, the Fourteenth Amendment’s enforcement of the Bill of Rights against state encroachment was nullified by the Supreme Court.

In 1903, the Vermont Supreme Court, in State v. Rosenthal, found that an ordinance requiring a permit to carry a concealed pistol “..repugnant to the Constitution and laws of the state,”.

Federal laws have never been passed against the carry of concealed weapons.

In 2008 the Heller decision made clear what it meant to bear arms. Scalia quoted Justice Ginsburg’s writing in a previous case.  From cornell.edu:

Justice Ginsburg wrote that “[s]urely a most familiar meaning is, as the Constitution’s Second Amendment … indicate[s]: ‘wear, bear, or carry … upon the person or in the clothing or in a pocket, for the purpose … of being armed and ready for offensive or defensive action in a case of conflict with another person.’ ”

“..in the clothing or in a pocket” is carrying concealed.

Justice Scalia concluded that laws banning the concealed carry of arms were constitutional, solely because such laws were long standing in a number of states. Such laws were not upheld before the 1830’s, 40 years after the Bill of Rights was ratified.

Laws against the concealed carry of weapons are vestiges of laws designed to keep slaves and free blacks disarmed.

In 2010, the Supreme Court held the Second Amendment is incorporated against the States by the Fourteenth Amendment, finally doing what the Court should have done in 1873.

Adam Winkler, an Constitutional scholar at UCLA, has written that allowing only open carry may be the best way to discourage bearing arms in general.  He made the case this might be the most effective way for the California legislature to chill the exercise of the Second Amendment.

Vermont has never required a permit for open or concealed carry. Twelve states have reformed their laws to allow the carrying of weapons, concealed or openly, without permission from the government, since 2003. They call it Constitutional Carry.

Both open carry and concealed carry are protected by the Second Amendment. Restricting the bearing of arms to either open carry or  concealed carry is a clear infringement of that right to bear arms.

©2018 by Dean Weingarten: Permission to share is granted when this notice is included.

Link to Gun Watch


About Dean Weingarten:Dean Weingarten

Dean Weingarten has been a peace officer, a military officer, was on the University of Wisconsin Pistol Team for four years, and was first certified to teach firearms safety in 1973. He taught the Arizona concealed carry course for fifteen years until the goal of constitutional carry was attained. He has degrees in meteorology and mining engineering, and recently retired from the Department of Defense after a 30 year career in Army Research, Development, Testing, and Evaluation.

This post Open and Concealed Carry are Protected by the Second Amendment appeared first on AmmoLand.com .

via AmmoLand.com
Open and Concealed Carry are Protected by the Second Amendment

How to Concealed Carry a Full-Size (Or Even Larger) Gun

Sometimes you don’t want to just carry a pocket pistol.

Instead, you want to be able to feel the weight of that 1911 as you walk around, and hear it clunk on your nightstand when you take it off for the evening.

You just want to carry something big.

gun recoiling into shooters face
Well, Something Big – Within Reason.

Now when most people think “big gun,” they think 1911 or a long barrel revolver, but unless you’re the Joker, you probably aren’t going to carry a Smith & Wesson 500 Magnum with the 6.5-inch barrel or a full-size Desert Eagle.

Instead, you might want to carry a Glock 17, H&K VP9, Kimber Stainless II 1911, or something similar.

While some of these have shorter barrels than others, they are all full-size guns, and none of them are small.

CCW Full Size 1911
Concealed Carry 1911. Because You Can.

Of course, carrying a bigger gun brings a different set of challenges that you face when you carry a subcompact or even a compact handgun.

To help you out, this article is going to go over some of the things you’ll want to consider when you are thinking about or having trouble carrying a big gun.

Now, as you read below, it may come across like carrying a big gun is not a good idea.  That’s not the case at all; it’s totally up to you what you carry.

I do, however, want to discuss the pitfalls of carrying a big gun so you are aware of them before you go out and spend 1200 dollars on a sweet 1911 and realize you can’t appendix carry it like you saw in a movie.

So let’s get started.

Size Matters

Let’s compare some guns so you can see the size difference.

Springfield 1911 A1
Springfield 1911 A1

Compared to something like the Sig P238 in .380, a standard 1911 is 3.4 inches longer and almost twice as thick.  Even compared to a Glock 36 (their .45 ACP subcompact) you aren’t gaining much other than more gun to carry around.

Is one round worth hauling around the extra 15.5 ounces?  That’s almost an extra pound… for one bullet.

So what do we gain with the bigger gun?

For starters, you get a slightly larger round if you go with a 9mm version of the Kimber.  But, if you are carrying a 1911, most wouldn’t bother with 9mm and instead, go with the .45 ACP. This gives you a much larger round, obviously.

9mm Will Kill Your Body, .45 ACP Will Kill Your Soul

So yeah, you get one more bullet with the .45 ACP version, but the gun is almost twice as wide.  It’s even wider than the Glock 36 which is 1.10 inches wide and holds 6+1 rounds also.

Carry Positions for a Large CCW

Now that you know what you’re getting into, let’s talk carry positions for your big CCW gun.  Your carry position will greatly depend on your body type.

For example, if you are 5’11” and weigh 180 pounds, you’re more limited than a guy who’s 6’5” and 280 pounds.

Of course, your clothing choices will also play a large part how and where you carry a big CCW gun.

Do you wear tee shirts all the time?

Do you wear a jacket and dress pants?

Carrying pistol concealed
How You Dress Affects How You Carry

A smaller frame pistol will be easier to conceal in the summer and in thinner, tighter fitting clothing.

Furthermore, your full-sized gun isn’t something you’ll want to carry in an ankle holster or even appendix carry.  It’s not going to be comfortable and is unlikely to even fit in the first place.

All that said, let’s look examine what options you do have.

Wear a Jacket

Depending on the occasion, you could wear a jacket.  This would allow for an OWB holster anywhere from the 3-6 o’clock position.  Most jackets will easily hide even a full-size gun in a holster.

Plus, even if you are able to comfortably carry your sidearm of choice in an IWB holster, adding another layer of loose-fitting clothing will help you ensure that you won’t print.

If you do choose to use an OWB holster, be sure not to keep it in a spot where it can easily be accidentally exposed.

Carrying a Glock
Carrying a Glock Under a Jacket

Making sure your gun isn’t an attention grabber will also help.  If you have a nickel plated something or other with a mural painted on the slide, it’s going to be a lot easier to spot if your jacket opens in the wind.

Black gun, black holster, black pants; even a darker shirt helps.  And, of course, just keeping your jacket zipped or buttoned makes a huge difference.  If black isn’t your thing…check out our Gray Man Loadout.

Shoulder Holster

A shoulder holster is an alternative to a waistband holster if you are wearing a jacket.

This kind of holster isn’t for everyone though.  Those of us who have a thinner build might need to position the holster more to the vertically to hide the gun.

Regardless, the barrel could poke at the rear of your jacket or the grip might print out the front.

Shoulder Holster
Shoulder Holster and 1911

When holstering your gun under your arm, make sure you practice your draw. If you aren’t accustomed to it, you may fumble or have an otherwise difficult time if you need to pull your gun under pressure. This also goes for t-shirt holsters.

Inside the Waistband Holster

An IWB holster is also an option.  Like a shoulder holster, using a holster inside your waistband will really depend on your body-type.

You will also need to make sure you wear the appropriate clothing to conceal your gun.  A tuckable holster can help when you aren’t wearing a jacket or some other outer layer like a sweatshirt.

The position of your carry will also greatly depend on your body shape.  If you are on the leaner side, you will probably need to carry at the 4 or 5 o’clock position.

If you have a little more mass to you, the 3 o’clock position might be easier for you to hide and still draw your gun easily if you need it.

We can help you find the right IWB holster for you in our Best Concealed Carry Holsters review.

Final Thoughts

When you choose the gun you are going to carry every day to protect yourself, you need to make sure you can handle it well, so be sure to consider why you want to choose a large CCW weapon.

I prefer to carry for safety, but don’t like to have the inconvenience of a large gun where I need to change the way I bend or move or wear different clothing.

On the other hand, some people prefer the feeling of security that goes with a weightier weapon or feels more confident carrying a larger caliber.

Looking for more options? You should take a look at our other Best CCW Guns articles, we’ve looked at a huge range of guns from full-size to revolvers to subcompacts.

What about you?  What’s your CCW sidearm of choice?  What are your thoughts on big guns for CCW?  Have any advice for those looking for concealed carry larger sidearms?  As always, share your thoughts in the comments!

The post How to Concealed Carry a Full-Size (Or Even Larger) Gun appeared first on Pew Pew Tactical.

via Pew Pew Tactical
How to Concealed Carry a Full-Size (Or Even Larger) Gun

New Webinar on How to Design Open Source Databases for High Availability

Join us March 27th for this webinar on how to design open source databases for high availability with Ashraf Sharif, Senior Support Engineer at Severalnines. From discussing high availability concepts through to failover or switch over mechanisms, Ashraf will cover all the need-to-know information when it comes to building highly available database infrastructures.

It’s been said that not designing for failure leads to failure; but what is the best way to design a database system from the ground up to withstand failure?

Designing open source databases for high availability can be a challenge as failures happen in many different ways, which sometimes go beyond imagination. This is one of the consequences of the complexity of today’s open source database environments.

At Severalnines we’re big fans of high availability databases and have seen our fair share of failure scenarios across the thousands of database deployment attempts that we come across every year.

In this webinar, we’ll look at the different types of failures you might encounter and what mechanisms can be used to address them. We will also look at some of popular high availability solutions used today, and how they can help you achieve different levels of availability.

Sign up for the webinar

Date, Time & Registration

Europe/MEA/APAC

Tuesday, March 27th at 09:00 BST / 10:00 CEST (Germany, France, Sweden)

Register Now

North America/LatAm

Tuesday, March 27th at 09:00 PDT (US) / 12:00 EDT (US)

Register Now

Agenda

  • Why design for High Availability?
  • High availability concepts
    • CAP theorem
    • PACELC theorem
  • Trade offs
    • Deployment and operational cost
    • System complexity
    • Performance issues
    • Lock management
  • Architecting databases for failures
    • Capacity planning
    • Redundancy
    • Load balancing
    • Failover and switchover
    • Quorum and split brain
    • Fencing
    • Multi datacenter and multi-cloud setups
    • Recovery policy
  • High availability solutions
    • Database architecture determines Availability
    • Active-Standby failover solution with shared storage or DRBD
    • Master-slave replication
    • Master-master cluster
  • Failover and switchover mechanisms
    • Reverse proxy
    • Caching
    • Virtual IP address
    • Application connector

Sign up for the webinar

Speaker

Ashraf Sharif is System Support Engineer at Severalnines. He was previously involved in hosting world and LAMP stack, where he worked as principal consultant and head of support team and delivered clustering solutions for large websites in the South East Asia region. His professional interests are on system scalability and high availability.

via Planet MySQL
New Webinar on How to Design Open Source Databases for High Availability

Now you can visit Disney Parks in the US through Google Street View

Special for kids — and importantly parents of kids — now you can get designs on visiting Disney — and dropping a small fortune in the process — thanks to Google Maps after it added Street View images for 11 Disney Parks.

The feature looks to cover parks in the U.S. only at this point, but that alone might help you relive a recent visit, or else familiarize yourself for the first/next one.

It’s been interesting to watch Google Maps develop into a tool for tourism. Particularly in Asia, governments and tourism boards have worked with Google to help bring popular destination and cultural landmarks onto the service. That’s in contrast to the West, where Maps had been seen as a service that poses significant privacy concerns — remember back in 2010 when Google sucked up personal data via its Street View cars?

Disney might not be a world wonder or cultural hotspot, but it definitely makes sense for the parks to have a more visual presence on Google Maps, and so here we are.

Don’t worry, trusted sources close to TechCrunch’s Matthew Panzarino have assured me that he will continue to make his annual visit to Disneyland to test Apple’s newest iPhone in real-world conditions despite this new tie-up with Google. Some things just can’t be digitized.

via TechCrunch
Now you can visit Disney Parks in the US through Google Street View

Google adds Disney parks to Street View

Last year Google revamped its Street View cameras to help us better map the real world, now it’s taken the technology to a much more magical land. From today, you’ll be able to explore inside 11 Disney Parks, getting an on-the-ground glimpse of all its castles, rides and attractions, including the captivating Avatar-themed world of Pandora. It’ll also definitely prove popular when the Star Wars area opens up next year. Now if only the imagery was available in real time, so we’d know whether to bother lining up for Splash Mountain or not.

via Engadget
Google adds Disney parks to Street View

Researchers: Schools are safer than they were in the 90s, and school shootings are not more common than they used to be

by Allie Nicodemo and Lia Petronio

The deadly school shooting this month in Parkland, Florida, has ignited national outrage and calls for action on gun reform. But while certain policies may help decrease gun violence in general, it’s unlikely that any of them will prevent mass school shootings, according to James Alan Fox, the Lipman Family Professor of Criminology, Law, and Public Policy at Northeastern.

Since 1996, there have been 16 multiple victim shootings in schools, or incidents involving 4 or more victims and at least 2 deaths by firearms, excluding the assailant.

Of these, 8 are mass shootings, or incidents involving 4 or more deaths, excluding the assailant.

“This is not an epidemic”

Mass school shootings are incredibly rare events. In research publishing later this year, Fox and doctoral student Emma Fridel found that on average, mass murders occur between 20 and 30 times per year, and about one of those incidents on average takes place at a school.

Their research also finds that shooting incidents involving students have been declining since the 1990s.

Four times the number of children were killed in schools in the early 1990s than today, Fox said.

Click here to read the entire article at news.northeastern.edu.


via Buckeye Firearms Association
Researchers: Schools are safer than they were in the 90s, and school shootings are not more common than they used to be

Why Gun-Control Fails Miserably

Recently, National Review‘s David French penned an op-ed in hopes of explaining to some people why so many of us own guns. Yesterday, Bethany Mandel did the same thing in the pages of the New York Times. The idea was simple and noble. They wanted to show folks who don’t own guns why so many others do.

French notes that the response to both articles illustrates why gun control fails so miserably every single time.

Yet the responses to both essays have helped demonstrate why the Left keeps losing on guns. It simply can’t persuade a rational, reasonable adult who’s experienced a threat that they’re safer without effective means of self-defense. Indeed, the effort to make this case is so often rooted in condescension or ignorance that it’s deeply alienating.

First, there’s an odd argument that it’s somehow illegitimate to make a decision based on “fear.” Or — as one correspondent put it — “fear and paranoia.” This makes no sense. Americans make safety-based decisions all the time. Is it wrong to buckle a seatbelt because that’s a “fear-based” decision? Should you ride a motorcycle without a helmet just to show the world you’re not scared? Reasonable people take precautions in the face of real threats.

Next, you immediately hear that you’re foolish. That “you’re more likely to hurt yourself than defend yourself.” In other words, the gun is more dangerous to you and your family than it is to any given criminal. But if you’re speaking to a responsible, non-suicidal adult, then this argument is flat-out wrong. In fact, even when you include suicides in the analysis — and compare them to the best estimates of annual defensive gun use — you’ll find that law-abiding Americans use guns to defend themselves far more than they do to hurt themselves.

Moreover, another person’s irresponsibility is irrelevant to the existence of my fundamental liberties. I don’t surrender my free-speech rights because another person uses theirs to troll Twitter. I don’t surrender my right to free exercise of religion because another person joins a cult. I don’t surrender my inherent and unalienable right to self-defense because a man across town decides to kill himself.

It’s part of a much larger post, and I highly recommend you read it, but he’s right.

Many other people and I find the arguments against having the means to defend yourself delusional. I’ve heard them all before, but they’ve never made any sense. How am I more likely to hurt myself than defend myself? I’m not an idiot, after all, so if I follow a few basic safety rules, I shouldn’t have a problem, right?

Yet in the mind of the gun control activist, it seems we’re all perpetually stupid. No one can comprehend the basics of gun safety, which is probably why the words “gun safety” coming out of their mouths should be translated as “ban them all.” They think that’s the only way to keep any of us safe from guns.

The problem for them is that we don’t need them. Most Americans, even those who don’t own guns, know that we don’t need them. They can look at these arguments and see them for what they are, complete and utter nonsense.

That’s why gun control doesn’t work. It doesn’t work because it’s always premised on people being too stupid to live without some elite telling us how to do it.

No one wants to put up with that, so even a lot of non-gun owners refuse to accept that line of reasoning.

Yeah, they make a few wins here and there, but they’re small potatoes, and they can’t do it on the national stage. To make matters worse, they know it, and it burns them up.

It just makes me giggle.

via Bearing Arms
Why Gun-Control Fails Miserably

Netflix will let parents block individual movies and shows

Netflix announced today that it will soon be rolling out a new tool for parents. Already, parents can manage what their kids watch by putting all content above a particular maturity level behind a PIN or by marking which accounts belong to a child. But soon, parents will also be able to require a PIN for certain shows or movies. This way, parents won’t have to block full levels of content if they don’t want to and can instead just keep their children from watching certain titles. Additionally, maturity level ratings will also be displayed more noticeably on the screen when a new title begins playing.

Netflix’s changes come as a number of companies are working to make their platforms more child-appropriate. Apple plans to introduce more parental controls to its devices in the near future and YouTube recently had to deal with some disturbing content that was parading as kid-friendly. Gadgets geared towards children have also come under scrutiny as privacy concerns mount and Facebook’s new Messenger Kids app has attracted criticism for encouraging kids to spend more time on digital devices.

Netflix says its new controls will be rolling out in the coming months and that it’s also looking into how to make maturity level ratings more descriptive and easier to understand.

Via: VentureBeat

Source: Netflix

via Engadget
Netflix will let parents block individual movies and shows