RFC1925 – The 12 Truths.

(1) It Has To Work.

(2) No matter how hard you push and no matter what the priority,
you can't increase the speed of light.

(2a) (corollary). No matter how hard you try, you can't make a
baby in much less than 9 months. Trying to speed this up
*might* make it slower, but it won't make it happen any
quicker.

(3) With sufficient thrust, pigs fly just fine. However, this is
not necessarily a good idea. It is hard to be sure where they
are going to land, and it could be dangerous sitting under them
as they fly overhead.

(4) Some things in life can never be fully appreciated nor
understood unless experienced firsthand. Some things in
networking can never be fully understood by someone who neither
builds commercial networking equipment nor runs an operational
network.

(5) It is always possible to aglutenate multiple separate problems
into a single complex interdependent solution. In most cases
this is a bad idea.

(6) It is easier to move a problem around (for example, by moving
the problem to a different part of the overall network
architecture) than it is to solve it.

(6a) (corollary). It is always possible to add another level of
indirection.

(7) It is always something

(7a) (corollary). Good, Fast, Cheap: Pick any two (you can't
have all three).

(8) It is more complicated than you think.

(9) For all resources, whatever it is, you need more.

(9a) (corollary) Every networking problem always takes longer to
solve than it seems like it should.

(10) One size never fits all.

(11) Every old idea will be proposed again with a different name and
a different presentation, regardless of whether it works.

(11a) (corollary). See rule 6a.

(12) In protocol design, perfection has been reached not when there
is nothing left to add, but when there is nothing left to take
away.

https://tools.ietf.org/html/rfc1925

Javascript: Debugging Bitwise Operators

Most people are never going to even use bitwise ops, especially in JavaScript. But if you really must, beware all is not what it seems!

Problem 1's Complement
1's complement seems slightly off?!
console.log(~0xFF); //gives -256

Explanation
You might then automatically assume that JavaScript implementation of 1's complement is fundamental borked, a cursory Google might even back up that. Obviously its hard to believe that handling of bitwise ops are so broken in a language that is so widely used, but given that few if any web developers' would actually need bitwise ops maybe its the case. (There are plenty of stack overflow posts that recommend the abuse of the ~ operator)

Taking a closer look at the ECMA script definition you see the definition of NOT as the following[1]:

      Let expr be the result of evaluating UnaryExpression.
      Let oldValue be ToInt32(GetValue(expr)).
      Return the result of applying bitwise complement to oldValue. The result is a signed 32-bit integer.

Now this is where things get interesting. You would naturally assume if you give the NOT operator a 8-bit value you'd get an 8-bit field back, but this is clearly not the case. If you want to dig even further the real concrete instance of the value is a 64-bit IEEE 754 representation see [2].

So that neatly explains why ~0xff transforms to -256

1111 1111
becomes
0000 0000 0000 0000 0000 0000 1111 1111
apply ~ (NOT)
1111 1111 1111 1111 1111 1111 0000 0000
aka -256

But that still leaves a problem, how can you easily debug a value that isn't a Number but is represented as one...

If you've got this far there is probably a very good reason you're using bitwise ops, otherwise you might have given up on them altogether. So it would be somewhat handy to look at the real value, and not the Int32 representation, which console.log and friends are going to give a misleading value for.

Getting at the full representation
A nice simple function to show all the bits for the input value.

>>> Operator coerce the value input a 32-bit representation by right shifting and filling in with zeros, depending on your usage you can also slice the value, to only show the 8-bits that are needed to debug, like so:

General Rule
If dealing with bits, clamp the field to the proper bit length before assignment. Using an 8-Bit clamped array is no guarantee that the value will be assigned properly, there are cases where the value can be assigned to zero instead of the proper bit value. For an 8-bit you would use array[i] = bits&0xFF this will make sure the value is appropriately truncated and does not get evaluated as a Number.

[1] http://www.ecma-international.org/ecma-262/5.1/#sec-11.4.8
[2] http://www.ecma-international.org/ecma-262/5.1/#sec-4.3.19

