How to Swap two numbers without temp variable in Java - <AUTHOR> http://javarevisited.blogspot.com.br/2013/02/swap-two-numbers-without-third-temp-variable-java-program-example-tutorial.html

<comment><USER3> There are many ways to swap two variables without using a temp variable, as long as the type of the variables is a mathematical group[0].

If the group operation is denoted <>, with identity e, and the inverse of 'a' is 'inv(a)' then you would do

        a = a0;
        b = b0;            // initial assignment

        a = a <> b;        // a = a0 <> b0 and b = b0.
        b = a <> inv(b);   // a = a0 <> b0 and b = a0 <> b0 <> inv(b0) = a0.
        a = inv(b) <> a;   // a = inv(a0) <> a0 <> b0 = b0 and b = a0.

This works when a and b are ints, which are a group with the operator '+' and identity '0', and inverses inv(n) = -n (see [1])

It works when a and b are _nonzero_ floats, which are a group under multiplication with identity 1.0 and inverses inv(x) = 1/x (but see [2]).

It works when a and b have fixed-length binary representations, because fixed- length binary strings are a group where the operation is xor (or '^') and inv(x) = x.

It works when a and b are matrices of the same dimension, which form a group in two different ways - under matrix addition, where the inverse is elementwise negation, and under matrix multiplication (if a and b are nonsingular) where the inverse is the regular matrix inverse [3].

Note that in my third line, the right-hand side of the assignment is inv(b) <> a, whereas all the examples in the blog post used a <> inv(b). They were implicitly assuming a commutative group (i.e. a <> b == b <> a for all a and b) whereas my procedure works even for non-commutative groups, e.g. matrices under matrix multiplication.

 _Edit_ : Obviously, if you actually use this in real code... WAT.

[0] <http://en.wikipedia.org/wiki/Group_(mathematics)>

[1] this even works if one of the operations causes an integer overflow - <USER2> magic of modular arithmetic!

[2] floats don't really form a group, because of non-associativity of floating point multiplication.

[3] <http://en.wikipedia.org/wiki/Invertible_matrix>

<comment><USER4> Actually, isn't having unique inverses a weaker requirement than being a group? Maybe I am wrong...

<comment><USER3> There are algebraic objects for which inverses are defined, but which aren't groups: namely groupoids, quasigroups and loops.

In groupoids the binary operation isn't total, i.e. there can be pairs (a,b) for which a <> b is not defined -- so we can't use groupoids.

In quasigroups and loops the binary operation doesn't need to be associative. But we require associativity, so that we can deduce

        (a <> b) <> inv b == a <> (b <> inv b) == a <> e == a

So we do actually need all the properties of a group.

<comment><USER3> A commenter on Reddit pointed out that quasigroups require both left and right division operators \ and /, and that even though they are not associative, the axioms

        x \ (x * y) = y
        x * (x \ y) = y
        (x * y) / y = x
        (x / y) * y = x

must hold -- so in fact, quasigroups are good enough!

</comment></comment></comment></comment><comment><USER5> While these are neat for things like a programmer's interview question I would be very careful about actually using these in real code, for two reasons:

1\. It obfuscates the code for very little benefit. Readability suffers more than performance gains.

The JVM could employ similar tricks under the covers for performance reasons if it detects that this is on the hot path.

2\. The code is sensitive to overflow, sign handling, Not-a-Number, and divide-by-zero.

Both these points should be raised by an experienced programmer.

<comment><USER6> Actually, it's worse than that.

In both Java and C/C++, doing this kind of thing actually makes code slower. It only makes sense in assembler.

When the compiler can deduce that two variables already in registers have swapped value, it simply relabels the registers, making swap a 0-cost operation. Obviously if are swapping two memory locations, you have to read, but a temporary optimises to:

mem1 -> reg1 mem2 -> reg2 reg1 -> mem2 reg2 -> mem1

While a swap trick, if the compiler can't backward-enginner it out has to add a bit of xoring (or adding).

gcc actually has an optimisation pass with the specific job of trying to take out this trick. Unfortunately, it can't always work because if you try using these tricks on two pointers to the same memory location, you end up zeroing out the value rather than doing nothing (which a proper temporary would).

<comment><USER7> To add one more evil edge case - if you're using something like libgc in your project and try swapping pointers that way, there's a chance you're going to lose your memory by accident.

</comment></comment></comment><comment><USER8> It's "cute", I'll give you that. But what possible use could this have? Using a temp variable is MORE likely to be optimized by the compiler[1] and is FAR easier for someone reading the code to understand. Using it in an interview falls into the trap of asking useless and irrelevant questions that weed out perfectly good candidates. All in all, it's a bad idea.

[1] - I don't actually know this... but I suspect that it's true.

<comment><USER9> Not to mention this approach has issues with overflow.

<comment><USER10> The first two methods don't.

<comment><USER9> ah yep, you are correct.

</comment></comment></comment></comment><comment><USER11> If I wanted to find somebody who understood bitwise operations _maybe_ useful.

If I'm looking to find a developer who can write maintainable line of business software, which Java is a common fit for then I'd be aghast if this was proposed as a sensible, maintainable solution.

This trick just reminds me of a long list of things that people ask for at interview, which has no demonstrable link to the job at hand. Why not ask for someone to memorise a complex api? Or understand a workaround for a long standing "won't fix" framework.

Pointless. Useless.

<comment><USER12> Seeing it since recently more often in Blogs, I see increased readability. After all, you just need to remember 3x XOR (a-b-a).

I find the swap solution w/ temp solution to be more painful for my eyes. It's also 3 lines, but less homogenous.

</comment></comment><comment><USER13> Cool trick. If I ever see this in your real-world production code, you're fired.

</comment><comment><USER14> The really nasty edge case is aliasing. Say you're swapping a[i] with a[j]. What happens when i==j? Nope, not what any sane person expects a swap operation to do in this case...

This nasty trick was actually used in one of the Underhanded C Contest entries in 2007.

</comment><comment><USER15> My solution ended up like this:

a = b + (b = a) - a;

<comment><USER16> In Java, it seems to work, but in C (gcc 4.6.3) it doesn't. a ends up unchanged, since the first instance of b contains the original value of a when evaluated. Not sure why Java evaluates it the way it does.

<comment><USER17> That's because java is much stricter about enforcing the order of evaluation in these kinds of aliased statements, whereas in C it's undefined and the compiler just "does something". Of course, you'd have to be a real code- masochist to do this to yourself even in java...

</comment></comment></comment><comment><USER18> Sane programming languages have multiple assignment ie a, b = b, a or some other syntax.

</comment><comment><USER19> You guys need to read the book "hackers delight" full of really great stuff like this ISBN-13: 978-0-321-84268-8 ISBN-10: 0-321-84268-5

</comment><comment><USER20> This is a very old trick. According to Knuth, it goes back to at least 1961, where it was found in IBM programming course notes in a more general form that includes a mask:

x ← x ⊕ y, y ← y ⊕ (x & m), x ← x ⊕ y

The mask determines the subset of bits that get swapped.

</comment><comment><USER21> Funny this should be on the front page the same day that there is stuff about interview "puzzles"

1) This is not really a programming questing. It is a logic or math or algorithm question.

2) Please tell me a real-world programming situation where this would be required.

</comment><comment><USER22> I guess the third approach breaks if one of the two numbers is 0

<comment><USER6> Or if an overflow occurs (while methods 1 and 2 work fine even with overflow, in Java at least as overflow semantics are well defined).

</comment></comment><comment><USER4> two things i'd want to add. firstly the arithmetic with +/- fails when over/underflow occurs. secondly xor works because it is its own inverse. the more generic answer is using any operator that forms a group over the potential values to be swapped... as another comment explains

i remember feeling fantastically clever when i rediscovered this about 15 years ago. it has been of nearly zero value to me since.

<comment><USER23> +/- doesn't fail in a language where + is addition modulo n.

<comment><USER4> true, but lots of things work in special cases.

</comment></comment></comment><comment><USER24> Simple yet difficult to conjure. This is awesome!

<comment><USER25> What makes it awesome? It seems like a way to take something simple (swapping variables) and write it in a complex way (three operations) so that neither the humans nor the compilers reading it will know what is going on.

Real temporary variables are clearer for both humans and machines.

<comment><USER23> Read crntaylor's explanation of this via group theory: <https://news.ycombinator.com/item?id=5278915>

So this is awesome insofar as you find things like group theory awesome (I did). But like he says, if you find this awesome to use in production code, that's a horse of another color.

</comment></comment></comment><comment><USER26> This would be a great question for rejecting an otherwise qualified job candidate ...

<comment><USER27> Yea it's very simple but in an interview environment I probably would have over thought this. (I guess that's the point though)

</comment></comment><comment><USER28> My initial reaction to the question was simply assign the value of one variable as the name of the other. Does that count?

        a = a0
        a0 = b0 // initial assignments
        a = b0
        a0 = a0 // swapped</comment>


Streaming with RaftLib - <AUTHOR> https://medium.com/@JonathanBeard/streaming-with-raftlib-alpha-d33684ea7d68#.564tjt96s <comment><USER2> holy crap, thats a lot of code. is this guy just memcpy'ing data around though?

<comment><USER3> Nope, not a lot of memcpy....mostly zero copy, in-place allocation, etc.. It's now a pet project so the code base is steadily expanding, it's actually a bit in flux (code, not the API) since I'm porting to Windows as well, so please excuse the mess. Feel free to use it, seems most of the users interested so far want it for search, or OpenCV. I'm kindof shocked there are as many people using it as there are since I've yet to add back in the multi-node support (I'm building in container support for remote node exec, and re-writing undergrad produced research code).

</comment></comment><comment><USER4> Seems interesting

<comment><USER3> Thnx, what part?</comment></comment>


Show HN: A new A.I. Algorithm for Polygonal Mesh Mazes - <AUTHOR> http://petercottle.com/liquidGraph/yc.html?demo <comment><AUTHOR> If you guys are interested, the source is available here:

<https://github.com/pcottle/LiquidGraph>

Along with the emotional roller-coaster of commit messages. The source is pretty well commented and filled with ASCII diagrams so I tried to make it digestible.

