Wednesday, December 31, 2014

Digest for comp.lang.c++@googlegroups.com - 6 updates in 1 topic

Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Dec 31 12:24AM

On Tue, 30 Dec 2014 04:10:52 +0100
> > constrained in the Win32 environment.
 
> std::unique_ptr has been designed so that it can take the same size
> as a pointer by default, isn't this the case for Win32?
 
Has it? Every object of class type must have a size of at least one.
§20.7.1.2.4/7 of the C++11 standard suggests that an object of the
deleter's type is stored as a class member rather than constructed on
the fly when it is called (get_deleter() returns "a reference to the
stored deleter"). This means that a std::unique_ptr object has a size
comprising the size of a pointer + 1, assuming the deleter is a
functor class without data members, as would usually be the case (it
is also permitted by the standard be a function pointer, or more
correctly an lvalue reference to function, which would normally have a
larger size).
 
Of course, returning a reference to the deleter means that the standard
might as well have made it a public member, but that is a separate
issue.
 
Chris
legalize+jeeves@mail.xmission.com (Richard): Dec 31 12:28AM

[Please do not mail me a copy of your followup]
 
Lynn McGuire <lmc@winsim.com> spake the secret code
 
>We run out of Win32 space if we are not careful. Probably heap space
>since some of our datasets go over one GB. Things are better
>not though since we started compressing strings in memory.
 
Very large datasets are almost certainly going to be allocated on the
heap and yeah, 32-bit Windows programs have the weird 2 GB/4 GB
process space limitations that have haunted games for some time.
 
>> Why naked new and not std::unique_ptr<> or some sort of container?
 
>This code was written over a decade ago and works well. Never rewrite
>code that is working well just to use new coding features.
 
OK, but presumably for new code you are using std::unique_ptr?
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
The Terminals Wiki <http://terminals.classiccmp.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Dec 31 12:35AM

On Wed, 31 Dec 2014 00:24:35 +0000
 
> Of course, returning a reference to the deleter means that the
> standard might as well have made it a public member, but that is a
> separate issue.
 
Having said that, on testing I see that std::unique_ptr on my
implementation has the size of a pointer. On looking at the
implementation, instead of having separate pointer and deleter data
members, it has a tuple member comprising the pointer and the deleter,
so eliminating the need to give the deleter a size of 1 because tuples
are implemented by recursive inheritance. Quite clever.
 
Chris
"Öö Tiib" <ootiib@hot.ee>: Dec 30 07:04PM -0800

On Wednesday, December 31, 2014 1:10:18 AM UTC+2, Lynn McGuire wrote:
> > intriguing because writing naked 'new' and 'delete' in modern C++
> > adds complexities (and so defects) but does not save resources.
 
> So how would you implement this class without using new? Here is the class and constructor using a reference value:
 
I do not know the purpose of it. So I can't tell for sure what I would do.
Feels it has a lot of members so possibly I would consider splitting
it up or reducing members somehow. I will comment below:
 
> vector <int> * intArrayValue;
> vector <double> * doubleArrayValue;
> vector <string> * stringArrayValue;
 
Above part of it seems to be a variant. If it is so then instead I would
use some existing implementation of variant. For example boost::variant:
 
typedef boost::variant< nullptr_t,
int,
double,
std::string,
std::vector<int>,
std::vector<double>,
std::vector<std::string>
> ValueVariant;
ValueVariant variantValue;
 
Its copy-construction is default.

The 'datatype' can be changed to function '{return variantValue.which();}'.
The 'vectorFlag' can be changed to function '{return datatype() > 3;}''.
 
 
> unsigned char * compressedData;
> unsigned long compressedDataLength;
 
Why not vector instead of above? Like:
 
std::vector<unsigned char> compressedData;
 
Its copy-construction is default.
 
> vector <unsigned long> uncompressedStringLengths;
> std::string * uncompressedString;
 
Why above is pointer? I would replace it with just 'std::string':
 
std::string uncompressedString;
 
That would also copy by default. As are rest of the members.
 
 
> // constructor
> DesValue ();
> DesValue (const DesValue & rhs);
 
Above copy constructor could be just defaulted if to do like I suggested
above since compiler-generated is as good:
 
DesValue (const DesValue & rhs) = default;
 
> DesValue & operator = (const DesValue & rhs);
 
> // destructor
> virtual ~DesValue ();
 
Likely copy assignment and destructor and move constructor and move
assignment as well.
 
 
> virtual DesValue * clone () { return new DesValue ( * this); }
 
Yes, that has to remain if you need virtual clone with covariance
because there are no covariance between 'std::unique_ptr<base>' and
'std::unique_ptr<derived>'.
 
> ...
> }
 