First, that the significant portion of the UKs economic recovery that is dependent on consumers spending their PPI compensation has a bit longer to run.The total PPI payments by banks of approaching £20bn represents more than 1% of GDP: It is a proper economic stimulus.

via BBC News - Lloyds: Normal again.

The factory of the future will have only two employees, a man and a dog. The man will be there to feed the dog. The dog will be there to keep the man from touching the equipment. Warren G. Bennis

Weekend Project: HAB

More Info: geeksinspace.org.uk

The largest U.S. banks aren’t really profitable at all?

So what if we told you that, by our calculations, the largest U.S. banks aren’t really profitable at all? What if the billions of dollars they allegedly earn for their shareholders were almost entirely a gift from U.S. taxpayers?

via Why Should Taxpayers Give Big Banks $83 Billion a Year? - Bloomberg.

McCullin official UK trailer – in cinemas & Curzon on Demand from 1 January – YouTube

McCullin official UK trailer - in cinemas & Curzon on Demand from 1 January - YouTube.

Max Richter ‘Recomposed – The Four Seasons’

The Ebola virus can spread through the air from pigs to macaques, a new study suggests.

via Ebola may go airborne | Genes & Cells | Science News.

Googles’ New Product – Big Ass Remote…

This thing is huge The Official Google TV Blog: Google TV: Now faster and easier - With added Big Ass Remote.

I’m sorry, maybe I’m particularly stupid, but I haven’t understood how I get this software or this kit or whatever it is, this filter thingy that you click or whatever without buying a new computer and I don’t want to spend a thousand pounds just to have a filter. I just haven’t understood what I do, and you’ve been talking to us and I’ve been in this room for half an hour.

via Helen Goodman MP is “Particularly Stupid” by Terence Eden has a Blog.

BBC News - Facebook ads: £100,000 bill for government - good value?

It turns out that as of 19 July, the government had spent £98,418.25 with Facebook on advertising the Great campaign. A spokesman said the campaign had achieved 472 million ad impressions leading to 782,000 ad clicks - and across the 13 Facebook pages, 583,000 "likes" had been generated.

via BBC News - Facebook ads: £100,000 bill for government - good value?.

Christopher Balding on the real risk in China

In the past 5-8 years, and especially the past 3, China has built an enormous amount of stuff that nobody wants, needs, or uses.  Fueled by a lending boom that began in late 2008 and tripled total lending in 2009, Chinese government at all levels has been spending money like a drunken sailor on leave.  What should scare people however, is just how poorly this money has been spent.

via Christopher Balding on the real risk in China.

RBS/ULSTER – I smell a smelly fish.

Further, according to Reuters daily statements last week, RBS cash assets stood at £82bn, whereas net loans were recorded as £476bn.But this might be the clincher: total deposits came in at £476bn…exactly the same as loans. However, the difference between total assets and total liabilities was around £60bn in the bank’s favour. Given the amount of potential toxic write-off in the RBS group – and any ‘rush’ following a downgrade – it wouldn’t require much to change that positive into a disturbing negative. With total fluid assets standing at around £930bn, zero outgoings over five days of a ‘computer glitch’ would give the bank a £73bn windfall. More than enough to stave off a crisis, and at least temporarily restore creditor confidence, if such was needed. At the same time, of course, it physically barred the way to a run on the bank.

via RBS/ULSTER ‘GLITCH’: Slog survey of users plus analysis of the numbers raise further doubts. | A diary of deception and distortion.

Bailout Funds for Euro barely 45% of whats needed.

A confidential American management consultancy report commissioned by the Troika shows conclusively using maths of which the awake folks are already well aware that the upcoming bailout needs are miles beyond what the total ESM/IMF/ECB funds could ever be.To quote from this report, of which I have had sight:“At a total maximum going forward of €850bn euros, the fund is, even in terms of known commitments, under 45% of what would be required to ensure the viability of the eurozone….bailout costs in 2012 we estimate to be €2.04 trillion, and these will continue to rise as long as zero sovereign intervention policy applies.”

via EXCLUSIVE: Troika continues to use flaky bonds for Greek bailout, explosive US report explains why | A diary of deception and distortion.

« Older posts

© 2016 ./jack.sh

Theme by Anders NorenUp ↑