The actual AI algorithm is a standard uniform cost search, but the state exploration function is where the new work is found. I sent out different gravity transitions from each concave vertex to find where you can get to from each state. All the paths you see are parametric equations as well, so there's no error-prone Euler integration used!

Edit: Also, the class lecture videos from this semester are here:

[http://itunes.apple.com/us/itunes-u/computer- science-188-001...](http://itunes.apple.com/us/itunes-u/computer- science-188-001-spring/id496298636?ls=1)

if you would like an introduction to AI. It's a great class, I highly recommend it!

<comment><USER2> Did you apply to YC? (<http://github.com/pcottle/LiquidGraph/commit/8cf735f9a5>)

<comment><USER3> That's the page he linked to for this demo.

</comment></comment></comment><comment><USER4> This is awesome! I took a class in motion planning and we did similar things... have you heard of kinodynamic planning? (probabilistic roadmaps)... it is a cool technique if you want to do multiple queries.

<comment><AUTHOR> Thanks, I'm glad Standford and Berkeley students can find something in common (haha)

I haven't heard of kinodynamic planning, I'll definitely look into that! I've done some basic particle filtering and inverse kinematics, but it seems that this might be exactly what we are looking for in terms of future work. Thanks again

</comment></comment><comment><USER5> "Oh no! This application uses -webkit-transform to animate the final solutions, which your browser doesn't seem to support. Everything will still work, but during the solution animation, you'll have to look at the gravity arrow in the corner that I coded just for you instead of having the part rotate in an intuitive manner."

Why not also use -moz-transform? Is there anything lacking from -moz-transform that would make it not work?

<comment><AUTHOR> Sorry about that! It should be patched now.

Originally I was developing this on an old beat-up computer in my research lab (grad student life), so even an updated FF couldn't handle rotate3d. It seems to be working on my home computer though. Thanks for pointing that out! I try to not be browser-elitist.

<comment><USER6> You could also add -ms-transform, since that works as well in IE9+.

</comment></comment></comment><comment><USER7> I had fun foiling it. Here's my best (12 vertices) maze with "no solution found",

<https://gist.github.com/2503989>

<comment><AUTHOR> Hahah very good! It would be hard to drain that piece by hand without some very quick turns.

Future work in the algorithm is going to look at rotating the piece at any arbitrary point in time (to any arbitrary angle). At first this seems like a combinatorial explosion of the search space but we have some ideas on how to make it manageable. so maybe one day that part can be drained as well!

</comment></comment><comment><USER8> Doesn't work in IE 9 :/ can't even see anything but some small lines and hidden text in IE 9

<comment><AUTHOR> Sorry about that, it's currently just academic research right now so I wasn't able to get time to add IE support. I actually had to argue pretty aggressively just to implement it in javascript; most research papers get implemented in C and are sent off into the abyss of binaries

<comment><USER8> It works in other multi-operating system browsers (at least it works in Firefox on Windows), so that's good enough for most people :) I'm jut surprised it didn't show ~anything~ in IE, except the aforementioned barely- anything

</comment></comment></comment><comment><USER9> "Oh no! This application uses -webkit-transform to animate the final solutions, which your browser doesn't seem to support."

Web standards are so great that everyone has their own.

</comment><comment><USER10> I like editing the track while the solution is running.

<comment><AUTHOR> There are no gaurantees if you inject polygons during the search space exploration :D it might find a solution but the animation will be off.

Another fun thing is to watch it find the worst acyclic solution... it's pretty entertaining to see how roundabout the path can be:

petercottle.com/liquidGraph/worst.html?demo</comment></comment>


JsDelivr – The advanced open source public CDN - <AUTHOR> https://hacks.mozilla.org/2014/03/jsdelivr-the-advanced-open-source-public-cdn/ <comment><USER2> When you include 3rd-party hosted content in your program, you give those 3rd- parties:

       1. Access to your users' browser details (via request headers).
       2. Access to your users' habits (via the referrer header).
       3. The ability to replace executable code. (This code can be used to gather more data from the state of the web page (e.g. keystroke logging), or break out of the browser sandbox and compromise the whole system. Note: this only applies to JavaScript.)
       4. The ability to break your software, either intentionally or unintentionally, by not serving the resource at all.

When you host and serve your own resources, these are non-issues.

I think there is a sense among good-hearted programmers that "But gosh, they wouldn't do [1-3]! These CDNs are just a really nice public service by companies that care about keeping the web community healthy and fast. And besides, if they ever abused their access to user data, there would be hell to pay!"

Unfortunately this blasé attitude about user privacy on the part of programmers is why we have such a rough time with privacy in general these days. I believe that if you're a programmer with any interest at all in protecting your users from bad actors, that you'll do your best to avoid using 3rd party hosts, _especially_ for executable code.

<comment><USER3> Thank you thank you thank you.

What's worse is when you see sites running JavaScript from multiple analytics companies, social media companies, and CDNs - even on pages that should be private (login forms, personal details, etc.). It's even worse when those sites break without those scripts. This is a concern that far too many developers overlook. I made this (harsh) comment [0] on such a site posted to HN a few months ago.

CDNs are way overrated, from what I've seen. I think, for most use cases, you're better off avoiding the multiple HTTP requests and just compressing all your JavaScript into a single file. Serve that from your own server and you'll save the client from another domain name resolution too.

Do yourself a favor and install NoScript. For one thing, it will show you how easily Google can (or, could have) track your internet usage - and, as you pointed out, so much more. In my experience, about 50% of sites serve scripts from some Google domain.

[0]: [https://news.ycombinator.com/item?id=7187593](https://news.ycombinator.com/item?id=7187593)

<comment><USER2> You're welcome! And I agree that the upsides of CDNs are overrated - but in fairness they do have the benefit of being very easy to use, high performance, and ease the bandwidth costs of applications. The geographical proximity thing is a nice feature, and expensive to reproduce. Of course, even these upsides come with their own downside: front-end developers have gotten into the habit of including every lib under the sun. Heck, it's just a script tag! This makes the page heavier, which makes the CDN even more indispensable, and it leads to a downward spiral of browser-hosted bloat-ware that _requires_ a CDN to load in a reasonable amount of time. This is, of course, a win for the CDN sponsoring companies.

What's remarkable to me is how ubiquitous and unquestioned the use of CDNs has become.

BTW NoScript/Ghostery don't address the CDN issue. They don't actually block CDNs, they just block _explicit_ trackers (mainly in the forms of iframes and scripts linked to known-bad hosts).

<comment><USER3> NoScript is configured by default to only allow scripts and "active content" to run from domains you allow. You can temporarily allow certain domains, or permanently allow them. So yes, it does address the CDN issue. If someone includes a script from apis.google.com, that script won't run until I permit content from that domain to run (and I only ever do that temporarily, and only if the site needs it). Likewise for any other domain: CDN, analytics, whatever.

I don't know much about Ghostery - NoScript addresses most of my privacy concerns around web browsing.

</comment></comment></comment></comment><comment><USER4> So this is something I wrote last week relating how I've come to believe that it's really not appropriate to rely on vendor code on public CDN's for anything more complex than a JSFiddle.

[http://daemon.co.za/2014/03/from-trenches-js-cdn-point-of- fa...](http://daemon.co.za/2014/03/from-trenches-js-cdn-point-of-failure)

Basically, if you need to include something like jquery, you have to have code that makes use of it. Since by definition, you can't serve that code from a public cdn, you are going to need to serve those static assets somehow.

I now believe that you should serve the vendor code from the same 'place' as you serve your application's static assets, because by relying on external resources, you are adding more moving parts that all have to be in perfect working order for your app to actually be able to run.

This doesn't really have anything to do with how reliable the CDN itself is, but rather with how reliable the client's connection is.

I did read the jsdelivr post, and it actually looks like a really well thought out system. I just don't think I will use something like this for anything where I have the choice not to.

IMO, the possible benefits of using a public CDN, don't outweigh the fragility that gets added. It just feels like it is trying to optimize best case performance while worst case is far more important.

I'm not against CDN's as a concept though, I just think you should serve all the code that is needed for normal operation from the same one.

<comment><USER5> I think your statement is a bit extreme. While relying exclusively on a cdn to serve your static assets is risky, doing it using require.js with a local fallback works very well. You still benefit from cdn caching, while preventing your assets to become unavailable (even in China).

<comment><USER6> Really? Have you ever sat through the experience of waiting for the primary source to time out so that the fallback can kick in?

<comment><USER5> Ultimately, the timeout issue will be problematic for countries forbidding the access to cdns servers (ie China for example).

For the rest of the users, there are three cases:

\- the user has accessed the application in the past (or any other webpage that uses the cdn): a cached version of the library is served by her browser. \- the user has never accessed the page, the cdn is unavailable:

* either the Internet connection has failed, and our application won't be available anyway * the cdn is indeed down, the user has to wait for the timeout before her browser fetches the local fallback.

The third case sounds extremely rare (look at the statistics of major cdns out there, they often have better uptime and response time than your own servers). And the advantages provided by the first case do more than compensate in my opinion.

</comment></comment></comment></comment><comment><USER7> Can I work for mozilla? I feel like they're only one of the few organizations that are doing cool things for the common good. Keep it up!

<comment><USER8> They may be, but JsDelivr appears to have no deep affiliation with Mozilla:

> Who is behind jsDelivr?

> Basically just me, Dmitriy A. or @jimaek. But a lot of other people are > involved, giving their advice and helping me out. I always refer to jsDelivr > in the plural sense because of this.

It is sponsored, amongst others, by CloudFlare and MaxCDN, where @jimaek is also employed. But the only connection to Mozilla seems to be that it's featured on the Mozilla Hacks blog.

</comment></comment><comment><USER9> I dont understand how this is paid for -- can someone explain?

<comment><USER10> > _I should also point out that MaxCDN, CloudFlare, Cedexis and the rest of > the companies sponsor jsDelivr for free._

Personally, I don't trust such services any more than I trust cloud hosting, which means not at all. I have no way to make sure that they server these files unmodified, that they aren't neglecting their servers to the point where they're hacked and serve malware to my users etc. ...

<comment><USER11> I would be happy to address these issues. You have no reason to believe me but all custom servers are secured and are regularly updated.

For CloudFlare and MaxCDN I have 2-Step authentication enabled + for MaxCDN 1 allowed whitelisted IP address.

Regarding unmodified files I guess we can build an app to monitor them? If you want drop by [https://github.com/jsdelivr/jsdelivr](https://github.com/jsdelivr/jsdelivr) and we can discuss this even further.

I would be happy to do anything possible to ease your concerns regarding security.

<comment><USER12> Do you have any sort of agreement that they will serve these files bit for bit unmodified?

I had a problem with cloudflare inserting some tracking cookies into my static HTML files. They claimed it was ddos protection. To me (and the EU cookie directive) it looked no different from the garbage other analytics sites use.

If jsdelivr providers are allowed to modify the files they serve, I won't use it. Got any sort of guarantees?

Thanks.

<comment><USER13> FWIW, the only "CDN" I've ever heard of to regularly pull stunts like that is CloudFlare; and really, that's their angle: it adds latency (which has been demonstrated in various commentary on the service) with the goal of modifying content to reduce the number of requests or improve client-side rendering times. It is more of a "content optimization" service than a "content delivery" service. If you want a CDN the tradeoffs (number of edge nodes, latency, cache sizes) are much better with other providers.

Sometimes, the stuff they inject also has horrible bugs ;P. One time, for an entire day, they were managing to lock up Safari entirely. Cydia is mostly a web browser, and one of the companies I work with apparently used CloudFlare, so Cydia suddenly stopped working that day in a way that was pretty catastrophic. I did a writeup on the process of discovering the bug (which I had to report to CloudFlare to get fixed: I don't even think they really had the expertise in-house to figure out what happened).

[http://www.saurik.com/id/14](http://www.saurik.com/id/14)

<comment><USER14> Good stuff! If you write this sort of article every so often, please set up an RSS or Atom feed.

</comment></comment></comment></comment></comment></comment><comment><USER6> The problem I have with this is the same I have with all public js CDNs: Your project doesn't just use public js files. You are almost guaranteed to also have custom javascript (which could itself be opensource or not. irrelevant), css, possibly fonts, images, etc.

You can't put your static files on that public cdn. So either you have to serve it up yourself or you have to put it on your own CDN (either one you run yourself or a managed one).

So you have an additional point of failure (because your static files are coming from at least two places rather than one) which multiplies the chances of something going wrong for little benefit in my opinion.

Deployments are likely to be much more complex too, etc.

And before someone mentions the limit of how many concurrent requests a browser will make to a host: That's also irrelevant. I'm not arguing that you should have loads of little files. You should still be combining things with build tools. In fact if you host those "vendor" files on your own webserver or cdn you actually have more flexibility around how to combine them. And you can still have multiple subdomains and ip addresses or whatever pointing to the same CDN to try and optimise around that if you want.

</comment><comment><USER15> This is really cool. Up to the section on Advanced Features, it seemed like a clone of Cloudflare's cdnjs. But the multiple request feature is absolutely terrific, and I can't wait to use it.

EDIT: I wonder if the multiple-request URL's mean that the individual assets won't be cached, which is a big selling point of CDN's.

<comment><USER11> Grouped URLs are cached as always but for less time. You can check the headers.

<comment><USER16> I think the parent's point is that people will less likely to have a warm cache because it's less likely any other site has requested the exact same group of files.

(Though there's debate as to how much that matters.)

<comment><USER11> Personally I think they only file that is going to be already cached is jQuery from Google. So for the rest it doesn't matter. Just my opinion.

</comment></comment></comment></comment><comment><USER5> There is cdnjs.com that proposes the exact same features and has been available for quite some time.

I regularly submit new libraries and update the current ones through their Github repository.

The multiple files per request is nice however, but contributing to cdnjs might have been a better way of proposing it.

<comment><USER17> But according to the benchmarks, cdnjs.com is worse than google and jsdelivr. [http://www.cdnperf.com/#jsdelivr,google,cdnjs/http/90](http://www.cdnperf.com/#jsdelivr,google,cdnjs/http/90)

<comment><USER11> Exactly, we use multiple CDNs. We are the only project to do that. This is why our performance and uptime will be always better.

<comment><USER18> Better than Akamai? I think not.

<comment><USER11> Akamai does not offer a public CDN. So they are not a competitor. Apples and oranges

<comment><USER18> If by "public" you mean free, correct.

Akamai is cadillac of the CDN world so more like Apples and Organic Gourmet Apples.

</comment></comment></comment></comment></comment></comment><comment><USER19> I'd like to see something like a CDN, but for completely dynamic content. Something like a system that could host instances of a game server, with a framework that ensures clients make connections with very low latency.

<comment><USER20> Huh? The game server instances would still need to sync between themselves, so this really wouldn't address latency.

Rather then having the latency between the client and the server, you'd instead have latency between the two servers.

<comment><USER19> _Huh? The game server instances would still need to sync between themselves, so this really wouldn 't address latency._

No. If you design the game properly, they actually don't have to coordinate very much at all.

<comment><USER20> For what kind of game? For something like a FPS this requires significant coordination.

<comment><USER21> How much coordination is there between, say, different Team Fortress 2 servers?

</comment></comment></comment></comment></comment><comment><USER22> _There are no popularity restrictions and all kinds of files are allowed, including JavaScript libraries, jQuery plugins, CSS frameworks, fonts and more_

So what is 'Js' about it? Has 'i' prefix become old-fashioned?

<comment><USER11> jsDelivr is javascript centered. But it allows all kinds of projects too. For example the combination feature will only work with js projects. And we have all kinds of plugins for js developers.

But we still want to help open source projects to take advantage of our network. This is why we allow even windows binaries and other stuff too.

</comment></comment><comment><USER23> I am worrid about wb sits with misspelld nams.

Mistakn usrs somtims correctd missd lettrs, so thy downloadd pags from unrelatd servrs.

Howevr, the spc thy postd mentiond othr use cass, and presentd exampls of anothr systm with enterprisy qualitis to delivr usrs to correctd wb sits with misspelld nams:

A clevr browsr evn maks guesss, which enabls fils with unrequestd but correctd nams to be downloadd in paralll ovr integratd distributd per to per technologis, oftn receivd replis cachd, and latr presentd.

Ys, yt again, browsrs designd by committs enabld Opn Sourcs and Fre Softwars to answr anothr complicatd Internt problm!

</comment><comment> Dorian-Marie Neat, but I couldn't get three librairies with minified JS:

        https://firstname.lastname@example.com,firstname.lastname@example.com,email@example.com

And I couldn't get Boostrap CSS even if they say they also host CSS.

Also, it's not clear if you can or not mix CSS and JS in the query, that would be neat to do that and then to insert CSS with Javascript (or maybe that would be a bad idea).

<comment><USER11> jQuery was deployed from the official source. And it does load a map file suggesting its minified. Not sure why it looks like this.

You can mix CSS and JS in one query but its up to you to make it work.

To load Bootstrap CSS you need to specify the exact file like so

[https://firstname.lastname@example.com(css/bootstrap.min.c...](https://firstname.lastname@example.com\(css/bootstrap.min.css\))

Because the main file for this project points to a js

<comment> Dorian-Marie Thanks, I didn't see the files were in sub-directories for Bootstrap.

Here is my final Javascript query: [https://email@example.com(jquery.min.js),boot...](https://firstname.lastname@example.com\(jquery.min.js\),email@example.com\(js/bootstrap.min.js\),firstname.lastname@example.com\(angular.min.js\))

<comment><USER11> You dont need to specify the exact files in this case. This code will load the exact same thing [https://firstname.lastname@example.com,firstname.lastname@example.com,ang...](https://email@example.com,email@example.com,firstname.lastname@example.com)

You need to specify the files if you are loading files other than the one specified in the "mainfile" parameter. Or loading multiple files together.

</comment></comment></comment></comment><comment><USER24> I currently use cdnjs, but very interested in the single HTTP request & simpler versioning that JsDelivr is offering, so will start using this for my current project.

Most of the libraries I use are already on there, and I like the fact that brief glance information is shown for each library. Also noticed there's a duplicate misspelt typeahead library listed.

</comment><comment><USER25> I'd like something like this integrated with a module system. For example, I could just say "var jquery = require("jquery")", and the script would be automatically downloaded from the CDN.

<comment><USER26> I suppose someone could write something like this on top of the API, [https://github.com/jsdelivr/api](https://github.com/jsdelivr/api) .

</comment></comment><comment><USER27> I must say that the process for adding files is too complicated and time consuming.

<comment><USER11> I know. I hope the auto-update app will fix this.

We are also thinking new ways to add files [https://github.com/jsdelivr/jsdelivr/issues/347](https://github.com/jsdelivr/jsdelivr/issues/347)

<comment><USER27> Why not implement origin pull?

<comment><USER11> Origin pull from Github?

We need to maintain our own structure to allow features like file grouping and version aliasing.

</comment></comment></comment></comment><comment><USER28> HOw is this different from cdn.js? I already use that, and it too is on Cloudfare.

</comment><comment><USER23> 2004 calld. Thy want their missing "e" back.

<comment><USER11> You can use this domain if you prefer [http://www.jsdeliver.com/](http://www.jsdeliver.com/) :)

<comment><USER23> Ys, I prefr.

</comment></comment></comment><comment><USER29> How about not leaking to third-parties? I value my privacy and I wish Mozilla would too.

<comment><USER30> Sorry, I don't get the comment.

Leaking what? Your publicly available JS libraries? or is this a more general Mozilla bashing comment?

The service itself looks great, and the versioning is exactly what I'm after.

<comment><USER29> Sorry, I thought it was obvious.

Requesting assets from third-party websites leaks that I have been visiting your site to the third-party. Now imagine having a big CDN that many websites use and you can spy on a lot of unsuspecting users.

<comment><USER31> Surely the correct solution to that is to control the information _your_ browser will send to the CDN, not to try and stop web designers from using CDNs for everyone. The way requesting assets leaks the page you're visiting is through the referer header, so if you want to prevent that, use an add-on that lets you control that header, like [https://addons.mozilla.org/en- US/firefox/addon/referrer-cont...](https://addons.mozilla.org/en- US/firefox/addon/referrer-control/) .

<comment><USER4> I don't think making the entire toolchain more complex with extra edge cases that would need some kind of centrally managed white list, is more correct than 'just dont do that'.

<comment><USER21> Just don't do _what_? Receive the information you are sending them?

If you don't want someone to have this information, the sensible thing is not to offer it. I cannot conceive of any way in which sending the information and then yelling at the recipient for receiving it is "more correct" than just not telling people things you don't want them to know.

<comment><USER32> Why don't site operators take responsibility for themselves to not leak their users information unnecessarily? We've taken it upon ourselves to chastise any web property that doesn't properly hash their passwords--we could just have easily say "if you don't want your password to other sites leaked, use different passwords". But we recognize the unfair burden we are placing on end users in that case. The case with CDNs and information leak is similar.</comment></comment></comment></comment></comment></comment></comment>


Justin.tv ending archiving, deleting all archived videos after June 14 - <AUTHOR> https://help.justin.tv/entries/41803380-Changes-to-Video-Archive-System

<comment><USER2> If the destruction of all this unique user-generated content pisses you off -- and it should -- then feel free to join ArchiveTeam and help save this (and other) content for the Internet Archive. Check out the ArchiveTeam wiki at archiveteam.org, or come on over to #archiveteam and #archiveteam-bs on efnet throughout this week to watch a self-organizing data rescue mission happen in real time. (There will probably be a new dedicated channel spun off for this project later today or tomorrow.)

In the meantime, programs like youtube-dl and livestreamer are your friends.

[http://rg3.github.io/youtube- dl/documentation.html](http://rg3.github.io/youtube-dl/documentation.html) [http://livestreamer.readthedocs.org/en/latest/](http://livestreamer.readthedocs.org/en/latest/)

<comment><USER3> To elaborate, the ArchiveTeam distributes a very simple-to-use virtual machine image that you can run. When you do so, your machine will help download and collect from disappearing websites. I don't think they've got scripts for justin.tv yet, but it sounds like they are going to, so now would be a good time to get your VM ready.

It's easy, and the more people who run the machine, the more power the ArchiveTeam has at their disposal. I encourage everyone to give it a look.

You can get the virtual machine here: [http://tracker.archiveteam.org/](http://tracker.archiveteam.org/)

<comment><USER4> it has stopped working for me, what about you, it still works ?

<comment><USER3> Everything seems ok for me. What is going wrong?

</comment></comment></comment></comment><comment><USER5> I'm not a Justin.tv user, but it frustrates me when organizations make big decisions like this without much time for their users to react. I can only assume that they're bleeding money and they're trying to quickly cut their operating costs.

Someone should contact the Archive.org and see if they can get copies of all the public archives of these videos.

<comment><USER6> Justin.tv owns Twitch, which is recently rumored to be in acquisition talks with Youtube for $1bil. I don't think they're bleeding money at this point.

<comment><USER7> Bleeding money and being in acquisition talks are not mutually exclusive.

<comment><USER8> Maybe not, but it's bad strategy to give away that you're bleeding money while in acquisition talks.

<comment><USER9> As long as you don't end up like HP and Autonomy:

[http://www.theguardian.com/business/2013/may/07/shareholders...](http://www.theguardian.com/business/2013/may/07/shareholders- sue-hp-autonomy-deal)

<comment><USER8> Oops. Yes, you're right - you almost certainly have to disclose it at some point. Don't take legal advice from me...

</comment></comment></comment></comment></comment></comment><comment><USER10> A few Defcons ago, Jason Scott gave an excellent talk about this failure mode[1]. Basically, companies host user-generated content for free. Then years later, they destroy it with little or even no notice. Sturgeon's law applies; most of the deleted content is crap. But a lot of it matters to the people who made it. More importantly, a small fraction of it is stuff that future historians would _kill_ for. Collectively, companies that engage in this behavior are burning historical evidence.

1\. Archive Team: A Distributed Preservation of Service Attack [http://www.youtube.com/watch?v=-2ZTmuX3cog](http://www.youtube.com/watch?v=-2ZTmuX3cog)

<comment><USER11> I find it hard to get too wound up about an only copy that has been turned over to a third party. I get that the user understanding the situation well can be a problem, but it isn't a very careful thing to do.

</comment></comment><comment><USER12> I like how they phrase this like it's a considerate product decision, while it's essentially them not wanting to shoulder the expense of storage. Without knowing more about their product internals an immediately obvious and important feature getting the axe from this is highlights. Example: I will stream and then go back the next day and cut the video down and take the snippets and post them to youtube. These highlights then lead to interest in the channel which leads to more viewers. Now I need to archive all my stuff locally, and upload it over my mediocre connection. If they limited the archival time window to 4 hours after the end of the broadcast they would have their drastic reduction in infrastructure cost while not totally removing a valid and arguably important feature.

<comment><USER13> I think that's how Twitch works by default now. They archive the whole stream for like a week so you can Highlight it, and then it's auto-deleted (unless you've configured it to keep everything).

<comment><USER14> I believe the default now is that nothing is saved, not even for a week. However, each user can configure a setting that does cause Twitch to save the stream for about a week, before it's deleted.

In order to fully archive a stream "permanently", a user needs to view each archived recording individually and select an option from that page to save it forever.

</comment></comment></comment><comment><USER15> Perhaps they should just keep the archive videos for a week or a couple of days after the broadcast. That gives a window for users to download archived copies and reduces the amount of storage they need on their end. It also means that users aren't forced to generate video archives themselves, and can still rely on the service for this function. Maybe for videos that accrue a certain amount of unique views during the grace period, keep them around in a sort of "Classics" library?

<comment><USER16> Twitch.tv uses a similar system

<comment><USER17> Twitch is owned by Justin.tv

<comment><USER18> technically it's Twitch Interactive which kind of shows you the company's focus and growth.

</comment></comment></comment></comment><comment><USER19> This is reminiscent of Google's (and others, to be fair) build-first, monetise-later approach to products. Features get cut, entire products get slashed and users end up losing their data and time invested.

At least Google had acted partly responsibly by providing ample notice and allowing users to download their data before shutting down Google Reader.

In the case of Justin.tv, I would propose they at least take a measured approach and start by deleting videos that haven't received a single view in over a 6 months then work their way from there.

<comment><USER20> In 2007, this was _THE FUTURE_ , where UGC was going to be the democratizing content tide that would lift all of our boats. Turns out it all devolved into ad platforms anyway, just like 1997.

</comment></comment><comment><USER21> On the one hand, I have a fair bit of sympathy for the preservationist school of though--and the Internet Archive does great work. I also consider it very fortunate that much (though not all) of Usenet was preserved when it may well not have been.

OTOH:

>We found that more than half of our VODs are unwatched (with 0 or 1 total views), while the vast majority are rarely watched (with 10 or less views).

The reality is that there is an increasingly indescribably volume of user- created "stuff" out there and it's pretty impractical to preserve all of it. And when it's not on a well-known site that's shutting down (think Geocities) it mostly sinks beneath the waves without anyone really noticing. I could probably name any number of online magazines/sites which went away or restructured and whose content is no longer available. I'm not saying that's a good thing but it's hard for me to get too worked up in most of these cases.

</comment><comment><USER22> So only 1 week notice? Bit harsh. Seems 30 days would be more standard when shutting a service or feature.

<comment><USER23> It could be a cost elimination.

<comment><USER24> Likely - also, if true, basically the equivalent of putting a banner on their site saying "We don't value our users!". Even a minimally competent management team should be able to look at the burn rate and make decisions more than a few days out.

</comment></comment></comment><comment><USER25> >We found that more than half of our VODs are unwatched (with 0 or 1 total views), while the vast majority are rarely watched (with 10 or less views).

Isn't this the standard for content? Anyone know similar statistics for image hoster, url minifiers, youtube, appstore etc?

<comment><USER26> It seems like they asked the wrong question. It's not about how many people want to watch archived video, it's about how many people want to make an archive of a video. That said, I wonder if the amount of money they save is enough to offset the users they lose to other services.

<comment><USER27> I think the question they asked was "how much does it cost to host all this video?"

Then for their post, they answered the question they wished they were asked, like a politician does in an interview.

</comment></comment></comment><comment><USER28> A little over a week doesn't seem like enough time for the news to get out and people to download all their content.

</comment><comment><USER29> Of course this is financial.

Justin.tv is not a profit center for Twitch Interactive, so they need to cut costs. If 50% of VODs are viewed <= 1 time, and most viewed <=10 times, why not just leave them there? Obviously storing them costs money, but there probably isn't a lot of bandwidth costs associated with it.

I don't have anything against what they're doing as much as the sugarcoating of "focusing on live video"

This also lends more credence that they're getting bought out soon and want to look good on the cost sheets.

<comment><USER30> _and want to look good on cost sheets_

Ding, ding, ding. We have a winner!

Seriously, there can be no explanation for the ridiculously short notice other than YouTube said, "You look good, but your costs are just too high." (Or, if not YouTube, somebody else Twitch is trying to get into a bidding war with YouTube.)

Any other reason and management would have looked at the costs and said, "We need to transition out to save money," and provided a reasonable runway for their customers. As it is, this has _nothing_ to do with making things better for their customers.

</comment></comment><comment><USER31> The page currently says _" All VODs will be removed after June 8, 2014. We recommend downloading your recorded videos before the date."_

<comment><AUTHOR> Yeah, I'm not sure why the title got changed to say June 14th.

<comment><USER31> Oh, that's even weirder. I thought the page changed after you posted the link, not the other way around.

</comment></comment></comment><comment><USER32> I wonder if it is relate to copyright issues associated with the sale of twitch.tv

As in Google saying they can't deal with these videos without proper acceptance of their terms of service.

The timing seems to indicate they are trying to offload the content ASAP.

From a cost perspective, they are already paying for it and 1 week vs 1 month would not make that much of a difference if it was a "product feature"

</comment><comment><USER33> If they're cutting things this fine I fear for the future of justin.tv, this does not sound like a well thought out corporate move, it sounds like panic. Imagine coming back from your holiday in two weeks time and finding all your stuff wiped out. Ridiculous.

</comment><comment><USER34> I know Justin.tv and Twitch.tv are related, does anyone know if this policy will also reflect twitch?

<comment><USER35> The policy will only affect Justin.tv, not Twitch.

</comment></comment><comment><USER36> They should only keep content for a week if there is no views.

Having an additional recording is convent, now people have to record locally at the same time as streaming.

</comment><comment><USER37> Its interesting if you read their FAQ, they are eliminating their premium service which in theory should have included archiving. My first thought was why not charge people for permanent archiving? Guess not enough people are paying to even justify the consumer premium model.

I feel like justin.tv's peak was 5+ years ago, twitch seems to have been their real business in the last 3 years.

</comment><comment><USER38> I don't see why the decision is so digital. Surely a 1 week hold coupled with the ability to move the video to YouTube (or simply the latter as an option at the end of a live stream) would take away the huge hosting costs but give content creators the chance to save certain videos if they wanted to.

</comment><comment><USER39> Two week notice for storage policy changes smells like financial concerns to me.

<comment><USER40> well, to be fair, nearly any storage policy change will smell that way.

<comment><USER39> It's one thing to say "we're phasing this out over 12 months" (or even, say, six).

Two weeks is freaking desperation.

<comment><USER41> Agreed, 3-6 months notice is fine. This is not a classy way for them to address the issue.

</comment></comment></comment></comment><comment><USER42> I wonder what it would take to transload them all to youtube.

<comment><USER43> Twitch.tv has offered this service for ages, but maybe it started offering it after splitting from the Justin codebase?

</comment></comment><comment><USER41> I understand people need to make business decisions but short notice on something like this isn't exactly a classy move.

</comment><comment><USER44> That really isn't a lot of notice.

</comment><comment><USER45> i only use JTV to nerd out in the trek streaming channels and make fun of rikers lack of beard in chat during season 1 TNG</comment>


Why you need a mutex to protect an int - <AUTHOR> http://www.alexonlinux.com/why-you-need-a-mutex-to-protect-an-int <comment><USER2> eh, not so accurate.

it's true that you can't have int i; and write i++.

but neither do you need a mutex. for instance, you may just need std::atomic<int>, which (except on a very unusual system) is not going to be implemented with a mutex. On x86 linux, it's the "lock incl" instruction (vs an "incl" instruction which has the problems the author outlines)

<comment><USER3> This.

Plus, using a mutex requires that you obtain all your locks in a consistent order, etc. which opens up a whole can of concurrency worms. All you need is some intern who didn't properly read the documentation writing code that could deadlock. Atomic access is usually what you want.</comment></comment>


Are tablets just a fad? - <AUTHOR> http://www.telegraph.co.uk/technology/advice/10036540/Are-tablets-just-a-fad.html

<comment><USER2> Maybe for Blackberry they are. I'm surprised that RIM is still alive.

<comment><USER3> Typing this on a PlayBook. It's a very well designed tablet and works very nicely with a BB phone. Despite being two year old hardware, it's as useful now as when I originally got it. Now that hardware and software are mature, it seems like the tablet upgrade cycle will be much longer than phones. Maybe that's what is behind those odd comments from the BB10 ceo.

<comment><USER4> I was lucky enough to get the 64GB for 169 at Best Buy and I still enjoy using it.</comment></comment></comment>


Calling All Broadcasters - <AUTHOR> http://blog.bittorrent.com/2012/11/20/calling-all-broadcasters/ Do you have a Ustream channel? A justin.tv following? A webcam, and a dream? Do you want to help invent the next generation of live streaming? Cool. We're looking for people like you. <comment><USER2> There's a lot of times that I'm watching something on YouTube that's broadcast live (like presidential debates) when I wish there was a less corporate, ad infested version where it was available. I think a P2P solution for events like this would be really cool. I've seen BitTorrent live evolve over the last few years and it's really beginning to mature. It still hasn't seen a swarm at that kind of scale, though.

<comment><USER3> Are you opposed in general to people earning money by providing you streaming content you're interested in, or would you prefer to pay for it directly rather than have ads?

</comment></comment><comment><USER4> I never understood why torrent clients are not built into browsers and the defacto means of download. Would be huge cost savings.

<comment><USER2> Opera has (had?) one built in. The difficulty is the necessity of hashing the entire file. Torrents are great for snapshots of large files.

I think one of the reasons the torrent protocol is not built-in is that it's simply more complicated and the user experience is not as good.

Or perhaps it is because there is a certain stigma attached to using a technology that enables distribution of data, even when it is against the wishes of the creator of the data.

<comment><USER5> Note to anyone planning on using Opera's client: it's terrible, out of spec, and banned on many bittorrent sites.

I don't think the complexity and user experience issues are completely intrinsic to the protocol - BitTornado (sadly, another client that misbehaves, and hasn't been updated in 6 years) was hands-down the easiest for less techy people to use and understand. (Each download has its own window and instance of the program, making it look and feel very similar to downloading in Internet Explorer)

Why do you say the difficulty is in hashing the entire file? BitTorrent divides the files into small chunks and hashes those, so downloading lots of small files vs downloading one big one doesn't make a lot of difference

(with a few caveats - some clients support an additional hash on each file, which can save you re-downloading data if two files share a block and only one is changed, and some clients add padding data so there is only one file per block. In practice, these are both very rare)

</comment></comment></comment><comment><USER6> I'd like to see people streaming demonstrations etc using this.

And then others could make the stream more resilient.

I installed the client in Debian and live.bittorrent.com worked well with Chrome at least.

Once I see open source clients and streamers, then I'll be really excited.

</comment><comment><USER7> I hope YouTube et al are asleep at the wheel long enough for this to take control of large scale live events away from them - the Baumgartner jump, the debates, it'd be nice to see these handled by P2P technology...

<comment><USER8> Well, maybe. In reality they really only need their hands on the control channel (whatever that is here) and can leave the bulk data delivery to peer- to-peer routing like the internet was designed for.

</comment></comment><comment><USER9> Seems like a viable solution for a lot different content producers. NASA included:

[http://nasaweb.ideascale.com/a/dtd/Cut-Costs-By-Using- BitTor...](http://nasaweb.ideascale.com/a/dtd/Cut-Costs-By-Using-BitTorrent- Live-Stream/296563-19702)

<comment><USER10> Maybe this way they won't get their video taken down for copyright infringement next time they land something on another planet.

</comment></comment><comment><USER11> Bittorrent always makes me think about transfer-capped Internet connections. It feels like even wireline-based Internet connections in the USA are moving toward being transfer-capped. I don't see how Bittorrent works in that world.

</comment><comment><USER12> This seems like a very useful tool for people who cannot afford big servers.

</comment><comment><USER13> It's interesting that Bram (I assume it's still Bram's show over there) has finally gone with a new streaming-optimized protocol design. We argued about it years ago.

Here's Bram in 2004 arguing that _live_ streaming is a niche market: <http://bramcohen.livejournal.com/4294.html>

In the comments, "streamerp2p" is discussed, which I used as the basis for a proposal for live radio station streams along with Speex, back ~2005, when bandwidth was expensive. It's still around, apparently: <http://www.streamerp2p.com/>

Bittorrent itself can do streaming of static content: just request the blocks in order. It can also do streaming of live content if you chunk the live content and have an out-of-band way to update the torrent you're looking for, but that's not great.

In my proposal I mention some other systems as well:

Peercast: [http://web.archive.org/web/20060207013338/http://www.peercas...](http://web.archive.org/web/20060207013338/http://www.peercast.org/) (defunct, Internet Archive link)

P2P-Radio: <http://p2p-radio.sourceforge.net/> (defunct)

Allcast: [http://web.archive.org/web/20060805040005/http://allcast.com...](http://web.archive.org/web/20060805040005/http://allcast.com/) (defunct, Internet Archive link)

Chaincast (dead and blocked from IA)

Abacast: [http://web.archive.org/web/20061017041905/http://www.abacast...](http://web.archive.org/web/20061017041905/http://www.abacast.com/) (IA link, they're still around but now cloud-based)

Xiph's IceShare: <http://wiki.xiph.org/IceShare> (defunct)

Robert Haarman's StreamDist prototype: <http://inglorion.net.nyud.net:8090/software/#streamdist>

Andrew Brampton's research and prototype: [http://web.archive.org/web/20100325135652/http://www.lancs.a...](http://web.archive.org/web/20100325135652/http://www.lancs.ac.uk/ug/brampton/fyp/) (IA link)

Onion Networks' Swarmstreaming (defunct and blocked)

The proposal isn't worth posting any more; all the assumptions and business cases are obsoleted.

Today, rather than use a client at all, I'd probably push for WebRTC P2P support, funding patches in all the browsers and their mobile versions, incentivize people to upgrade their browsers, host with cheap bandwidth for everyone else, and just hold on until enough of the market has upgraded.

<comment><USER2> I agree with you that WebRTC is the obvious choice when it becomes available. It's simply too hard to get people to install a client. For users to install a client, the uses for it must be compelling enough to go through the trouble of installing an application. Dropbox is one example of how people will install software because the product offers something useful enough.

It seems like live streaming client programs simply don't have the critical mass of content available to force people to go to the trouble of installing specialized software.

The web is going to be a very exciting place indeed, once the webRTCPeerConnection.createDataChannel actually works and we can use application logic to send arbitrary payloads to peers over the internet.

<comment><USER10> Can someone create a WebRTC web app in this way, so one person can broadcast to millions through P2P technology? Or would the browser vendors need to make certain API's available before they can do that?

<comment><USER2> Once arbitrary data can be sent through peer connections via a browser javascript application, then there is no reason why the BitTorrent Live protocol (or some other similar P2P streaming protocol) could not work over WebRTC.

One difficulty I see is actually getting the binary data into a <video> element. It would be in theory possible to write to the file in the HTML5 FileSystem API and point the video element to it, but that would require transmitting the stream in a way that is ameliorable to seeming like a static video on disk.

<comment><USER14> Possibly the MediaSource api, which allows writing to media elements: [http://dvcs.w3.org/hg/html-media/raw-file/tip/media- source/m...](http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media- source.html)

</comment></comment></comment></comment></comment><comment><USER15> Is this not the sort of thing IP multicast is for?

<comment><USER16> IP multicast is turned off on the Internet.

<comment><USER17> Thank god... imagine the incredible noise

<comment><USER18> What do you mean? The whole point of multicast is that you don't have noise. You choose exactly what you want to get.

</comment></comment></comment></comment><comment><USER19> Can this be further developed to replace Facetime and Skype? /cross fingers.

<comment><USER2> Facetime and Skype and Hangouts are mostly for 1-1 communication or small group communication. I think the aim for this is to enable anyone to a live broadcast to as large an audience as they wish. Like justin.tv, or ustream

</comment></comment><comment><USER20> There is a 10 year old PeerCast that does (or was intended to do) something very similar. The only difference, which is crucial, is that BT sits on a massive userbase that they may be able to repurpose for bootstraping their project... Though Skype was in a similar position and look how well their Vienna Project is doing (it's dead).

</comment><comment><USER21> Where's the linux client? Where's the source for the client?

</comment><comment><USER22> if I get it right, BitTorrent live is a centralized server with a proprietary (?) client?

I don't think that's the lesson to take from BitTorrent.

<comment><USER2> AFAIK, the centralized server is not a strict necessity in terms of the functionality of the core protocol. It is more of a business decision to require the central server to authorize the stream (I believe each stream has a key that must be signed by the central server). This way, DMCA can be respected and liability issues are less of a concern.

</comment></comment><comment><USER23> Stream Torrent works pretty well too.

<http://stream-torrent.en.softonic.com/>

<comment><USER2> windows only, and disclaimers about it being unsupported on that site.

</comment></comment><comment><USER24> I love the idea, I'd like to stream but I have about 256kb/s of upload speed and using TwitchTV or so it's impossible.

</comment><comment><USER25> I'm super excited by this but where are the specs?

</comment><comment><USER26> streemig for freedom, long live the live-bittorrent.</comment>


JINQ – A minimalistic library for Java inspired from .NET LINQ - <AUTHOR> https://github.com/VivekRagunathan/JINQ <comment><USER3> What's the point of this library?

A pet peeve of mine is how these libraries put the 'old' alternative in the worst possible light, creating the fake impression (at a casual glance) that the library makes your code much nicer. It doesn't.

Passing in an array is weird, so lets assume we're not working with really outdated codebases and a List<Product> is passed in instead.

You can do the snippet with bog standard Java8+ stream API like so:

        List<ProductDisplayInfo> getDisplayList(List<Product> products) {
    		return products.stream()
    			.filter(p -> p.getCategory() == 2 || p.getCategory() == 5 && isProductUnderDiscount(p))
    			.map(ProductDisplayInfo::new)
    			.collect(Collectors.toList());
    	}

Even in old style java6 syntax it's short, sweet, and to the point (as short as this library can let you write it):

        List<ProductDisplayInfo> getDisplayList(List<Product> products) {
    		var pdiList = new ArrayList<ProductDisplayInfo>();
    		for (var p : products)
    			if (p.getCategory() == 2 || p.getCategory() == 5 && isProductUnderDiscount(p))
    				pdiList.add(new ProductDisplayInfo(p));
    		return pdiList;
    	}

Separate from that, as scarface74 mentioned, part of the point of LINQ is that the structure of the expression tree can be applied elsewhere, for example, to an SQL statement.

<comment><USER4> Probably the biggest difference between this and Java Streams is that it produces an Iterable<T>, which implies that, like LINQ, the thing can be iterated multiple times. For better or for worse, Java 8's Streams can only be iterated once. The difference can potentially be a big deal, depending on your use case.

<comment><USER5> Repeatability is a bonus, but it's also a limitation - not all sources of data can be restarted. Overall, I think restartable enumerations are ok to lose given that they are rarely restarted in practice - they tend to be expensive, or at least seem expensive.

<comment><USER4> When you're working with external data, yes, they can be expensive.

But most of what I've seen LINQ to Objects used for is simply mapping over data that already lives in memory. Oftentimes you want to just pass along a lazy projection of that data, on the grounds that re-running the operation is less expensive than allocating a bunch more memory in order to cache the result to a list.

In the cases where a source can't be restarted, it's always seemed easy enough to me to just build up your LINQ query and then pass its enumerator back rather than the original enumerable. Returning an IEnumerator<T> should be sufficient to communicate that you only get to enumerate the thing once, and tacking a ".GetEnumerator()" on the end of things requires barely more typing than tacking ".ToList()" on the end.

By contrast, with streams, I feel like the Java maintainers gave me an API that's less powerful than the standard I'm used to on other platforms, on the grounds that they think I'm not a smart enough developer to handle a more powerful API. I don't really appreciate that. All it's really meant is that I now need to work with two different libraries depending on whether I'm working with data that lives in memory or not, which does worse things to the cognitive load it takes to understand the codebase than simply having to keep track of the difference between an Iterable<T> and an Iterator<T> would have.

<comment><USER5> I find it hard to get worked up about it. You can just hand around a Supplier of your stream if you need restarting. Monadic composition of further operations is a bit clumsier then, but it's still very doable.

</comment></comment></comment></comment></comment><comment><USER6> C# LINQ's prowess is not just about the syntax, it's about the underlying expression trees that linq queries create.

The same LINQ expression once translated to expression trees by the runtime can then be translated to SQL, MongoQuery,C# IL, etc at runtime depending on the linq provider.

[https://blogs.msdn.microsoft.com/charlie/2008/01/31/expressi...](https://blogs.msdn.microsoft.com/charlie/2008/01/31/expression- tree-basics/)

[https://stackoverflow.com/questions/623413/expression- trees-...](https://stackoverflow.com/questions/623413/expression-trees-for- dummies)

<comment><USER7> Indeed. My understanding of LINQ is that a where clause, for example, creates a matching clause in the SQL it generates, so the database only fetches the elements that you want. In contrast, the Java solution seems to "select *" in SQL then iterate over the results in the application itself.

<comment><USER6> LINQ itself just creates expression trees. The expression tree is then translated into code by another provider (for lack of a better term). The code generated can either operated on an in memory collection or generate any other type of query.

var seniors = customers.Where(c => c.age > 65)

Could either represent C# IL, a MongoQuery, a SQL query, an ElasticSearch query, etc. depending on what type of variable "customer" is.

<comment><USER8> Just to be a little pedantic and to inform those that might not be familiar, LINQ only creates an expression tree when the type of the source object is IQueryable. If the type of the source object is IEnumerable only (such as an in-memory list), it will not create an expression tree and instead will use the Enumerable static class methods passing in the lambdas as delegates (aka function pointers). In the latter case, there is no "code generated", it will directly enumerate the IEnumerable and do things like an "if" statement inside a "foreach" loop in the case of "where", for example.

Also, you don't need a better term than "provider" as that's what they're called. :-) The IQueryable interface includes a property called Provider that returns an IQueryProvider which can operate on an expression tree.

<comment><USER9> Also, in my experience knowing when you will be working with an IQueryable and knowing when you will be working with a realized IEnumerable is a very important thing to be learned when working with Linq and datastores. You can easily load full tables into memory if you aren't careful.

<comment><USER10> This times 100. Ended up having a week of intermittent outages when a Dev on my team created a single helper method which took in an Func<> not an Expression<Func<>>. Having the same interface for both is imo dangerous

</comment></comment></comment></comment></comment></comment><comment><USER11> I don't think people understanding the problem LINQ attempts to solve with expression trees. Let me give you a more Internet'ish example. Let's say I have a REST api that's something like this: [https://movies.org/movie](https://movies.org/movie) which returns all movies but if you want only certain movies, you issue: [https://movies.org/movie?year>2016](https://movies.org/movie?year>2016) to get movies created after 2016. Let's say you didn't issue the query but instead you got the entire set of movies and filtered locally:

var movies = get("[https://movies.org/movie"](https://movies.org/movie")) foreach( var movie in movies) { if (movie.year > 2016) addToTable(movie) }

Let's do this with LINQ: foreach( var movie in movies.Where(movie => movie > 2016)) { addToTable(movie) }

The naive observer will assume the two pieced of code are about the same. But in actuality, if you had a fictitious "LINQ to Movies", it could, internally, construct the correct REST API for you.

What I'm saying is that, this code: var list = movies.Where(movie => movie > 2016))

would translate into:

var movies = get("[https://movies.org/movie?year>2016"](https://movies.org/movie?year>2016"))

Not so hypothetical. This is how OData works from C#.

Look at the C# example under "Step 2: Requesting an individual resource" at [http://www.odata.org/getting-started/understand-odata- in-6-s...](http://www.odata.org/getting-started/understand-odata-in-6-steps/)

See how elegant it is compared to the other examples using Java, Node, etc.

Doing this requires meta-programming, which many other languages have. I don't know much about Clojure, Scala or Ruby, but I'm pretty sure stuff like this can be (and possibly already are) built using the existing meta-programming constructs.

<comment> Const-me I agree that it's very easy to use, but it's extremely hard to implement new LINQ providers. When I needed that, I implemented the subset of the functionality without LINQ (1). See the usage example (2).

(1) [https://github.com/Const- me/EsentSerialize/tree/master/Core/...](https://github.com/Const- me/EsentSerialize/tree/master/Core/EsentSerialize81/Linq) (2) [https://github.com/Const- me/EsentSerialize/blob/master/Demos...](https://github.com/Const- me/EsentSerialize/blob/master/Demos/ConsoleDemo/Program.cs)

</comment></comment><comment><USER12> How is this meaningfully different from the Java 8 Streams API? It seems to be functionally equivalent right up to lazy evaluation, just with SQL vocabulary (select, where, etc) instead of functional vocabulary (map, filter, etc).

<comment><USER13> I recently discovered Java streams. Love it and couldn't notice that example readme could be easily written with streams :

      List<ProductDisplayInfo> list = Arrays
        .asList(products)
        .stream()
        .filter(p -> p.getCategory() == 2 || p.getCategory() == 5 && isProductUnderDiscount(p))
        .map(p -> new ProductDisplayInfo(p))
        .collect(Collectors.toList());

[https://docs.oracle.com/javase/8/docs/api/java/util/stream/p...](https://docs.oracle.com/javase/8/docs/api/java/util/stream/package- summary.html)

<comment><USER14> Java streams are great. Having to go from collections to streams (`.stream()`) and back (`.collect(...)`) is annoying, but understandable from a compositional point of view.

For fun, you can further reduce the size of the code above (and IMO, make it clearer), but using `Arrays.stream(product)` and a method reference for the `map`:

        List<ProductDisplayInfo> list = Arrays
            .stream(products)
            .filter(p -> p.getCategory() == 2 || p.getCategory() == 5 && isProductUnderDiscount(p))
            .map(ProductDisplayInfo::new)
            .collect(Collectors.toList());

</comment></comment></comment><comment><USER15> Jooq is great and sooner or later it will end up looking like this [http://getquill.io](http://getquill.io)

<comment><USER16> Quill is really neat and I agree that it's a lot further down the road than most libraries like this.

But it all feels a bit too "magical" for me. Seems like you're trading one class of bugs - hand-written SQL mismatching your types - for another - <USER2> magic doing something unexpected when you try to do something weird. But maybe it's really really good and that second class of bug never happens. I'm just hesitant (and happy with doobie for now).

<comment><USER15> maybe, but quill can verify queries at compile time, plus you can view generated sql

</comment></comment></comment><comment><USER5> If you're looking for LINQ for Java look at Apache Calcite.

That started out as a LINQ port but turned much more interesting.

Life would be much easier for everyone with expression trees in the language, though.

</comment><comment><USER17> Is it just me or is

      .where(p -> p.getCategory == 2 || p.getCategory == 5 && isProductUnderDiscount(p))

and

      if (product.getCategory() == 2 || product.getCategory() == 5) {
    			boolean yes = isProductUnderDiscount(product);

not functionally equivalent due to && precedence?

<comment><USER18> && precedence mans that the && arguments are bound first, so:

        .where(p -> p.getCategory == 2 || p.getCategory == 5 && isProductUnderDiscount(p))

is equivalent to:

        if (product.getCategory() == 2 || ( product.getCategory() == 5 && isProductUnderDiscount(product) );

The extra set of parentheses are not needed due to precedence, but have been included for clarification.

<comment><USER19> Which is not functionally the same as OPs second example which would be equivalent to

        (product.getCategory() == 2 || product.getCategory() == 5) && isProductUnderDiscount(product)

</comment></comment></comment><comment><USER20> Being a massive fanboy of jOOQ, I have to ask if this is a "for fun" project or is there something nice / different I'm not picking up on from scanning the repo / blog post[0]?

[0] - [https://vivekragunathan.wordpress.com/2016/04/02/jinq/](https://vivekragunathan.wordpress.com/2016/04/02/jinq/)

</comment><comment><USER21> 1\. Why not just use the Stream API?

2\. JINQ (as a name) already exists: [http://www.jinq.org](http://www.jinq.org)

</comment><comment><USER22> If you find jinq useful, I'd like to also suggest a pet project of my own: [http://jpad.io/](http://jpad.io/) It let's you run java snippets and view and share results. e.g. Any collections get converted to HTML tables with a column for each "getter".

</comment><comment><USER23> Looking at the sample code makes me wonder if Java does not have type inference like auto" or "var" in C#/C++? LINQ like code (or STL in C++) is much nicer if you don't have to explicitly declare variable types.

<comment><USER24> Yes Java 10 now has local variable type inference so you can now use "var", this repository looks like it was last touched 2 years ago so probably why the examples aren't using it.

<comment><USER25> Java 11 in September is going to be the first stable version supporting inference for locals, and IMHO that's when it starts to be reasonable to write code that doesn't run on today's LTS.</comment></comment></comment>


How one genetic mutation first let Europeans drink milk-and changed the world - <AUTHOR> http://www.nature.com/news/archaeology-the-milk-revolution-1.13471

<comment><USER2> Didn't read the whole article, but lactose tolerance map seems very false to me. It suggests that in Ukraine and its vicinities tolerance should be about 50% (hard to distinguish those grayish colors). However nobody here really have an idea that somebody can not consume milk or cheese. I've been lightly shocked to make this discovery few years ago. Wikipedia suggests tolerance rate in sad territory should be at least 90%.</comment>


TinEye announcing 1 billion image index - <AUTHOR> http://blog.wired.com/business/2008/09/tineye-to-annou.html

<comment><USER2> TinEye is impressive.

Also nice is TinEye mobile. Amazing. Take a picture of a CD and it instantly pulls up the iTunes store page where you can buy+listen to samples. <http://news.ycombinator.com/item?id=320388></comment>


FBI says utility pole surveillance cam locations must be kept secret - <AUTHOR> http://arstechnica.com/tech-policy/2016/06/fbi-says-utility-pole-surveillance-cam-locations-must-be-kept-secret/ <comment><USER3> This is pretty shocking and should be more widely publicized. A government agency covertly spying on the public with no warrants, no disclosures, and a fundamental lack of accountability rarely ends well. Even worse, both parties and most of the state and federal government bureaucracy are in fundamental agreement about the need for a national security state, only disagreeing about some of the implementation details.

People in tech are in the best position to create some pushback on this, be it through lobbying as stubbornly single-issue voters, or creating some direct (legal) technical counter-measures. It's not that hard to tell which ones are bugged if you inspect the light poles closely, and threatening to imprison people who take pictures of public lightpoles would almost certainly create more backlash than they're willing to risk.

<comment><USER4> They're not doing anything Google isn't doing. Public streets are fair game for anyone with a camera, and that includes the police. It's best if that doesn't change.

<comment><USER5> > Public streets are fair game for anyone with a camera, and that includes the > police

With the resources of modern IT, it renders the 4th Amendment almost useless: It only applies in your windowless, lead-lined basement, with communication coming in or out.

<comment><USER6> Infrared cameras need a warrant right now, so probably anything else that sees through walls into a residence would also.

<comment><USER5> There are windows, garbage, the very many commercial tracking sensors in your home and your pocket, Internet connection, phone calls (at least metadata), etc. Plus everything you do outside your home. Infrared sensors are only one small possibility.

</comment></comment></comment></comment></comment><comment><USER7> "If the public knows X, we won't be able to use X without the public's knowledge. Further, the public might demand we get a warrant to use X, making using X without a warrant more difficult."

Well then... I guess everything the FBI does should be withheld from public scrutiny because national security.

</comment><comment><USER8> Clearly there needs to be Yellow "FBI Surveillance" stickers you can put on utility poles. Put the stickers on all the poles and note the ones the FBI takes off, build your geo database and add it to OpenStreetMap!

<comment><USER9> How can they be detected? Just visually? Radio link?

<comment><USER10> If they look anything like the cameras in these articles, they are easy to spot - a big white box with a glass covered lens slot on the side:

[http://www.dailytech.com/Federal+Court+Cops+Cant+Spy+on+Your...](http://www.dailytech.com/Federal+Court+Cops+Cant+Spy+on+Your+Yard+and+Home+Without+Warrant/article37002.htm)

[https://sipseystreetirregulars.blogspot.com/2011/04/smile- yo...](https://sipseystreetirregulars.blogspot.com/2011/04/smile-youre-on- candid-camera-cameras.html)

<comment><USER11> [http://www.phoenixnewtimes.com/news/srp-removes-mystery- box-...](http://www.phoenixnewtimes.com/news/srp-removes-mystery-box-from- power-pole-after-phoenix-homeowners-complaint-8174824)

[http://www.kcbd.com/story/31589368/only-on-kcbd-lpl-lpd- addr...](http://www.kcbd.com/story/31589368/only-on-kcbd-lpl-lpd-address- surveillance-cameras-on-utility-poles)

For sale [http://www.covert- systems.com/sale_items/pole_cam_VP2c_2450....](http://www.covert- systems.com/sale_items/pole_cam_VP2c_2450.html)

[http://www.app-techs.com/video-surveillance/covertsentry.asp](http://www.app- techs.com/video-surveillance/covertsentry.asp)

<comment><USER9> The KCBD ones are fairly small.

And the Covert-Systems.com one is clever, but would take dangerous work to install properly. But then, it could maybe communicate via power grid.

</comment></comment></comment></comment></comment><comment><USER12> If these cameras had a warrant attached to them, there would be no question that the locations should remain secret - I fail to understand why its so hard to get a warrant for this kind of surveillance - but I am at least somewhat understanding (its kind of obvious) why the camera locations should remain a secret.

I'd rather see my government operating above the board (even if the records are sealed until trial) rather than casting a wide net and throwing back what they ought not have caught later.

<comment><USER7> This assumes they're throwing anything back. They're not.

[https://www.theguardian.com/world/2013/sep/30/nsa- americans-...](https://www.theguardian.com/world/2013/sep/30/nsa-americans- metadata-year-documents)

</comment></comment><comment><USER13> In the "boy who killed parents pleads for mercy as an orphan" department:

> Winn, meanwhile, wrote to Judge Jones that the location information about > the disguised surveillance cams should be withheld because the public might > think they are an "invasion of privacy."

<comment><USER14> It's the year 2034, the FBI just killed 168 unarmed Americans. It claims that disclosing the reason why they were killed may scare off similar targets. A warrant to do the killings was avoided due to similar concerns.

</comment></comment><comment><USER15> I should think the "no expectation of privacy in a public space" principle cuts both ways.

</comment><comment><USER16> I'm curious if these have infrared "night vision" as many CCTVs do.

If so, looking for infrared spotlights may be a good idea

</comment><comment><USER17> You know we've gone off the rails a bit when the authorities feel they have to automate 24x7 surveillance to watch for things that the neighbors otherwise don't give one rat shit about. (nobody is complaining about anything, but we're still looking for a way to take down "those people", for a given unpopular group of the day)

E.g. - the War on Drugs going from somehow (merely) "keeping the peace" to Zero Tolerance and zero sense.

<comment><USER18> What do you expect? It's the push from the "never again" crowd. Sandy hook, Boston marathon, San Bernardino, and Orlando to name a few. People are so scared of the big bad terrorist that they are more than happy to be watched 24/7\. If you have nothing to hide then what's the problem?

</comment></comment><comment><USER19> I really have no problem with this -- provided the FBI goes in front of a judge with probable cause and gets a warrant. This is secret and that's what really bothers me.

</comment><comment><USER20> I'm interested to see how the British handle this. There are certainly lots of cameras in London, but I believe they are rather conspicuous. Perhaps this is more about protecting technology than knowledge? Like, it's not about location, it's about the method.

<comment><USER21> > I'm interested to see how the British handle this

CCTV with a view of public areas in the UK are generally labelled with the operating agency's name and contact details.

Per the Information Commissioner's Office:

 _You must let people know when they are in an area where a surveillance system is in operation._

[https://ico.org.uk/media/for- organisations/documents/1542/cc...](https://ico.org.uk/media/for- organisations/documents/1542/cctv-code-of-practice.pdf)

</comment></comment><comment><USER22> It's nothing a passerby nailed to a utility pole can't see!

</comment><comment><USER23> openstreetmap - tag statistics (surveillance:type=camera )

[http://taginfo.openstreetmap.org/tags/surveillance%3Atype=ca...](http://taginfo.openstreetmap.org/tags/surveillance%3Atype=camera#map)

</comment><comment><USER24> From hacker news stories I've now seen that FBI has shell company planes flying over major cities, cameras on the utility poles and wants root un- encrypted access to our phones. Scary.

<comment><USER22> I actually support the surveillance planes. It seems much less invasive than the public surveillance cameras that are becoming ubiquitous. They can't identify faces or cars, just see where people move to after a crime.

I'd like some protections on it though. Like deleting the data after 5 days, or requiring a warrant to look at it. No one should look at live. And the cameras shouldn't be better than what google maps or a person in a low flying plane could see.

It makes it possible to solve a huge number of crimes much easier. People spend so much energy living in fear of crime. Kids aren't allowed outside anymore, housing is segregated, etc. Irrational or not, anything that decreases people's fear without being too invasive is a huge positive.

<comment><USER25> >> It seems much less invasive than the public surveillance cameras that are becoming ubiquitous. They can't identify faces or cars

yet

>> Irrational or not, anything that decreases people's fear without being too invasive is a huge positive.

I don't think people really live in that much fear, or should. I also don't want their fear to dictate what my definition of invasive is.

<comment><USER26> Violent crime in the U.S. may be like Lisa Simpson's "bear rock". The if-it- bleeds-it-leads media makes crime appear to be more common than it actually is. The public then ask for law enforcement to protect them from this threat. When they see the low rates of violent crime around them, they assume it's a result of the increased policing.

</comment></comment></comment></comment><comment><USER27> Is it just me, or does the TV show "Person of Interest" seem to get one step closer to reality every day, minus the all controlling AIs.

<comment><USER28> > minus the all controlling AIs.

Give them time.

</comment></comment><comment><USER29> We can't ban the government from doing what private businesses and people can already do. Otherwise they can simply buy the data off private companies who have cameras on private buildings.

<comment><USER30> Many times with businesses they just ask nicely, and to maintain good relationships they just hand it over (because they are not the topic of the investigation.)

The thing is, they mostly dont keep months of footage, its too expensive to store that much.

</comment></comment><comment><USER31> There is one at 12th and Denny on Cap Hill (unless they took it down) - solution - use Snapchat - ID basic form of box - <USER2>

<comment><USER32> A paintball could cover the camera lens pretty nicely.

<comment><USER33> But those cameras are FBI agents, and now you're pointing a weapon at a federal officer. If you think courts would never declare an inanimate object to be an FBI agent, then you'd probably also be shocked to hear there was a court case titled "United States v. Article Consisting of 50,000 Cardboard Boxes More or Less, Each Containing One Pair of Clacker Balls".

<comment><USER34> That's not even close to the same thing.

But destruction of government property is a crime.

<comment><USER33> of course not. it's mildly satirical. but for the record, I didn't say they were the _same_ , I just implied that, clearly, bizarre legal theories about the personhood of objects are not off the table.

<comment><USER35> Absolutely. When making a "Barking" sound at a police dog can result in a charge of "Assault on a police officer", anything is possible.

<comment><USER34> Wait, you mean insisting I was reporting a crime to a police officer is not a defense in that case?

</comment></comment></comment></comment></comment></comment></comment><comment><USER36> I believe England still has the largest number of video surveillance cameras in the world, owned and operated by the government.</comment>


Apktool – A tool for reverse engineering Android apk files - <AUTHOR> https://ibotpeaches.github.io/Apktool/ <comment><USER3> Good to see this on HN. I know Guardian Project and F-Droid lean on it, as it's great for trying to sort out issue with deterministic builds

I also used it once to add log output into the resulting smali code (which was obfuscated and I couldn't walk through easily), and repackaging that back into an apk helped me understand the obfuscated code in the app

[https://github.com/intrepidusgroup/IGLogger](https://github.com/intrepidusgroup/IGLogger)

</comment><comment><USER4> Jadx is another great project - [https://github.com/skylot/jadx](https://github.com/skylot/jadx)

</comment><comment><USER5> This tool is also great for verifying that you've built you APK correctly. I just used it for the past week diagnosing some issues with building an APK with Unity. It was invaluable.

</comment><comment><USER6> Current maintainer here. Glad to see apktool has been of use for a good deal of businesses.

Happy to answer any questions anyone might have.

<comment><USER7> There are so many tools for apk decompilation and analysis out there - <USER2> use apktool in the backend even. How do I as a beginner know what to use and what to trust?

<comment><USER6> That is a tough question. I would just stick with the popular known ones out there: smali, apktool, dex2jar, jeb, jad.

</comment></comment></comment><comment><USER8> I've been using Apktool for years. Great work. I had to do a double-take when I saw it on the front page though, given that it's been around for quite a while and I thought it was a pretty standard dev tool.

</comment><comment><USER9> Many companies have built software products on top of this tool. I was heavily involved in enterprise apps for several years. It's a great tool

<comment><USER10> As a hobbyist Android geek that has done minor Android dev work, I can see the use of the tool. But I am very curious: who is building enterprise tools on top of it and why? I could see securiy analysts interested, but beyond that?

This is not meant to be dismissive, I am very curious. It sounds like there is cool stuff out there I could not even dream of!

<comment><USER11> There's a concept called 'app wrapping'. A generic app is decompiled, and then the manifest and code is changed to add in some 'wrapper' code around the app. The app can then be resigned with the enterprises certificate.

</comment></comment></comment><comment><USER12> "Reverse engineering" makes it sound as if the .apk format is obfuscated or protected. It's just a zip file with files inside.

It's not a reverse engineering tool any more than unzip or tar are.

<comment><USER6> Not true. You can go unzip an apk and for one resources.arsc won't be decoded, classes.dex won't be disassembled and any xml file will be in its binary axml format.</comment></comment>


This toothbrush is engineered to last forever - <AUTHOR> http://www.slate.com/blogs/the_eye/2014/12/01/the_goodwell_company_toothbrush_by_patrick_triato_is_engineered_to_last.html?wpsrc=fol_fb <comment><USER2> It's not really though is it? The heads still need replacing it just has a bit of an industrial-looking-pseudo-ecological gimmick to it, this'd probably be better titled "This company wants to lock you into it's toothbrush heads as a service model for a year or two." quintessential S for Cs.

</comment><comment><USER3> Never had a toothbrush that needed to be replaced, except for the heads. This company hasn't solved a problem.

</comment><comment><USER4> "Lasts forever" in the "Trigger's Broom" sense of the words</comment>


How many genetic ancestors do you have? - <AUTHOR> http://burtleburtle.net/bob/future/ancestors.html <comment><USER2> > The number of genealogical ancestors you have n generations is 2n: 2 > parents, 4 grandparents, 8 great-grandparents, and so forth. The only way to > have fewer is if some of them are the same person.

They leave out that this effect that "some of them are the same person" is inevitable, even pervasive, past a few generations. Never mind that the number of "genealogical ancestors" rapidly becomes larger then the number of humans alive at the time, it's almost certain that your * 10 grandparents didn't travel much, so existed as part of a far smaller sheltered gene pool.

<comment><USER3> At the bottom, it says _You had a trillion genealogical ancestors 40 generations back, which far exceeds the total number of people who have ever existed, so most of your ancestors appear many many times in your genealogical tree._

The links in my other comment talk a bit about measured genetic similarity (which should imply relatedness), it turns out there is a lot of mixing.

</comment></comment><comment><AUTHOR> I posted this because I have always wondered what the answer to this question was, but could not do the maths - it is very hard and can only really be done by simulation as Bob as done.

I suspect that the 46,000 genetic segments is an approximation, but it should not mess up the calculations too much if this is wrong. The truly amazing thing is how few real ancestors you have out of the possible number.

<comment><USER3> I posted one of the articles linked in this article a while back (without much discussion). The author did stop by and post a link to this article, which talks a little more about the consequences:

[http://phenomena.nationalgeographic.com/2013/05/07/charlemag...](http://phenomena.nationalgeographic.com/2013/05/07/charlemagnes- dna-and-our-universal-royalty/)

and this paper, which uses DNA analysis to look at ancestry in Europe:

[http://www.plosbiology.org/article/info:doi/10.1371/journal....](http://www.plosbiology.org/article/info:doi/10.1371/journal.pbio.1001555)

<comment><USER4> Here's the thread if anyone is interested: [https://news.ycombinator.com/item?id=7539143](https://news.ycombinator.com/item?id=7539143)

</comment></comment></comment><comment><USER5> I highly recommend using an existing DNA service (I use FTDNA) to sequence the Y chromo and/or MTDNA of your living direct relatives (where it makes sense.. only one Y for male line, etc) because the samples are kept in storage and you can use them for sequencing later as technology drastically ramps up. My Y data is available to researchers and my and my father's MTDNA are in Genbank. Genetic anthropologists use the data to fine tune our knowledge of historical population movements. The current theory is that I am descendent from the Vistula Veneti. I just wish more people had an interest so that there were more data samples. You can't just go around demanding peoples' DNA, even if it has nothing to do with the parts that influence your health.

<comment><USER6> Out of two stylized models of the world:

        1. Every part of your DNA influences your health

        2. There is an identified portion of the human genetic code
           (including mtDNA) which has no effect on health

you'd have to be crazy to believe in model #2.</comment></comment>