Looks quite big snip:
 
woodbrian77@gmail.com: Dec 30 11:01PM -0800

On Tuesday, December 30, 2014 6:28:57 PM UTC-6, Richard wrote:
 
> >This code was written over a decade ago and works well. Never rewrite
> >code that is working well just to use new coding features.
 
> OK, but presumably for new code you are using std::unique_ptr?
 
Sometimes I use unique_ptr but other times new and delete
in new code. I think it's good to keep your options open.
 
Brian
Ebenezer Enterprises -
http://webEbenezer.net
 
 
Brian
Ebenezer Enterprises
"Öö Tiib" <ootiib@hot.ee>: Dec 30 11:40PM -0800

On Wednesday, December 31, 2014 2:35:58 AM UTC+2, Chris Vine wrote:
> members, it has a tuple member comprising the pointer and the deleter,
> so eliminating the need to give the deleter a size of 1 because tuples
> are implemented by recursive inheritance. Quite clever.
 
Yes, the deleter is like static member of class of 'unique_ptr'.
The 'shared_ptr'/'weak_ptr' family is kind of heavyweight but
since shared ownership is sort of rare optimization itself (lets
share instead of making copies) it does not matter much in practice.
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

Tuesday, December 30, 2014

Fw: Fwd: 轉寄: 龍 的 傳 人

 


On Monday, December 22, 2014 10:37 AM, Hsiao Hung <k6hsi@aol.com> wrote:





   
 
美國很糾結,不知道拿中國怎麼辦:
 
入侵中國吧,人那麽多,可能把你吞了;  不入侵中國吧,中國人就特別愛"和平"入侵你
 
有錢的沒錢的全來了,旅遊的,留學的,投資的,走迷路的,大娘,二奶,小三,大肚子懷孕的,全來了。
 
美國的航母頂多在離中國不遠的地方趴著;  而中國的和平大軍不一樣,一進美國就玩 "軍民魚水情",女人們跟打殲滅戰似的,就把美國男人給嫁了,不出幾年,新一代的美國公民全能用中文叫媽叫爸了
 
哪個民族架得住這樣同化呀!
 
美國人本來想用麥當勞、肯德基同化中國。可是,沒過幾年功夫, "肯德基" 就開始賣豆漿油條,到底誰在同化誰呀?
 
據初步統計,在美國的中餐館有執照的已有上百萬家,散佈在所有有人類喘氣的地方,比任何連鎖店都厲害。
 
美國成年人能獨立用兩根木棍兒吃飽飯的,已高達百分之八十;而且百分之二十五的美國人開始迷戀上啃雞爪子百分之五的美國人認為臭豆腐是香的
 
近日來美國出現槍殺案,不少中國人說:"白人開槍,黑人搶劫,老墨販毒,就中國人安分守法"
 
言外之意讓中國人接管美國,其餘各族人民打哪來的回哪兒去,退回原籍。好給中國人騰地兒
 
走進西部美國大學,學生一半以上是從中國來的教授也是從中國來的有時講著講著課就換中文了,讓美國學生在自己的國土有種 "亡國奴" 的感覺。
 
說真的,中國的語言實在不是人學的。上漢語的第一課,中 國 老師就告訴我們英語的"I"就是(的意思)
 
譯成中文有:"我,俺,奴輩,鄙人,卑職,晚輩,晚生,在下,老夫,老朽,老子,你大爺我"等等意思。美國人聽完當時就暈過去了,這才只是一個最簡單的""字呀。

中國人不但用文化,還用言傳身教來同化美國。
 
比如說,原來美國家庭主婦很少有買菜挑來挑去的好習慣,現在和中國女人學的,買扁豆時一根一根挑,還用大拇哥的指甲狠狠地掐一下,看看是不是逼得超市沒辦法,只好用兩種語言寫個牌子 "請勿掐! (No Pinching!)"
 
去美國大超市,只需掃一眼瓜果梨桃上面的手指印,就能立刻斷定:看,中國人剛剛來過只有中國人的手勁才能把番茄和茄子掐成那樣!
美國人一天天被同化著。
 
早晨,越來越多的美國人在練太極拳入夜,數學不好的美國人圍在一張桌子上玩最簡單的麻將。過生日的時候,美國人百分之百跑調兒地高唱卡拉OK;
 
掀開背心,很多人會自豪地讓你看他們紋在身上的中國字----我是聾的傳人!
 
在這種氛圍下,美國的西點軍校也開講孫子兵法了。開課十天,西點軍校就出現了階級鬥爭的苗頭。原本缺心眼的美國學員開始熟練使用 "落井下石,聲東擊西" 等傳統謀略。女學員為了得好分開始給教官施 "美人計,離間計"; 同性戀學員們互相施 "反間計和苦肉計" 等等。
 
中國人來了。
 
中國人如黃河之水,坐著飛機從天上下來,所向披靡地湧進美國。這時候,美國人才真正理解為什麼慈禧太后當年閉關鎖國不讓中國人出去,就是為了不給世界國家添亂啊!
 
 
 




 






Digest for comp.lang.c++@googlegroups.com - 9 updates in 4 topics

Luca Risolia <luca.risolia@linux-projects.org>: Dec 30 04:10AM +0100

Il 29/12/2014 18:37, Lynn McGuire ha scritto:
 
> We use new and delete a lot in our base classes since we are memory
> constrained in the Win32 environment.
 
std::unique_ptr has been designed so that it can take the same size as a
pointer by default, isn't this the case for Win32?
legalize+jeeves@mail.xmission.com (Richard): Dec 30 04:29AM

[Please do not mail me a copy of your followup]
 
Lynn McGuire <lmc@winsim.com> spake the secret code
 
>We use new and delete a lot in our base classes since we are memory
>constrained in the Win32 environment.
 
By "memory constrained" am I to infer you are talking about stack
space?
 
Why naked new and not std::unique_ptr<> or some sort of container?
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
The Terminals Wiki <http://terminals.classiccmp.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
Lynn McGuire <lmc@winsim.com>: Dec 30 03:32PM -0600

On 12/29/2014 10:29 PM, Richard wrote:
>> constrained in the Win32 environment.
 
> By "memory constrained" am I to infer you are talking about stack
> space?
 
We run out of Win32 space if we are not careful. Probably heap space since some of our datasets go over one GB. Things are better
not though since we started compressing strings in memory.
 
> Why naked new and not std::unique_ptr<> or some sort of container?
 
This code was written over a decade ago and works well. Never rewrite code that is working well just to use new coding features.
 
Lynn
"Öö Tiib" <ootiib@hot.ee>: Dec 30 02:13PM -0800

On Tuesday, December 30, 2014 11:32:33 PM UTC+2, Lynn McGuire wrote:
 
> > Why naked new and not std::unique_ptr<> or some sort of container?
 
> This code was written over a decade ago and works well. Never rewrite
> code that is working well just to use new coding features.
 
There is difference between writing:
"We used new and delete a lot in our base classes that we wrote over
decade ago."
Or:
"We use new and delete a lot in our base classes since we are memory
constrained in the Win32 environment."
 
First is common, lot of people did it over decade ago. Second is
intriguing because writing naked 'new' and 'delete' in modern C++
adds complexities (and so defects) but does not save resources.
woodbrian77@gmail.com: Dec 30 02:20PM -0800

On Tuesday, December 30, 2014 3:32:33 PM UTC-6, Lynn McGuire wrote:
> not though since we started compressing strings in memory.
 
> > Why naked new and not std::unique_ptr<> or some sort of container?
 
> This code was written over a decade ago and works well. Never rewrite code that is working well just to use new coding features.
 
I disagree with that advice, but in this case you might
be better off sticking with new and delete.
 
Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net
Lynn McGuire <lmc@winsim.com>: Dec 30 05:10PM -0600

On 12/30/2014 4:13 PM, 嘱 Tiib wrote:
 
> First is common, lot of people did it over decade ago. Second is
> intriguing because writing naked 'new' and 'delete' in modern C++
> adds complexities (and so defects) but does not save resources.
 
So how would you implement this class without using new? Here is the class and constructor using a reference value:
 
class DesValue : public ObjPtr
{
public:
 
int datatype; // Either #Int, #Real, or #String.
int vectorFlag; // Flag indicating value contains an Array.
int optionListName; // name of the optin list item
int * intValue; // Either nil, an Int, a Real, a String, or an Array thereof.
double * doubleValue;
string * stringValue;
vector <int> * intArrayValue;
vector <double> * doubleArrayValue;
vector <string> * stringArrayValue;
unsigned char * compressedData;
unsigned long compressedDataLength;
vector <unsigned long> uncompressedStringLengths;
std::string * uncompressedString;
int isTouched; // Flag indicating if value, stringValue, or units have been modified since this DesValue was created. Set to
true by setValue, setString, setUnits, and convertUnits.
int isSetFlag; // Flag indicating whether the contents of the DesValue is defined or undefined. If isSet is false, getValue
returns nil despite the contents of value, while getString and getUnits return the empty string despite the contents of stringValue
and units.
int unitsValue; // current string value index in $UnitsList (single or top)
int unitsValue2; // current string value index in $UnitsList (bottom)
string errorMessage; // message about last conversion of string to value
string unitsArgs; // a coded string of disallowed units
 
public:
 
// constructor
DesValue ();
DesValue (const DesValue & rhs);
DesValue & operator = (const DesValue & rhs);
 
// destructor
virtual ~DesValue ();
 
virtual DesValue * clone () { return new DesValue ( * this); }
...
}
 
DesValue::DesValue (const DesValue & rhs)
{
datatype = rhs.datatype;
vectorFlag = rhs.vectorFlag;
optionListName = rhs.optionListName;
if (rhs.intValue)
{
intValue = new int;
* intValue = * rhs.intValue;
}
else
intValue = NULL;
if (rhs.doubleValue)
{
doubleValue = new double;
* doubleValue = * rhs.doubleValue;
}
else
doubleValue = NULL;
if (rhs.stringValue)
{
try
{
stringValue = new string;
* stringValue = * rhs.stringValue;
}
catch (std::bad_alloc &ba)
{
char msg [1024];
sprintf_s (msg, sizeof (msg),
"A memory error has occurred that could not be handled.\n"
"Please try the operation again.\n\n"
"Message: %s\n"
"Size: %d bytes", ba.what (), rhs.stringValue -> size ());
alert (msg);
}
}
else
stringValue = NULL;
if (rhs.intArrayValue)
{
intArrayValue = new vector <int>;
* intArrayValue = * rhs.intArrayValue;
}
else
intArrayValue = NULL;
if (rhs.doubleArrayValue)
{
doubleArrayValue = new vector <double>;
* doubleArrayValue = * rhs.doubleArrayValue;
}
else
doubleArrayValue = NULL;
if (rhs.stringArrayValue)
{
stringArrayValue = new vector <string>;
* stringArrayValue = * rhs.stringArrayValue;
}
else
stringArrayValue = NULL;
 
if (rhs.compressedData && rhs.compressedDataLength)
{
unsigned long num = rhs.uncompressedStringLengths.size ();
if (vectorFlag && num)
{
// if a vector of strings, copy the uncompressed string lengths
uncompressedStringLengths.resize (num);
 
for (unsigned long i = 0; i < num; i++)
uncompressedStringLengths [i] = rhs.uncompressedStringLengths [i];
}
 
// copy the size of the compressed data
compressedDataLength = rhs.compressedDataLength;
 
// allocate and copy the compressed data
compressedData = (unsigned char *) malloc (rhs.compressedDataLength);
if ( ! compressedData)
alert ("DesValue::DesValue (const DesValue &) - unable to malloc " +
asString (rhs.compressedDataLength) + " bytes");
memcpy_s (compressedData, rhs.compressedDataLength,
rhs.compressedData, rhs.compressedDataLength);
}
else
{
compressedData = NULL;
compressedDataLength = 0;
uncompressedStringLengths.resize (0);
}
 
if (rhs.uncompressedString)
{
uncompressedString = new std::string;
* uncompressedString = * rhs.uncompressedString;
}
else
uncompressedString = NULL;
 
isTouched = rhs.isTouched;
isSetFlag = rhs.isSetFlag;
unitsValue = rhs.unitsValue;
unitsValue2 = rhs.unitsValue2;
errorMessage = rhs.errorMessage;
unitsArgs = rhs.unitsArgs;
}
 
Lynn
"Tobias Müller" <troplin@bluewin.ch>: Dec 30 05:52PM

> I am not against using threads. I was arguing against generic claim of
> Leigh that multithreading is superior solution than multiprocessing.
> Neither is generally superior. Each has usages.
 
That must be a typo. Certainly you meant SAusages.
 
> [...]
 
Tobi
Jack Chuge <zhuge.jack@gmail.com>: Dec 30 11:07PM +0800

Richard 於 2014-11-12 5:12 寫道:
> ahead of time and have them work a solution on their own time at their
> own pace.
 
> Even better than that is to pair program with them for a day.
 
Great points
 
--
Jack
Jack Chuge <zhuge.jack@gmail.com>: Dec 30 10:55PM +0800

BV BV 於 2014-11-14 22:05 寫道:
> Woman's dress in Islam
> According to religion of Islam woman should only display her face and palms of hands in front of foreigner men (indoor and outdoor) and more than that is prohibited.
> Allah Almighty tells prophet Mohamed peace be upon him to order women to do the following: (And tell the believing women to lower their gaze (from looking at forbidden things), and protect their private parts (from illegal sexual acts) and not to show off their adornment except only that which is apparent (like both eyes for necessity to see the way, or outer palms of hands or one eye or dress like veil, gloves, head-cover, apron, etc.), and to draw their veils all over Juyûbihinna (i.e. their bodies, faces, necks and bosoms) and not to reveal their adornment except to their husbands, or their fathers, or their husband's fathers, or their sons, or their husband's sons, or their brothers or their brother's sons, or their sister's sons, or their (Muslim) women (i.e. their sisters in Islâm), or the (female) slaves whom their right hands possess, or old male servants who lack vigour, or small children who have no sense of feminine sex. And let them not stamp their feet so as to reve
al what they hide of their adornment. And all of you beg Allâh to forgive you all, O believers, that you may be successful.){ Sûrat An-Nûr - The Light -verse31}.
> * http://www.boston.com/news/nation/washington/articles/2008/07/11/skin_cancer_on_rise_in_young_women/
> * http://www.medicalnewstoday.com/articles/44764.php
 
> Thank you
 
It's a polite way to lower gaze from both men and women
 
--
Jack
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

Fwd: 30 Pilots And Flight Attendants Confess The Best Kept Secrets You Don't Know About Flying



Sent from my iPad

Begin forwarded message:

From: Sharon K <sharon62kahn@gmail.com>
Date: December 30, 2014 at 8:09:51 AM CST
To: undisclosed-recipients:;
Subject: Fwd: 30 Pilots And Flight Attendants Confess The Best Kept Secrets You Don't Know About Flying


30 Pilots And Flight Attendants Confess The Best Kept Secrets You Don't Know About Flying

Believe them or not!

The following question was posed on Reddit:
Flight Attendants, pilots, or engineers, what are some secrets that passengers don't know when you ride on planes?
Many answers were submitted, and here are 30 of the most interesting ones. Note: Reading some of these responses may make you think twice about flying… you have been warned!

1. The true story behind those oxygen masks.


That if the oxygen masks drop down, you only have about 15 minutes of oxygen from the point of pulling them down. However, that is more than enough time for the pilot to take us to a lower altitude where you can breathe normally.

More important – at altitude, you have 15-20 seconds before you pass out. Put yours on first, then do your kids. Passing out for a few seconds won't harm the kids.

2. The water in the lavatories is very dirty too.

Whatever you do, do not drink the water in the lav. It is bad enough to "wash" your hands in it. We sanitize the water tank at selected maintenance intervals, however parasites build tolerances to these cleaners.
Check the outside of the aircraft when walking in. If the paint is crappy shape, the plane is in crappy shape. Skydrol (hydraulic fluid) is a nasty fluid and will dissolve everything. So if the paint is missing, it's probably from a skydrol leak. No one wants a hydraulic leak at 35,000 ft in the air. As you can't just pull over and top the reservoir off.

3. The REAL reason the lights on the airplane dim when landing.

When a plane is landing at night, they dim the interior lights in case you need to evacuate upon landing… your eyes are already adjusted to the darkness so you'll be able to see better once outside the plane.

4. Lightning and the power of a pilot.


My dad's been an airline pilot for almost 20 years, and apparently planes get struck by lightning all the time. Also if a passenger is causing a scene in the jetway he can refuse to let them on and take off without them.
The captain has almost limitless authority when the doors are closed. He is allowed to arrest people, write fines and even take the will of a dying passenger

5. Those lavatories unlock from the outside.


You are able to unlock airplane lavatories from the outside. There is usually a lock mechanism concealed behind the no smoking badge on the door. Just lift the flap up and slide the bolt to unlock.

6. A true story of a bomb threat.

I have a friend who's a commercial pilot. Around five years ago he was doing a flight from LA to Tokyo when an anonymous caller phoned in a bomb threat while they were over the middle of the Pacific. Apparently they have procedures for this kind of thing, but there was nothing anyone could do in this situation except stay calm and not alert the passengers (obviously). He said for the rest of the flight every bump of turbulence made his adrenaline spike. They took this case especially seriously because there was a group of foreign dignitaries sitting in the first class cabin.

7. Regarding food on the plane.

My dad works for a large airline, he told me a few little things

2 pilots are served different meals and cannot share, this is done in case of food poisoning.
Stealing food, even if they are going to throw it out can get you fired instantly. You can ask your supervisor, but you cannot take food. They don't want people messing with it.

8. The truth about flying with pets.

I am an aircraft fueler.
One thing I cannot stress enough is how your pets are treated. While your airline will take the best possible actions, some things cannot be avoided, like the noise on the ramp. I cannot stand out there without ear protection, and imagine your pet sitting out there on the ramp waiting to be loaded onto the plane being exposed to the same amount of noise I am.

Please people, think twice before flying your pets.

9. What flight attendants really do after telling the plane to turn off their electronics.

My sister is a flight attendant, she says after she tells everyone to turn off all electronics, she goes to the back and pulls out her phone and starts texting.

10. A trick for making more space for yourself.


Arm rests – aisle and window seat: Run your hand along the underside of the armrest, just shy of the joint you'll feel a button. Push it, and it will lift up. Adds a ton of room to the window seat and makes getting out of the aisle a helluva lot easier.

11. Don't drink water on a plane that didn't come from a bottle.
Former Lufthansa cargo agent here.
Do not EVER drink water on an aircraft that did not come from a bottle. Don't even TOUCH IT. The reason being the ports to purge lavatory shit and refill the aircraft with potable water are within feet from each other and sometimes serviced all at once by the same guy. Not always, but if you're not on the ramp watching, you'll never know.

12. On the importance of locking your bags.

Lock your bags, carry-on bags included.
Look online or in a travel store for TSA-approved locks. The TSA has keys to open those locks in case they need to further inspect them (and hopefully not steal from them). And most people don't think to lock their carry-on, but especially now with load factors very high, more and more people are having to gate check bags. Once you drop your bag at the end of the jetway for gate-checking, anyone from a fellow passenger, to a gate agent, to a ramp agent has access to your bag.

13. How a pilot approaches landing.

When you experience a hard landing in bad weather it wasn't because of a lack of pilot skills but it is in fact intentional. If the runway is covered in water the airplane has to touch down hard in order to puncture the water layer and prevent aqua planing.

"Landings are nothing more than controlled crashes." Pilot friend quote.

14. Tipping could go a long way.

My girlfriend is a flight attendant. NO ONE tips flight attendants. If you give your FA a fiver with your first drink you'll probably drink for free the rest of the flight.

15. Pilots are sleeping most of the time.

1/2 of pilots sleep while flying and 1/3 of the time they wake up to find their partner asleep.

16. Just because you're flying with a big airline, doesn't mean the pilots are experienced.

Regional airline pilot here. You may have bought a ticket on Delta, United, or American, but chances are you'll be flying on a subcontractor. That means the pilots have a fraction of the experience, training, and pay of the big mainline carrier. Also, I don't get paid enough to care if you make your connection. Most of the time we fly slower than normal to make more money. The only time we fly fast is if ATC tells us to or if it's the go home leg.

17. The truth behind turning off electronics.

Pilot here. Having to turn off electronics on a plane is totally useless.
Mobile electronic devices won't really bring an airplane down but they can be really annoying to pilots. Just imagine sitting in the flightdeck descending to your destination and hearing the interference of a 100+ cellphones picking up a signal. I have missed a clearance or 2 that way.

18. Sky Mall is one big rip-off.

Secret: All of the stuff in Sky Mall can be purchased on the internet for much less money.

19. How your checked bags are really treated.
If it says "fragile," it's getting thrown harder. If it's says this side up, it's going to be upside down. We have to fit freight and 100+ bags in a cargo pit. It has to fit how it's going to fit…I will tell you that when we see "I heart baggage handlers" bag tags…We take special care of your shit.

20. A flight attendant reveals just how dirty everything truly is.

I worked for Southwest as a flight attendant. Those blankets and pillows? Yeah, those just get refolded and stuffed back in the bins between flights. Only fresh ones I ever saw were on an originating first flight in the morning in a provisioning city. Also, if you have ever spread your peanuts on your tray and eaten, or really just touched your tray at all, you have more than likely ingested baby poo. I saw more dirty diapers laid out on those trays than food. And those trays, yeah, never saw them cleaned or sanitized once.

21. A loophole so you never have to pay baggage fees.

You can almost always gate check baggage (unless it's abnormally large) take two large carry-ons and ask then to gate check one. It's free and I never pay fees.

22. Most flights are also carrying human organs.

The majority of domestic flights have human remains or organs on them. I work below wing as a baggage handler. Watch out the window for long boxes that say, "Head" at one end… Oh, and I can fit 150 bags in bin 3 of a Boeing 737-300.

23. Airports haven't covered all of their security bases yet.

There are actually legitimate security loopholes that, if widely known, would let average citizens get right next to airliners, runways, and taxiways. Like any system, if you know how it works, you know where the cracks are.

24. Planes without engines can still glide for a really long time.

A pilot told me if both engines fail, a plane can glide 6 nautical miles for every 5000 feet. So at 35,000 feet, a plane can glide about 42 miles without power. Its why most accidents happen landing or taking off.

25. The drinking water used for coffee and tea is FILTHY.

The drinking water, that used for making coffee, tea, etc., should NEVER be consumed. The holding tanks in these sometimes 60 year old planes are never cleaned. They have accumulated so much greenish grime on the walls that in some places it can be inches thick.

This one is very known by all airline employees.

27. Why it's always easier to just take the batteries out.

Women: if you pack a toy in your bag, take the batteries out. Because if I'm loading your bag, and I hear it vibrating I have to tell my lead. Then my lead has to come pull you off the aircraft and you have to open your bag and turn off your toy in front of a bunch of giggling grown ass men.

27. Planes have a hard time flying on hot days.

I worked the ramp in Phoenix. On especially hot days, we had to offload cargo because planes struggled to take off in the thin air.

28. Even the headphones that come wrapped up aren't new.

I used to work for warehouse that supplied a certain airline with items. The headsets that are given to you are not new, despite being wrapped up. They are taken off the flight, "cleaned", and then packaged again.

29. How to tell from the ground if a plane is being hijacked.

If the plane is being hijacked when the pilot lands they will leave the wing flaps up that slow the plane down, this is to signal the airport that there is something happening in the plane.

30. The real reason there are still ashtrays in the lavatories.

Here's one: ashtrays in the lavatories are mandatory equipment even though the FAA banned smoking on flights years ago. The reasoning is that if people do decide to smoke, they want them to have a place other than the trash can to throw the butt.