Crude Falls Below $30 a Barrel for the First Time in 12 Years - <AUTHOR> http://www.bloomberg.com/news/articles/2016-01-12/wti-oil-falls-below-30-for-first-time-since-dec-2003 <comment><USER2> Many oil producing nations require $50+/barrel oil to have a balanced budget. After their foreign exchange reserves are depleted (a few years from now), they will start accumulating more debt at their current spending levels, and will likely have to cut public spending. This might not go down so well in some Gulf states

[http://uk.businessinsider.com/imf-regional-economic- outlook-...](http://uk.businessinsider.com/imf-regional-economic-outlook-for- the-middle-east-and-central-asia-oil-prices-2015-10)

<comment><USER3> Yes, it's going to be interesting to see how this unfolds politically, particularly in Saudi Arabia.

<comment><USER4> The IMF thinks Saudi has cash reserves to cover five years - which is more than competing countries have.

So they can play white knuckle poker and out-wait everyone else, then jack up prices again around 2019/20 - just in time to kill any recovery that might be happening by then.

<comment><USER5> > So they can play white knuckle poker and out-wait everyone else, then jack > up prices again around 2019/20 - just in time to kill any recovery that > might be happening by then.

The rest of the world better move off of oil quickly then.

<comment><USER6> is there a way to move off oil _quickly_?

<comment><USER5> Provider greater incentives for electric vehicles, place a carbon tax on petroleum fuels.

</comment></comment></comment></comment></comment></comment><comment><USER7> Countries that export crude are having recession.. To name few Canada, Russia, Brazil, Nigeria, Venezuela, Australia (commodities not just crude), at the same countries like India who import and depend heavily on crude are having good times (relatively).

So finally is it crude that runs all economies and everything else is overrated.. That scenario if true is so scary!

<comment><USER8> Australia has managed to avoid recession so far. I know that's only technically true, but that's the best kind of true. (We had a lot of defense spending in one quarter that pushed us over the line between contracting/expanding.) It'll be interesting to see how Q1 2016 goes. Even if it is a recession, it's not a normal one, since unemployment is going down.

<comment><USER9> Do you think we (Aus) will in 2016?

</comment></comment></comment><comment><USER10> It's weird how us energy independence was such a big deal 10 and 20 years ago and it seemed like a hopeless idea.

But now we've actually gotten there and there wasn't even a celebration.

</comment><comment><USER11> Interesting perspective: Oil Limits And The End Of The Debt Supercycle

[http://davidstockmanscontracorner.com/2016-outlook-oil- limit...](http://davidstockmanscontracorner.com/2016-outlook-oil-limits-and- the-end-of-the-debt-supercycle/)

<comment><USER12> > Ultimately, diminishing returns with respect to human labor–what some of us > would call falling inflation-adjusted wages of non-elite workers–tends to > bring economies down.

The article doesn't show at all that there are diminishing returns from human labor. What we have, instead, is that even if technology is making labor ever more productive, these gains in productivity are going more and more towards companies and investors (mostly thanks to the competition from Chinese laborers) instead of (western) non-elite workers. Just look at the big fat profits of most big companies.

The article is thought provoking, but as it usually happens when trying to find a simple explanation to complex phenomena, it doesn't stand to deeper scrutiny.

<comment><USER13> _[...] these gains in productivity are going more and more towards companies and investors (mostly thanks to the competition from Chinese laborers) instead of (western) non-elite workers._

This seems illogic to me - if you have to compete with cheap labour you have to cut your costs in one way or another, pay less to your work force, make them more efficient, accept smaller profits or what have you. Putting more money - in absolute terms - into the pockets of the capitalists only makes it harder for you to remain competitive. Therefore I could at best see that capitalists receive a larger share of the cake in relative terms but not in absolute terms due to competition with cheap labour.

<comment><USER12> It's not the "capitalists" that have to compete with cheap labour, it's the labourers. Big brands can move their production where cheap labour is, keep their prices up, and pocket higher profits. This won't work forever, but it works for now.

</comment></comment></comment></comment><comment><USER14> So is Saudi Arabia going to (also) become a terrorist factory once they have to cut all the massive handouts they do and implement heavy austerity?

I mean the amount of income in the middle-east is going to severely drop over the next few years - the wealthy won't be affected, just annoyed but the people who have to work for a living are going to be out of jobs, starving and homeless and extreme belief systems often jump in to fill that void.

<comment><USER15> "become"?

<comment><USER14> Well it's been pretty quiet from there since 9/11

I mean the USA made more than 15 domestic terrorists since 9/11

I'm just wondering what happens when the comfortable over there have to give up their luxuries - do they take it in stride or does their belief system go to extremes to compensate?

<comment><USER16> It's quiet, mostly, in North America. If you're in the Levant, on the other hand

</comment></comment></comment></comment><comment><USER17> How much oil can be stored by producers, and for how long? If you run an operation that gets oil out of the ground at $50, you wouldn't want to sell at $30 (you wouldn't want to take it up at all, but likely need to keep your machines running). Are there producers that sit on lots of oil now, hoping to sell at a higher price, maybe years from now?

<comment><USER18> Speculating on oil price happens mostly on paper (derivatives and other contracts). It is cheaper than paying for its storage. You can also of course stop pumping if you're fine with getting less oil out of the ground this year.

<comment><USER19> > Speculating on oil price happens mostly on paper (derivatives and other > contracts). It is cheaper than paying for its storage.

Speculating using futures is the (roughly) the same marginal cost as speculating by storing it in tankers and storage depots.

Otherwise there would be an arbitrage opportunity where you could empty your tanks today, save the storage costs, and get the same quantity back x months in the future.

</comment></comment></comment><comment><USER20> Anyone who knows this stuff care to explain what the consequences of this are likely to be?

<comment><USER17> Domestic political turmoil in the countries whose budget depend largely on the oil price: See e.g. election upset in Venezuela, Russia aggressive in middle east potentially to overshadow news of worsened economy at home, Turmoil in Nigeria etc).

Internationally it means states like Russia won't have the same economical and political clout they had at $100+, so instead will rely on other means to throw their weight around, such as military threat.

Economically it's good: lots of the saved money ends up in the hands of consumers.

Environmentally, it's less good of course. Alternative energy will be less attractive in the near future.

So it's not all rosy, but the downsides are mainly due to a _falling_ oil price, rather than a low one. The volatility upsets budgets, which causes problems.

<comment><USER21> Economically not all good.

Oil companies depending on higher prices (most of them), will start having to reduce number on employees, or, worst case, go bankrupt and take financial institutions with them (because of debt).

<comment><USER17> As with anything there are winners and losers. Most companies are not oil companies, most people are oil consumers and not employed by oil companies. The "mostly good" here is of course for an average company (oil buyer) or average consumer (employed by a non-oil company, and an oil buyer), or even an average country (net oil importer).

</comment></comment></comment></comment><comment><USER22> Yukon XL Denali here I come! Seriously though, I thought Saudi and worldwide peak oil was in 2005. Is that a myth or are prices not really constrained by supply until way past the peak?

<comment><USER23> This is speculation on my part, but I would think that the threat to the oil producers is not that they may run out of the stuff in 100 years...rather, it's that oil may become obsolete before then (because alternative energy). At $30/barrel, it puts tremendous pressure on electric cars, solar, wind, etc. At $100+/barrel, they were creating a major incentive for the alternatives to thrive.

I'd like to hear about this from anyone more qualified than me (which would really be anyone).

<comment><USER24> I think we're going to see prices cycle like this for at least a few more swings. If there were no speculators in the oil markets you might see slightly more stable prices but there's a tremendous amount of speculation which adds to the price swings, which make the underlying activities more severe.

It takes anywhere from a couple of months to a couple of years to go from "acquired mineral rights" to "pumping oil out of the ground" which you can then sell. It also costs a lot of money. On the order of multiple tens of thousands per day on land and multiple hundreds of thousands per day at sea.

So when prices are up people are expanding and drilling and going gangbusters. When prices are down people are trying to figure out how to cut costs and ride it out. During high prices there tends to be "over" investment and during low prices, "under" investment, both relative to the average investment over say a 5-10 year period. Maybe by a lot.

As you mentioned one of the dynamics is that during low price periods alternative energy is a fool's errand and during high price periods it's genius. During average prices it'll slowly make more and more sense as the average price continues to slowly rise.

But it's far better in some ways to instead of making the average price on an average day to some times make a lot and some times make a little by letting the price vary wildly. Price instability makes alternative energy investing chaotic and unappealing to big institutional investors who might plow substantial money in. Better to wait until the chop settles down and it looks good over a 10+ year timeframe.

So if you get to make the average price on average and destabilize your competitors by letting the price wander all over, what's the downside? As long as you have the money to ride out the low price periods, none!

I don't know when this interesting ride will come to an end, but supply/price management is going to continue to be very important to people with a lot of oil left in the ground.

<comment><USER25> Shouldn't intelligent speculators drive down the price swings? If there are going to be price swings, shouldn't speculators make money by issuing futures and options, thereby decreasing the eventual swings?

<comment><USER24> The big oil companies do a fair amount of this I'm sure, but do you really want to bet a few billion as to exactly how much oil will cost in 2-6 years?

The US consumes 20 million barrels a day, so at current prices that's $600 million a day at $30/bbl and $2 billion a day at $100/bbl. How much do you think you'd have to buy or sell in the futures market to move the price to smooth it out?

Finally, it's very, very hard to know what's short term volatility and what's long term structural. Everyone "knew" that oil prices were going to be high forever because of peak oil and declining production. Turns out, maybe not.

</comment></comment></comment></comment></comment><comment><USER26> It's all about dollar strength and currency pegs/stability. Oil exporting countries need to continue to export as much oil as possible to acquire the dollars needed to (try to) maintain a peg or the stability of their currency. Or they can devalue and risk social instability once domestic inflation rises.

<comment><USER27> Supply and demand are more fundamental - the revenue needs of exporting countries prevent reduction of supply, while economic weakness around the world reduces demand. That weakness also strengthens the dollar, increasing the supply available for a given dollar amount. The cascading effect of speculators exiting the falling market further reduces demand.

</comment></comment><comment><USER10> Dumb question but I feel like an actual empty barrel costs more than $30. Or is the barrel not included in the price?

<comment><USER28> I think "barrel" has become a unit of measure. Much of the oil runs through pipelines, to tankers, transported and offloaded to refineries.

It wouldn't surprise me if 90% of all oil was never in an actual barrel, but even if so, I would imagine the barrels are reused, and so not factored in the price.

</comment></comment><comment><USER29> is the fact that it's dropping below $30 right now mean that the previous $100+ prices were completely inflated compared to COGS? The massive fluctuations for something that you just need to pump out of the ground doesn't make too much sense to me (compared to, say, price of potatoes)

<comment><USER30> Yes, a barrel of oil brought up by fracking costs around $62 (Canadian oil sands cost $74) per barrel(according to NPR below). Though that is total cost, marginal cost of pumping after you drill and frack the well is around $35.

Oil demand tends to be fairly inelastic. Almost all of oil pricing is supply driven. OPEC decides on a target price and produces to meet that price. The current price has happened because Saudi usually stops producing to keep prices stable and high, and for now they just haven't slowed down at all. Either they need money badly enough that they will take any profit at all or they are using oil prices as a weapon.

[http://www.npr.org/2014/11/04/361204786/falling-oil- prices-m...](http://www.npr.org/2014/11/04/361204786/falling-oil-prices-make- fracking-less-lucrative)

<comment><USER31> I don't understand the "they need the money argument". They were producing 9 million barrels per day and that achieved a price of $100 per barrel... now they are producing 10.5 million barrels per day and price is <$30 per barrel.

<comment><USER32> If the future outlook for oil prices are lower than what they sell at today — it makes sense to produce as much as you can today.

</comment></comment></comment></comment><comment><USER33> It's worth pointing out that this is still before Iran comes online. Once that happens (possibly in a few days) prices could fall further.

<comment><USER34> There's also major political tensions with the Saudi's and Iran. Some have predicted that if a war were to break out oil would rush back to $100 per barrel. Also, Iran must first past nuclear inspections before they are able to lift the ban.

<comment><USER35> Which is pretty scary; that gives some already volatile countries _massive_ incentives to have a war. Humans are good enough at coming up with reasons on their own without paying them to do it.

</comment></comment></comment><comment><USER10> Would this be a good time for countries to build up strategic oil reserves?</comment>


New Update to the Microsoft Services Agreement - <AUTHOR> https://www.microsoft.com/en-us/servicesagreement/faq.aspx <comment><USER2> _When you share Your Content with other people, you understand that they may be able to, on a worldwide basis, use, save, record, reproduce, transmit, display (and on HealthVault delete) Your Content without compensating you. If you do not want others to have that ability, do not use the Services to share Your Content._

The wording is ambiguous, but it seems as if Microsoft is saying that they aren't responsible for other people stealing your copyrighted works or deleting(!) your health information. While that is technically true (i.e. you can't hold Facebook or Pinterest or Instagram liable if someone scrapes your public posts and resells the images/videos), the wording makes it sound like they are trying to discourage you from even using their services in the first place. It's a really odd way to get the point across; they could have done a much better job of it.

The HealthVault thing is particularly worrying; why call the service a "vault" if it can't prevent a third party from destroying the data?

<comment><USER3> I'll venture to guess that the healthvault difference might be for sharing information with a doctor or caretaker. Then at least there's the case of deleting incorrect information.

</comment></comment><comment><USER4> Anyone have a diff or analysis?

<comment><USER5> "Summary of Changes": [https://www.microsoft.com/en- us/servicesagreement/Updates.as...](https://www.microsoft.com/en- us/servicesagreement/Updates.aspx)

<comment><USER6> This would make a lot more sense to me to be the URL of this submission.</comment></comment></comment>


ZTE confirms backdoor in U.S. phone - <AUTHOR> http://www.reuters.com/article/2012/05/18/us-zte-phone-idUSBRE84H08J20120518 <comment><USER2> I feel that the word "backdoor" is incorrectly used here. ZTE confirmed a vulnerability discovered in the phone, not something they placed in the phone intentionally (backdoor).

<comment><USER3> How is a hardwired password to allow remote access a vulnerability rather than a backdoor?

<comment><USER4> Last analysis I saw, the access was not remote. It was a local root escalation; you need to have code running on the device before you can use it.

</comment></comment></comment><comment><USER5> Is that this: <http://news.ycombinator.com/item?id=3994054>

Because yeah, this has been known for a while...

<comment><USER6> Nope. Its this: <http://news.ycombinator.com/item?id=3968041> from several days before your link.

<comment><USER5> Right, that's what I was saying. The ZTE problem has specifically been known... so if that employee posted that SO post ("my" link)... he probably found out about it via Reddit/HN, thus posting "anonymously" would have been rather silly.

<comment><USER6> Oh I see your point now. I'm not sure I'd assume so, probably just coincidental timing. It would seem pretty silly/pointless for your link's OP to ask advice on a (by then) publicly known exploit after all.

</comment></comment></comment></comment><comment><USER7> Let's just say that, generally speaking, Russian and Chinese companies work very differently from those in USA. If their "CIA" shows up and wants something added, you either add it or you may be out of business...and that's if they're feeling generous. You can't exactly file a whistle blower lawsuit or go public with the info.</comment>


Anonymous Hunts Hunter Moore - <AUTHOR> http://betabeat.com/2012/12/anonymous-launches-ophunthunter-to-destroy-hunter-moore-and-his-revenge-porn-empire/

<comment><USER2> I find this amusing because I predicted that the whole address thing was just a publicity stunt:

<http://news.ycombinator.com/item?id=4848528>

This could be too. It sounds just a little too convenient for something to be getting this much media attention on its own.

</comment><comment><USER3> I find it amusing that the likes of Anonymous are going on about protecting people from abuse and whatnot when they've done some pretty questionable things themselves, especially some of their 4Chan members who have victimised completely innocent people all because they either got annoyed by someone or just didn't like them. I'm not sure if it was Anonymous that was involved in the whole 2009 Boxxy scandal, but it wouldn't surprise me.

While I think Hunter Moore is a sick twisted dude, I hardly see what publishing an already public address achieves here.

<comment><USER4> There isn't really any irony there; it's a direct consequence of the nature of Anonymous.

It's a mistake to attribute any sort of persistent ideology or identity to Anonymous, because Anonymous isn't really a persistent movement or organization. It's really just a label that people often choose to adopt when rallying together anonymously over the Internet. There's absolutely nothing stopping people from using the label for whatever hacktivist cause they want to advance. . . but there's also absolutely nothing stopping people from using it for whatever immature or antisocial behavior they want to get involved in.</comment></comment>


How Does Mastodon Work? - <AUTHOR> https://kevq.uk/how-does-mastodon-work/ <comment><USER2> > Well, finding the right one is very difficult

That sounds like a rather critical UX bug.

Just give me the instance I should sign up on in the "sign up" area of mastodon.social. Use what you think is the most suitable algorithm to cycle through a list of "appropriate" instances, where you-- the people with domain experience-- define "appropriate" for the potential user.

Otherwise you end up with this passive-aggressive situation where everybody does the obvious thing of signing up on mastodon.social, but your devs and fans take it on themselves to "teach" people _not_ to do that because federation.

Case in point: the very first step of signing up is described as "very difficult" in this newbie guide.

<comment><USER3> Would you say the same thing about e-mail and SMTP?

<comment><USER4> this. It doesn't matter one whit about the instance, except perhaps initially. Maybe. You choose who to read and follow and the instance doesn't matter. I already 'follow' about 80 like-minded geeks I'm interested to read each day and that's all I can keep up with. I never look at either the local timeline or the federated timeline: they are too much information; firehose. edit: and those 80-odd ppl are all over the planet on various instances in various languages.

<comment><USER5> > It doesn't matter one whit about the instance, except perhaps initially. > Maybe. You choose who to read and follow and the instance doesn't matter.

Not in my experience. Mastodon doesn't really have any (good) cross-instance discovery mechanisms aside from just watching the global fire-hose, so your initial experience is formed by the other users on your instance. And the experience varies wildly from "This instance is very quiet" to "This instance is full of furries".

<comment><USER6> sound just like email or twitter or facebook before everyone's parents were on it.

</comment></comment></comment></comment></comment><comment><AUTHOR> I wrote a companion piece that explains what makes Mastodon better than Twitter. It starts like this:

> Mastodon is a newcomer social media platform that is a lot like > Twitter—short messages, followers, hashtags, all that. But Mastodon is much > better than Twitter, and not just because being totally ad-free and keeping > chronological timelines make it far more enjoyable to use (though that > certainly helps!).

All that is nice, but the real advantage Mastodon has over Twitter is that Mastodon is not an outrage machine that's corroding our ability to view our politic opponents as real humans, deserving of sympathy and understanding.

To explain how much better Mastodon is, I'm going to give you three examples of how Mastodon is better, and then I'll step back and talk about why Mastodon is better.

[https://www.codesections.com/blog/mastodon-elevator- pitch/](https://www.codesections.com/blog/mastodon-elevator-pitch/)

<comment><USER7> Wouldn't a decentralized social network be more prone to delvelop more extremist groups? I mean if anyone can create an instance, then extremists from all the political spectrum will be able to moderate their own instances, in other words they will censor those who think differently and encourage their own views creating a loop that could potentially create more myopic- extremist views, or is there something I'm missing?

<comment><USER8> And won't the proponents say this is a feature as it keeps them off other instances?

<comment><USER9> And won't detractors say that this is how the mainstream media got the 2016 US presidential election predictions so wrong? [https://www.theatlantic.com/technology/archive/2017/10/what-...](https://www.theatlantic.com/technology/archive/2017/10/what- facebook-did/542502/)

<comment><USER10> Then perhaps people/corporations will learn that farming social networks to predict IRL intentions may not be the best use of their time and energy.

As far as I'm aware, "being an accurate source of voting intention" is not a prime requirement for social networks, nor is "making life easier for lazy journalists/pollsters". At least, not for any where the users are the customers. For those, where the users are the product, requirements might be different. Personally, I view this is a positive for Mastodon.

</comment></comment></comment></comment></comment><comment><USER11> The thing I never really see from these is about setting up on an existing instance vs running my own. And if I set up my own, does it need to be a community? Am I shutting myself out of an experience by creating, say, a Mastodon instance for my family?

I'm bought in to the idea of Mastodon, but getting started is like being handed an atlas of the US and being told, "Please pick a neighborhood to live in."

<comment><USER12> It's exactly like email. You can have an email server @yourdomain that just has the one account, and interact with the rest of the email "network" just fine, right? Same with Mastodon.

<comment><USER13> People discovery isn't necessary with email, but it is for a social networking system.

I want to be able to find other people in the fediverse, and I also want people to find me. Having your own server excludes you from other people's local timelines (and vice versa), making discovery in both directions very challenging.

</comment></comment></comment><comment><USER14> I wish the author had expanded on migration from one instance to another and what it entails (similar to the questions and responses here).

Another point I would've liked to see is on encryption and privacy — who, other than the people I choose as an audience, can see my Toots (the admins of the instances, someone sniffing the network, etc.).

If these platforms are being sold as "awesome", there need to be more reasons than just "no adverts and no tracking" (the latter claim is not provable without talking about encryption in a little more detail). No ads doesn't mean someone can't sell your information to someone else outside this platform. It's one thing that the owners/maintainers of many instances wouldn't sell information because of their own moral convictions that led them to get out of centralized, single company social networks. But asking to trust on that basis alone is not enough.

I checked out Mastodon quite sometime ago, but stopped using it after one or two Toots. Network effect — not knowing anyone else is a big barrier. On chat platforms, I could at least persuade one or two people I know to use them for direct chats, but these ar harder to deal with when you're looking for people who are not only local but also are working on similar causes as oneself. Like the author says, finding some interesting people on Mastodon and creating new connections could work, but it also depends on one's areas of interest. I personally also find Twitter very noisy (not in the sense of signal to noise ratio, but the amount of content). At least on Facebook I can join certain groups, avoid the news feed, etc. Somehow the topic wise discussion format seems suitable to me than a chat format (without some amount of conversation threading) with many users.

<comment><USER15> > I wish the author had expanded on migration from one instance to another and > what it entails (similar to the questions and responses here).

Account migration is not a thing yet, and conceptually requires a new namespace for referencing accounts (such as public keys). There is a multi- year-long actively-discussed open issue thread about this problem.

[https://github.com/tootsuite/mastodon/issues/177](https://github.com/tootsuite/mastodon/issues/177)

<comment><USER16> This should work like Domain <-> web Hosting type. So you can register your id at one place (similar to domain with any tld registrar) and change to another instance (web hosting). So you do not lose the need to change the id when changing instance.

<comment><USER17> This would lead to IDs being globally unique, which means if you have a common name you are unlikely to get a handle that you want. Secure scuttlebutt has a method to allow multiple people to share the same "public id" (multiple people may be named "Jill" for example) but preserves uniqueness by addressing individuals by a public key associated with their public name. I'm not sure how the mapping from public key to handle is done though.

</comment></comment></comment></comment><comment><USER18> Finally, a cogent explanation.

Edit: But missing a key issue, perhaps.

> Because Mastodon uses a collection of Instances, you're not at the beck and > call of one site owner. If you don't like the direction an Instance is > taking, you can pack your virtual bags and go. Mastodon even has an > import/export tool that allows you to migrate the people you follow from one > account/instance to another.

That sounds great. But if you do "pack your virtual bags and go", is there any way to map firstname.lastname@example.com to email@example.com? In the email analogy, there's clearly not. You need to tell all correspondents.

<comment><USER19> Some interesting discussion here:

[https://github.com/tootsuite/mastodon/issues/177](https://github.com/tootsuite/mastodon/issues/177)

It seems possible!

<comment><USER18> Yes, it seems that every user already has a private|public key pair. It's just that instances are apparently storing users' private keys. And that, for what it's worth, seems like a horrible idea.

But whatever, if users had control of their private keys, they could easily move. As long as routing depended on public key hash (as with Tor .onion sites) instead of user@instance. More of a web model, instead of an email model ;)

</comment></comment></comment><comment><USER20> Apologies for the vulgarity, but I am presuming someone has informed the initial design team that toot is slang for a fart (at least in England) - which leads to the phrase "a mastadon toot" being quite a double entendre.

How well ingrained is the name? Is it as commonly used in the community as a tweet in twitter? As in do the users identify the messages they send as toots, and are likely to say as such?

[https://www.urbandictionary.com/define.php?term=toots](https://www.urbandictionary.com/define.php?term=toots)

<comment><USER21> Is someone who uses Twitter a twit?

Silly names that mean things in different places don't seem to deter Americans (I'm a Brit but I've never heard the slang "toot" before; I guess it might be very regional)

<comment><USER20> I rather delicately confirmed with a few co-workers and they are aware of the usage, so it could be regional? They're rather reserved PHD kind of people (I'm not), but seemed to find it hysterical.

With regards to Twit, that's a great point - although in that instance it seemed like a more intentional slur, as I think I'd normally default to "tweeter".

Because it is a verb substitution it has this kind of wordbomb effect of corrupting every sentence it could be used in. Some examples!

-the latest release by the Jonas brothers made me so happy i just had to toot.

-these toots are a breath of fresh air.

-Welcome! Let's get you tooting!

For when Mastodon social gets it's first celebrity president:

-President Trump released another obnoxious toot in his seemingly never-ending tirade

and finally,

-I toot, therefore I am.

</comment></comment></comment><comment><USER22> I am really impressed by Mastodon all the efforts that the community is doing to explain the project and the decentralization to the "common people".

It's something that I'm doing for years now when trying to show how Movim works (it's a federated social platform based on XMPP, [https://movim.eu](https://movim.eu)). I always have difficulties when showing how a social platform can work in a decentralized (or in those two cases federated) way.

The path that I'm taking for Movim at the moment is to start from the emails (in Movim the accounts and platforms are decoupled, you can connect using the same account on different instances and clients) and apply it to a social network and chat service (Movim is mixing social network and chat platform in the same UI) but I see often that it's not "easy" when people are used to centralized solutions.

</comment><comment><USER23> Something unclear from the article

>You can also Favourite a Toot. Which basically means that you support or agree with a Toot.

Are favourites toots private? Can someone else view them? Are they automatically shown up in timelines (as liked tweets do).

Also, does favourite really imply agreement? To me atleast, I favourited tweets that I didn't agree with just because they pointed to a well constructed argument, or for future reference.

Since twitter changed terminology to like I've stopped doing that.

<comment><USER24> Favorites don't show up in any timeline other than your own favorite list. To my knowledge, others cannot see favorites but I might be wrong, I can't access my own instance atm due to a network filter.

The canonical way is to retweet (boost) a toot which shows up in the timeline of your followers and your profile (the boosted tweet will also show up on the federated timeline but not associated with you).

<comment><USER25> You can see the list of favourites just like you can on twitter

<comment><USER24> Ah yes then I remembered that wrong. Might be worth an issue opening on github :)

edit: Found this one: [https://github.com/tootsuite/mastodon/pull/7107](https://github.com/tootsuite/mastodon/pull/7107)

</comment></comment></comment></comment><comment><USER26> With the death of certain Twitter APIs coming up soon, I wonder if many Twitter client developers will start to make Mastodon apps. I would love to see "Tootbot" by the Tweetbot developers.

<comment><USER27> What Mastodon badly needs is a client that can crosspost to both Twitter and a Mastodon instance to lower the barrier to slowly switching.

<comment><USER28> There already is one on mobile: [https://github.com/TwidereProject/](https://github.com/TwidereProject/)

</comment></comment></comment><comment><USER29> How are email and ActivityPub different in spirit? If they are so similar, and often compared, then why not use the well-known email stack to build "federated" social/messaging apps? I think "not being gmail-compatible" was the core flaws of Google Wave.

</comment><comment><USER30> When you first start out someone gives you an email address. Your ISP, Your employer, Microsoft, Google (push)

When you first start out with Mastodon, you have to find a server on your own and hope it's not going to disappear on you in the distant future (pull)

The mainstream doesn't do pull. I haven't verified but I imagine sites such as Twitter didn't take off until they started pushing accounts through advertising and word of mouth suggestion (upload your contacts, invite your friends!). Facebook pushed accounts on people in by limiting who could sign up until a certain demand threshold was reached so that when the next wave of potential users look at it, they have an account pushed on them by peer pressure as their friends were already there

Leave the decentralised aspects to us nerds. To get it properly going you're gonna need a way to push accounts on people

</comment><comment><USER31> Is there a straightforward way to change Instances without losing connections with other users?

Does it make more sense to host your own, so that you'll always be @firstname.lastname@example.com ?

<comment><USER32> You can export/import the list of users you follow, but the people who follow you will have to re-follow you manually

</comment></comment><comment><USER33> From the article: "To my surprise, I couldn't find a decent guide anywhere"

How often open source projects shoot themselves in the foot this way. They come up with something marvelous that many ordinary users would love to use. But then they fail to make a friendly UI and write good user docs, so few people adopt it.

One example I struggled with is gpg. I wanted to use it, but found the user docs confusing. So I thought of helping improve them so it would be more widely adopted. So I dug into how it works, but I discovered it was so inherently hard to use that few would ever adopt it, no matter how good the user docs were, and so I just gave up.

One thing that is going to determine whether web decentralization succeeds and rescues us from Facebook et al is whether or not the developers can come up with user friendly software. One thing that means is that it is quite possible that a piece of decentralization software that is far from optimal will take over a segment simply because it is easier to use that others that are much superior.

</comment><comment><USER34> I found a survey about Mastodon:

[https://medium.com/@cassolotl/a-mastodon-survey- ac74948765c7](https://medium.com/@cassolotl/a-mastodon-survey-ac74948765c7)

It says the main reason for not joining / abandoning is lack of friends. And also hard to use which doesn't help pulling in more people, so no friends, then a downward spiral.

Is there a way out?

<comment><USER35> I feel like a simple plugin that pulled in your public Twitter friends usernames and offered to follow anyone with the same username @mastodon.social would really help here.

Pretty hard for Twitter to stop it if it were a client that scraped the list too.

<comment><USER36> It exists. [https://bridge.joinmastodon.org/](https://bridge.joinmastodon.org/)

<comment><USER35> Thanks, I'll have a play with this.

</comment></comment></comment></comment><comment><USER37> It isn't clear from the article - does Mastodon have the equivalent of Twitter lists in which I can group sets of handles into separate timelines that I can follow independently/parallelly?

The one timeline thing doesn't work for me too well... I prefer a few separate parallel timelines and tweetdeck is great to organize and follow such parallel timelines.

<comment><USER38> You can create multiple named lists and you can add people you follow to them.

I mostly post publicly, but I used this feature to create a list of friends who live in Japan.

<comment><USER37> Looks like it has everything that I wanted. Thank you.

</comment></comment></comment><comment><USER39> > If we use our email analogy; think of Mastodon as email as a whole.

Shouldn't that be ActivityPub instead of Mastodon?

</comment><comment><USER40> > This is by design so that a person's Toot is only Boosted in a way that gets > the message they intended across.

Seems like a bad design decision trying to force people to use the platform in an unnatural way. They will just take screenshots and add their own comments instead, making the "retoots with comments" inferior to what it could be with native comments.

<comment><USER41> Whether it's bad design or not this is one of the aspects of Mastodon that appeals to me the most. The friction is just enough to stop the context collapse that plagues Twitter

<comment><USER42> Right. I'm also a fan of friction any time I hear an argument that "well, [bad behavior] is inevitable, so you may as well purposely include it and design it to be easy to do!"

We've seen that design can shape behavior in profound ways, and we have no obligation whatsoever to follow pressure toward a lowest common denominator if we think there are better designs that consciously resist that pressure.

<comment><USER36> Yep. I don't think it's coincidence that Twitter's slide started right around when they started giving you notifications for likes/retweets of retweets and replies when before it was only for your own posts. Then it got worse with quote tweeting.

</comment></comment></comment></comment><comment><USER43> I hope Mastodon will develop into a real twitter alternative one day. Currently it's rather "empty"

If anyone is intersted in a German round-up of Mastodon: [https://www.achtungtechnik.de/archives/2018/mastodon/](https://www.achtungtechnik.de/archives/2018/mastodon/)

</comment><comment><USER44> The idea seems very interesting to me, but I have to ask, people talk a lot about the social aspect and how I can follow people, this honestly doesn't interest me at all, what I'm interested at is aggregation, could I actually replace say twitter and my RSS reader with self-hosted Mastodon instance?

</comment><comment><USER45> I'm not sure if this will be relevant to its longer-term success, but I notice that the word "Mastodon" seems to be very easy to misspell -- In the comments here alone I already find "Mastadon", "Mastadoon", etc.

<comment><USER46> I am curious why they have misspelled the Mastodon? In many languages it is written and spelled in the same way. I am not native speaker but I would pronounce mastadon and mastodon in the same way (ˈmæstədɑn), but hardly I can imagine to write down as mastadon.

> First attested 1813, from the New Latin genus name Mastodon (1806), coined > by French naturalist Georges Cuvier, from Ancient Greek μαστός (mastós, > "breast") + ὀδούς (odoús, "tooth"), from the similarity of the mammilloid > projections on the crowns of the extinct mammal's molars.

[https://en.wiktionary.org/wiki/mastodon](https://en.wiktionary.org/wiki/mastodon)

<comment><USER47> In the US at least people spell based on how words sound in their head if they don't really remember the correct way to spell it.

No one is thinking about the history of the word, in fact I personally was wondering why they chose an elephant as their mascot until I remembered what a Mastodon was.

</comment></comment></comment><comment><USER48> How does it deal with spam?

<comment> brian-armstrong Nobody wants to use it, so the ROI for spam is very low. This keeps spam to a minimum.

<comment><USER49> Moral of the story: use Mastodon, but keep it unpopular?

<comment><USER50> Worked for Usenet from 1979 until 1993.

</comment></comment></comment></comment><comment><USER51> I joined a server. It was alright. Then I looked at the federated timeline and decided I did not wish to be a part of Mastadon.

Too much hate and virtue signalling. It was like what Twitter already was.

<comment><USER52> I don't understand this. The Federated timeline is always going to be full of the same kind of crap that Twitter (and other social media) has. The whole point of Mastodon is that you can avoid that by joining an instance that matches your interests, and then only look at your notifications and the local timeline.

By doing that you can see only things said by, or boosted by, people who you have chosen to associate with. Then you get most of the benefits of social media without getting the crap from the uncontrolled firehose.

But sure, if you want it to be like Twitter, and then reject it because your experience is like Twitter, then by all means. I just don't understand your reaction.

<comment><USER53> Can you join multiple "local" timelines? Ie, lets say you join an OSS dev focused federation and you like it. Down the line, it grows and becomes less HN, more Reddit. Okay, you say to yourself, time to move to the next HN-like you find. So you do that, but it's small, and feels dead.

Seeing feeds from both the old, somewhat bad and the new, better but still too small would ease migration woes. Is that possible?

<comment><USER52> You can start a new account on a new instance, watch the old account on the old instance, see which people are still worth following, then follow them from the new instance account. I've done that and it worked a treat. You can also export the list of people you follow and import that into the new instance, then unfollow anyone who says stupid things.

My experience is that all platforms reward putting in a small amount of effort to curate those I follow and engage with. Unless you do that you end up with the shower of complete crap hiding the nuggets worth having. With a comparatively small amount of effort you can get a high-quality stream with very little crap, and then you can block or filter that.

</comment></comment></comment></comment><comment><USER54> I really wish I could join several instances with the same account. This is a feature currently missing, but someone told me they're working on it.

Go mastodon, go !

<comment><USER52> You can just join the instances using the same handle. Then from each in turn export the people you follow and import that into each of the others. Now each of your accounts follows the same collection of people.

Then on each instance cull those you don't want to follow _on this instance._ Now each account has the flavour of the instance you're on.

You can do all that now, although it requires a little work.

</comment></comment><comment><USER39> Would Mastodon be a useful platform to, collaboratively, define the requirements of software?

Perhaps it could be used to define the next iteration of Mastodon, then.

</comment><comment><USER55> I understand HOW mastodon works. I've got my account. But I still don't understand WHY.

I got into twitter and facebook when I was a university student who gave a crap about broadcasting myself to the world. Now I'm old and don't care anymore, and I'm not deluded enough to think that anyone else cares. Is there a use case that goes beyond teenagers chatting at the lockers?

<comment><AUTHOR> You clearly see value in HackerNews—my use case for Mastodon isn't that different from my use case for HN.

My instance (https:/fosstodon.org) is mostly focused on free and open source software (hence the name). Conversations there tend to be a lot like conversations on HN, but with the benifit of a local community where you get to know the regulars.

(I'm not saying that there's _no_ purely personal talk—but think "office water cooler" not "high school lockers")

<comment><USER17> Just a friendly heads up, I'm getting a certificate error on your site (cert expired 30 April).

<comment><AUTHOR> Thanks! That was because I put the wrong link; fixed now.

(And it's _my_ instance only in the "my country" sense—I'm a user there, but I don't run it or anything.)

<comment><USER44> You missed a slash, the link doesn't work.

</comment></comment></comment></comment></comment><comment><USER56> so how do i ban russian trolls on a federated p2p social network...?

<comment><USER57> The same way you would ban Swedish trolls on Twitter.

Fun and russiophobia aside, there is an article by Eugen Rochko (maintainer of mastodon) somewhat covering that topic:

[https://medium.com/tootsuite/learning-from-twitters- mistakes...](https://medium.com/tootsuite/learning-from-twitters- mistakes-c272d67bba76)

AFAIK they also utilize crowdsourced block lists to automate part of the sorting in the fediverse.

</comment></comment><comment><USER58> "badly"

</comment><comment><USER59> >Being open source gives us the reassurance that our data is not being harvested, or that we're not being spied on.

A false sense of reassurance.

</comment><comment><USER60> I got banned from mastodon.social with no explanation or warning. Given that this is the "official" instance I remain sceptical to whether this is a project worth engaging in.

</comment><comment><USER61> The failure to mention GNU Social, which Mastodon is almost completely based upon and which birthed the Fediverse, is just weird.

<comment><USER62> Mastodon is not based on GNU Social in any way other than they both used the OStatus protocol. Before ActivityPub became the norm.

GNU Social is made in PHP and Mastodon is made with Ruby and NodeJS. So two wildly different implementations.

Mastodon also looked more modern and followed more so called modern developing practices. Which is why I think it caught on more than GNU Social ever did.

<comment><USER36> The kindness, quality, and eagerness to help is a big part of what propelled Mastodon. You'd log in, make your first toot, and have a pile of people welcoming you from the federated or local timeline. Same with beginner questions.

I tried GNU Social a long time ago, but it was mostly technical people talking about technical stuff. Great if that's what you're into, but it's no basis for a general use social network. Niche networks are fine, but I don't get the impression that's what early federated social media proponents wanted.</comment></comment></comment>


Look At Me! - <AUTHOR> http://www.cjr.org/cover_story/look_at_me.php?page=all

<comment><USER2> "preeminent patron saint of pre-adolescent sartorial taste"

Now THAT is good writing.</comment>


Stop Worrying and Learn to Love Making your Employees' Lives Awesome - <AUTHOR> http://www.dimagi.com/dimagi-in-brazil-or-why-you-should-stop-worrying-and-learn-to-love-making-your-employees-lives-awesome/

<comment><USER2> I liked this idea, but it's also very obvious that this must be quite a young company, with an employee base that's also mostly quite young.

After all, the window of time between when you enter the workplace and when you start having the kinds of ties that prevent you from dropping everything and going somewhere with your company for a month isn't -- for most people -- a very large slice of their working career.

I personally would love to go to Brazil for a month, but going with my co- workers instead of my wife and young daughter would be unthinkable.

This isn't a criticism, though. As the company grows & matures, and the employees do as well -- since they're interested in keeping employees "for the long haul", the collective ages of the bulk of the employees would advance largely in synch -- then the creative ideas should simply take different forms.

I do think they should consider carefully who is forced to sit out, though -- and avoid doing things where it's always the same people who can't come. This is company money being used to reward employees. If it only rewards some of them, due to factors quite probably out of the employees' control, that's simply unfair. Maybe offer the option for employees who can't participate to simply get an equivalent bonus?

<comment><AUTHOR> We are a young company. In the previous blogs we talk a bit about the factors that made doing the experiment possible including that one.

One clarification on your last point: the company didn't actually fund any of this (except for travel insurance for everyone). All the employees who chose to go paid their own way. This was what made it virtually 0 cost for us, and one of the reasons why some chose to stay behind. Families and significant others were another reason.</comment></comment>


Interviewing programmers: coding test example explained - <AUTHOR> http://www.solipsys.co.uk/Writings/TestsForProgrammers_Part_2.html?HN <comment><USER2> Am I OCD when I cringe when I see 'p_rite' where he (I think) means 'p_write'? That alone would knock a few points off a candidate doing this test when he's interviewing with me. 'rite' can mean 'write' or 'right' or even 'allright' - why the unnecessary confusion?

<comment><USER3> I think he used p_rite so that the variable names length is identical to p_read, which can make the code look more pretty.

<comment><USER4> In that case, I'd suggest `p_rd` (well, IMO, just `rd` would suffice) and `p_wr`. Then they're both fairly unambiguous abbreviations.

<comment><USER5> I think p_wt is better than p_wr. Honestly though, aligning the length of variable names is, in my humble opinion, retarded - he should have went for p_read and p_write.

<comment><USER6> "aligning the length of variable names is, in my humble opinion, retarded"

I feel the same way.

</comment></comment></comment></comment></comment><comment><USER7> So, I've never been involved in hiring, so I have no perspective on the state of the job market.

However, I have trouble believing that anyone who would be willing to rep themselves as a "C Developer" couldn't write this particular piece of code in a manner similar to the author's solution in a matter of minutes.

Do these FizzBuzz articles keep getting promoted to the front page to boost everyone's collective egos, or is the job market really this pitiful? Can someone who has been involved in hiring recently comment with some anecdotal evidence as to what they've seen?

<comment><USER8> The problem isn't the job market --- although it is pitiful, and it is dreadfully hard to hire talented developers, particularly in C.

The problem is that the hiring process is necessarily ineffective. You have a very short period of time to come to a sweeping conclusion about the entirety of someone's capabilities. Dev interviewers do a notoriously crappy job at this.

The specific problem "FizzBuzz" tests solve is this: candidates who can _talk_ about development (including people who know that the difference between otherwise equivalent for() and while() statements is whether the increment runs when you hit a "continue"), but who, when asked to sit down and code something, fumble horribly.

These people, all of whom are smart and extremely knowledgeable about software development, have not developed the real world programming survival skill of being able to sit down and _just code_ when they need to. Most development shops want to avoid these people. Hence: a test that isolates specifically your ability to _just start coding_ , apart from any domain knowledge or computer science.

<comment><USER9> This seems a little silly, or perhaps just overly optimistic. If I have a lot of real computer science knowledge and understanding, I should be able to get an entry-level software development job (assuming there are enough or close to enough to go around). I don't think this particular problem is too unrealistic to expect a CS graduate with zero experience to get right, but I think it's unrealistic for an employer to expect entry-level applicants to know a whole lot about how enterprise development works. That's why they have training (fairly well-structured and comprehensive training, from what I've read) for new hirees.

<comment><USER8> The exercise has very little to do with experience or knowledge. Think of it as a sort of personality test. It isn't, but it helps to think of it that way.

</comment></comment></comment></comment><comment><USER4> I wonder if I'm alone in thinking that the original `while` version is easier to read and understand than the ending `for` version.

I've never quite understood C programmers' love of the `for` loop. It's just a `while` loop with the different parts stuck in different places (`init; while (cond) { ...; inc; }` is the same as `for(init; cond; inc) { ...; }`) and it doesn't (at least for me) result in any greater clarity or ease in reasoning.

<comment><USER10> I think for loops are better than while loops for looping over arrays. I'll try and explain my reasoning:

Whenever you see a `for` loop, it tells you something that a `while` loop doesn't. It tells you the _kind_ of loop you're about to do.

A `for` (usually) means you're going to be looping over an array, with a specific length, with a specific "step" (usually one). This is information you immediately get by seeing a `for`.

Moreover, you get all the information about how the loop looks (what you're looping over, size of the array, other actions you intend to perform in the loop) all in one place. This especially helps when you're looking at a large piece of code, in which case your example of "while (cond) {...;inc;}" would have a lot of lines between the condition and the increment.

<comment><USER4> > I think for loops are better than while loops for looping over arrays. I'll > try and explain my reasoning: > Whenever you see a `for` loop, it tells you > something that a `while` loop doesn't. It tells you the kind of loop you're > about to do.

I won't disagree with that in theory, but I don't really think the "for" loop is the solution. The _real_ solution, I think, is a "foreach" construct (whether it's a loop built into the language (á la Java/C#) or a higher-order function (á la C++'s std::for_each), I don't really care) for iterating over arrays and other collections.

In practice, I think the for loop is too often abused for too little gain, and I think C would be a better language without it.

As an aside, I wonder if anyone has provided a suitable Hoare triple for C's for loop. I have an idea of what it would look like, but would love to see someone else's efforts to verify my own internalized one.

<comment><USER11> > I wonder if anyone has provided a suitable Hoare triple for C's for loop.

Basically the same as for a while loop, as given e.g. at <http://en.wikipedia.org/wiki/Hoare_logic> since (apart from the behaviour of continue)

      for (inits; cond; steps) { body }

and

      inits;
      while (cond) { body; steps }

are equivalent. And if you _do_ want to deal with continue (and presumably also break) the Hoare stuff gets awfully cumbersome; you're probably better off using informal correctness proofs and writing down a lot of loop invariants.

Oh, all right, here's how you do it. Suppose you have the following three Hoare triples.

      {P & Q0 & !cond}
      body; steps
      {P & body never invoked break or continue}

      {P & Q1 & !cond}
      body
      {P & body invoked continue}

      {P & Q2 & !cond}
      body
      {R & body invoked break}

where Q0, Q1, Q2 are mutually exhaustive (but not necessarily mutually exclusive). And suppose you have

      {P0}
      inits;
      {P}

Then you have

      {P0}
      for (inits; cond; steps) body
      {R | (P & !cond)}

That's if you adopt the convention that any precondition is valid for code that doesn't terminate. Otherwise, you need to do some stuff with loop variants.

      for (char * rd=str; *rd; ++rd) {
        if (*rd != remove) *str++ = *rd;
      }
      *str = '\0';

We can take

P0: str points to a zero-terminated string. P: so does rd, rd and str point to tails of the original string, rd >= str, and what's between original_str and str consists of an appropriately crunched version of what was originally between original_str and rd. Q0,Q1,Q2: true,false,false. R: not needed.

We deduce that at the end of the for loop, rd points to a tail of the original string (P), it also points to a zero character (!cond), hence it points to the end of the original string. Hence what's between original_str and str consists of an appropriately crunched version of the entire original string. Hence all we need do is put on the final zero character, and we're finished.

<comment><AUTHOR> You should write that up as a proper tutorial - I'm pretty sure a few people here would find it interesting.

<comment><USER12> Should I be concerned that I've never encountered these Hoare Triples before in my life?

</comment></comment></comment></comment></comment></comment><comment><USER13> I'm sure RiderOfGiraffes doesn't want a third entry from me at this point, so I figure I might as well just post it here:

      #define C	char
      #define F	for
      #define R	condense_by_removing
      #define V	void

      V R(C*A,C B){F(C*J=A;*J=*A++;J+=*J!=B);}

or without #defines:

      void condense_by_removing(char*A,char B){for(char*J=A;*J=*A++;J+=*J!=B);}

<comment> loup-vaillant Here is the same code, without syntactic obfuscation:

      void condense_by_removing(char* s, char c)
      {
        char* d = s;
        while (*d = *s++)
          d += *d != c;
      }

I would have sworn I found a bug. There is none. Brilliant.

Now, I wonder if we could further optimize it. For instance by accessing memory several bytes at a time, in a fashion similar to strcmp().

<comment><USER13> Optimizing for performance, sure. But I was trying to optimize for character count. :-)

<comment> loup-vaillant Yes, but in doing so, you traded a memory write for a branch. And memory accesses are linear, so that's likely faster than the cannon. So surely we could go further? That's how I got the idea.

<comment><USER14> Many compilers will implement

          d += *d != c;

with a branch, and depending on the data pattern the branch predictor will be bamboozled. The branchless version would involve a pair of subtractions and some bit banging.

<comment> loup-vaillant Gasp! I thought it would be easy to just transfer the compare flag to a general purpose register. I suppose x86 doesn't have such an instruction?

<comment><USER14> I lied! A quick test shows that GCC uses the x86 SETE instruction (set register on condition equal). Cool.

However, code like this:

        if (x == 14) {
            y = 10;
        } else {
            y = 20;
        }

uses branches, although I think x86-64 has conditional load instructions.

</comment></comment></comment></comment></comment></comment></comment><comment><USER15> I haven't touched C in quite a number of years, so I was happy I got something working in pretty quick order that matched my initial brain-boarded algorithm. Years of Java apparently can't wash away C.

As in the article, I started simple and condensed to the version that I actually submitted. In hindsight, I wonder if that is the best approach when answering an interview question via email. In person, there's obvious benefit to walking through optimization (of all sorts, including visual), but if all the other party sees is the final version, they lose out on that demonstration of the process. If you were to receive just the more condensed version from an interviewee, would that be a benefit or detriment to the person? Does it make sense to send an analysis, or is that just risking overwhelming the interviewer?

I've asked for non-specific code samples in interviews before and that did serve to weed out an applicant once, but only because they sent on very easily searched for code (public API example code from a big developer). Asking for any sort of code example or coding example from an interviewer who isn't in the room always introduces the opportunity for cheating. Getting an analysis (I started here and ended up here) would probably help assuage my suspicions.

</comment><comment><USER13> So when do we get to read part 3? I want to see what "creative" solutions people came up with.

<comment><AUTHOR> Currently working on that. It's safe to say that your two solutions were the most creative. In my graph of solution proximity, they are both a long way away from all the other solutions.

<comment><USER13> Awww. I was hoping that with an audience of hackers and such a trivial problem I wouldn't be alone in my creativity. :-/

<comment><USER16> If you want 'creative' solutions to problems you might want to check out google code jam archives. During the qualifications this year someone wrote a solution in lolcode. Was quite interesting.

</comment></comment></comment></comment><comment><USER17> I got this exact same question in a Google on-site interview. It was one of those warm-ups :)

It does require someone to think like a C programmer: handling buffers directly, in-place modification and using NULL terminators to end strings that may have memory allocated beyond the NULL. I think it's a great question, but I don't know how well it would go over with CS undergrad students coming out with a Java only background.

Should I look for an equivalent simplistic Java question or stick to the guns and require candidates to know C? (I know the answer for my own team, but curious on others thoughts)

</comment><comment><USER18> hmm, is it normal to assume all strings in C are \0 terminated? What are the memory usage implications for that?

I won't pretend to know C but suppose you have a string that is 'ab{100}\0' and you wanted to remove all of the bs, you'd end up with 'a\0b{99}\0' in memory correct?

<comment><AUTHOR> C works at a very low level. You have lumps of memory, and you can put stuff in it. By convention a "string" is actually a lump of memory with chars in it, and the end is indicated by a '\0'. The lump stays the same size and doesn't need tidying.

This is the source of the notorious "fgets" bug/hack/exploit.

This is not the time or place for a tutorial on C strings and memory management, but suffice to say that some people find it horrible, some people find it easy and obvious. It stems from C being a sort of macro-assembler with a simplistic type system glued on top of it.

ADDED IN EDIT: I don't know why you got down-voted - it's a reasonable question from someone who hasn't done C. I've up-voted you to get you back to "1".

<comment><USER8> fgets() bug/hack/exploit? You mean gets(), right?

<comment><AUTHOR> Er, probably. Brain fried, too much multi-tasking. Sorry.

</comment></comment></comment></comment><comment><USER19> Interesting, when I solved the problem originally on my own, I got to the exact same solution just with different variable names and braces. I suspect that this is probably the most common way to solve it.

<comment><USER20> Yeah, I had almost exactly the same code. I'm sure most people did too. The only other "obvious" algorithm is the n^2 one.

<comment><AUTHOR> You will be surprised.

<comment><USER20> I like surprises! Looking forward to part 3...

</comment></comment></comment></comment><comment><USER21> I always end up using perl when I have to do string manipulations and have let my c skills suffer as a result. Sad. Using perl regexp kills brain cells.

#!/usr/bin/perl

$in = <STDIN>;

$remove = <STDIN>;

chomp ($remove);

chomp ($in);

$in =~ s/$remove//g;

<comment><USER22> Bad boy!

        >hello|goodbye
        >|
        >>Result is 'hello|goodbye'

        >That's a nice dog you have there.
        >.
        >>Result is ''

I usually handle this with:

        my $pattern = '\\'.substr($in,0,1);
        $in =~ s/$pattern//g;

but it still doesn't feel safe. String operations in perl _usually_ do what you want, but be careful with them!

<comment><USER23>
         perl -pe'BEGIN { $x = quotemeta(shift) } s/$x//g;'

should do what you want. `quotemeta' is the function that does the escaping for your properly.

I was hoping to be able to use tr///, since it seems like it was built for this, but it creates its conversion tables at compile time, so there's no chance to interpolate the argument without some nasty nasty eval'ing.

<comment><USER22> Yeah, tr was my instinct as well.. Thanks for quotemeta, it helps with something I'm working on right now!

</comment></comment></comment></comment><comment><USER24> With regards to your trivia question, where you talking about <http://decode.org/?q=pbagvahr>?

<comment><AUTHOR> If I understand you correctly, yes.

</comment></comment><comment><USER25> I have hired (and fired) a lot of software developers and cannot stress enough the importance of having candidates write code up-front. Having made poor hiring decisions myself by not doing this well and having "inherited" team members who whose coding skills left something to be desired, I would argue that few things are as crippling to an organization as bad programmers. Someone can be the nicest person ever, but if they don't write code well - they will cost you in time, money, and unnecessary technical debt.

I don't agree that FizzBuzz tests are the ways to screen developers though. These types of questions may give insight into IQ but I've seen really bright people be really sloppy coders. The way the problem is solved is just as important as getting the problem right and making it fast. If it isn't readable, you better hope that person does not get hit by a bus because if you need to modify it later, you're in trouble.

</comment><comment><USER26> Interesting. I didn't try to do the assignment when I read the first part, but just tried it now before looking at the second part. When I started to write the main loop, I felt uneasy when I realized I'd be doing unnecessary copying in the common case when char_to_remove is never found. My code ended up a tad more complex than yours due to desire to avoid that:

      void condense_by_removing(char *z_terminated, char char_to_remove) {
        char *p = z_terminated;
        for (; *z_terminated != 0; ++z_terminated) {
          if (*z_terminated != char_to_remove) {
            if (z_terminated != p) *p = *z_terminated;
            p++;
          }
         }
         if (*p != 0) *p = 0;
      }

<comment><USER5> This is what I came up with, but I'm not a C programmer.

      void condense_by_removing(char* z_terminated, char char_to_remove) {
        int index;
        int write = 0;
        for (index = 0; z_terminated[index]; ++index) {
          if (z_terminated[index + write] == char_to_remove) {
            ++write;
          }
          if (write > 0) {
            z_terminated[index] = z_terminated[index + write];
          }
        }
      }

Or, getting rid of index:

      void condense_by_removing(char* z_terminated, char char_to_remove) {
        int write = 0;
        for (; *z_terminated; ++z_terminated) {
          if (*(z_terminated + write) == char_to_remove) {
            ++write;
          }
          if (write > 0) {
            *z_terminated = *(z_terminated + write);
          }
        }
      }

<comment><USER26> I see what you're trying to do, but it won't work this way. Since your termination condition is z_terminated[index], you must never look beyond index, yet you access [index+write]. This alone means the code's buggy. The second version is similarly flawed.

Note that your code instantly becomes much easier to understand if you rename the variable 'write' to 'gap'.

<comment><USER5> Ehh, good point. :-/

The second version is identical to the first, except that it ises the z_terminated pointer instead of a separate index.

      void condense_by_removing(char* z_terminated, char char_to_remove) {
        int gap = 0;
        for (; *(z_terminated + gap); ++z_terminated) {
          if (*(z_terminated + gap) == char_to_remove) {
            ++gap;
          }
          if (gap > 0) {
            *z_terminated = *(z_terminated + gap);
          }
        }
        *z_terminated = 0;
      }

Interestingly enough, if I try to remove the common *(z_terminated + gap) expression (which a good compiler should do for me..), I end up with a two pointer version similar to yours.

<comment><AUTHOR> Have you sent it in? You should ...

<comment><USER5> I missed your post the first time around and only did that today, so I assumed it was too late to send in.

</comment></comment></comment></comment></comment></comment><comment><USER27> His solution is so similar to mine that is scary. I also went thru the same optimization process. (e.g started with a while and changed that to a for later) I didn't go farther because I didn't want to loose readability.

      void condense_by_removing(
          char *z_terminated ,
          char char_to_remove
          ) {
            char *rptr = z_terminated; // read ptr
            char *wptr = z_terminated; // write ptr
            for(;*rptr; rptr++) {
                    if (*rptr != char_to_remove) {
                            *wptr++ = *rptr;
                    }
            }
            *wptr = 0;
      }

</comment><comment> loup-vaillant And I thought my solution was as simple as possible. If only I decoupled my two increments, I may have avoided this unreadable, inefficient crap:

      void remove_char(char *s ,char c)
      {
        int from = -1;
        int to   = -1;
        do {
          from++; to++;
          while (s[from] == c) from ++;
          s[to] = s[from];
        } while (s[from] != '\0');
      }

Maybe that's why simplicity doesn't _actually_ rule: it's hard to find. Or, people are silly (including myself in this case).

<comment><USER4> Your code also fails (i.e., reads and writes past the end of the string) if c == '\0' and s is "\0".

<comment> loup-vaillant I considered the `c=='\0'` case bogus anyway, so I was OK with a partial function. (I wouldn't have been for production code, though.)

<comment><AUTHOR> Are you saying that you actually considered that case, and then wrote code that didn't deal with it?

<comment> loup-vaillant Yes I did, and then yes I did.

I didn't fully investigated that case, but I _suspected_ there could be a problem with `c=='\0'`. I _suspected_ that the `while (s[from] == c) from ++;` line could shoot past the termination '\0' and trigger a buffer overflow.

But I didn't _fully_ investigate, on the grounds that no sane programmer would want to remove a character that's never in a C string. In other words, I considered it was not part of the specification.

In production code, I would have either thrown an exception, or returned early. And I would have asked around to know which I would chose.

Could my attitude have influenced my chances, if I had applied?

</comment></comment></comment></comment></comment><comment><USER28> Coming late to the party, here is my version. Even though it uses some weird constructs, it compiles and runs with TurboC V2.01 from 1988:

        char *d,*s;
        for(d = s =  z_terminated;
            *s;
            s += (char_to_remove== *s)?1:((*d++ = *s++),0))
               {;}
         *d = *s;

Note this is the "fun version". For production code, I would use more conventional constructs, rather than the comma-delimited embedded expression with side effects.

</comment><comment><USER29> 1) In TFA, s/cersion/version/, but that's an amusing typo. :-)

2) Initializing inside the for loop requires C99; is that to be considered idiomatic? I didn't think so. I'll be curious how many submissions were either identical to your suggested idiomatic solution or its K&R equiv:

<https://gist.github.com/3f4daf24595788258a01>

:-)

<comment><USER24> Although I'm not sure "its K&R equivalent" is correct (that's C89 and has "modern" function implementations), C99 is indeed not that common. If only because many compilers don't support it (including Microsoft's).

<comment><USER29> Bah, I learned my C from K&R 2nd ed. I guess that's not K&R C, is it? :-)

<comment><USER24> It's... complicated. K&R 2nd ed. (which is an excellent book!) is based on a draft of ANSI C; pre-ANSI C was not standardized but rather based on an informal reading of K&R 1st ed., hence "K&R syntax" and the like.

At least, if I recall correctly.

</comment></comment></comment></comment><comment><USER30> I'm nowhere near an experience C coder, but doesn't the in place part mean that you don't create any additional variables or strings and just modify z_terminated? Is that even possible? This is an honest question, because the solution is obvious this way, but a bit harder if you can't create additional variables.

<comment><AUTHOR> "In place" usually means that the result is in the same place as the input, and you don't create an intermediate copy. Creating a fix, known number of additional variables to assist with the calculation is OK.

Some people allocated memory, copied out the input, then put back the bits they wanted to keep. That is not "in place".

<comment><USER31> _Your routine should modify the given zero-terminated string in place, removing all instances of the given char._

 _The main point of the whole exercise is to see if the candidate can write any code - anything after that is a bonus._

Now if the input and output of a function are correct I think you where simply less clear than you may have thought. If you had said "string in place _(don't allocate any memory),_ " I suspect far more people would have given you the output you wanted.

<comment><AUTHOR> The main point is as you quote. Secondary points are to see if the candidate can understand common expressions and idioms, and if not, either to look them up, or to ask.

As it says elsewhere, the purpose is to get some code, then use it as a start for the discussion. If someone allocates memory then that's where I start. In that case they clearly they don't understand the usual meaning of the expression "in-place."

      > If you had said "string in place (don't allocate
      > any memory)," I suspect far more people would have
      > given you the output you wanted.

I suspect you're wrong, and I would be interested to see if anyone else comments on that point. I got nearly 100 submissions, and only one (from memory) allocated memory. All the others did the modification "in-place" as requested.

<comment><USER31> _Some people allocated memory, copied out the input, then put back the bits they wanted to keep. That is not "in place"._ "Some people" implies more than one.

I would have done it in place because that was the simplest approach and not doing so would have been silly. However, just because it seems that way to us does not mean everyone knew you required more than just output in that fashion.

Anyway, I was more commenting on the style where you mix the requirements for an interface with the requirements for the algorithm. IMO "I need a function / API that does X efficiently" is much better than saying "does X using hash tables". AKA, if you don't' want someone to use malloc then you can say so, but giving the reasons why you don't want malloc is more useful.

PS: It's really a minor point and I thank you for doing this bit of research. I was simply trying to help you communicate in a more clear fashion.

<comment><AUTHOR> A few things.

Firstly, thanks for being constructive. Your points are noted, although I don't necessarily agree with all of them.

To me, "some people" does not imply strictly more than one. That's possibly a mathematician thing.

But the point about mixing implementation detail and interface requirements, this is normal in much of the coding I do. I'm often working in a constrained environment, and performance requirements are very much a part of the specification. Stating that something must happen "in place" is a common requirement for me, and goes beyond saying "must not malloc" or whatever. More, it's having someone being able to cope with the mix that I was, in part, looking for.

I'm also well aware that many of the people here on HN do big machine programming, or web programming, and aren't accustomed to constrained programming. That's partly why I chose this particular question. My next challenge won't have that sort of constraint, and will be more in line with your comments. (Yes, sucker that I am, I'm planning another small exercise by way of comparison/contrast).

And again, these are the sorts of questions that I would expect to discuss during the de-brief. The very fact that you bring them up at all means you are in the top 0.01% of programmers (for some value of 0.01).

</comment></comment></comment></comment></comment></comment><comment><USER32> Turns out his solution is almost the same as mine except I skip the termination stage and instead read one character more in the loop which catches the \0 from the original end of the string automatically. As I'm not really a C programmer, was I doing something bad/unrecommended? It seemed to work.. :-)

<comment><USER33> What happens if you pass '\0' as the character to remove?

<comment><USER15> Like the grandparent, I do the same. I have the copy routine also copy over the final 0.

If you pass in 0 as the character to remove, it still works fine. Nothing is shifted, so the final 0 is copied and the string remains null terminated. Technically this could be undesirable behavior (it's contrary to the spec), but I don't think the behavior if you do pass in a 0 to remove could be easily defined. What does it copy into the place where the null was? How does it know where to stop? Easier to just assume it's remove any non-null character and asking to remove null means remove nothing.

</comment></comment></comment><comment><USER34> '\0' is null-terminated NOT zero-terminated, no ? By definition, a string in C is always null-terminated.

<comment><USER35> As it happens, '\0' translates to 0. Since they are composed of characters, C programmers tend to do the c == '\0' check instead of the shorted c == 0 check, just to make sure everyone knows we are still treating the char like a character in a string; it is just style.

      char c = 65

is equivalent to and just as legal as

      char c = 'A'

So yes, C strings ARE zero-terminated. In fact, it is a bit weird to say they are null-terminated. It is technically true, given that NULL often translates to 0, but NULL is a pointer value in the same way that zero is a number.

For some reason, I vaguely remember some security hack in one OS where NULL went to a special place in memory that was marked as invalid (1, 63, or something), so in that case, NULL was not defined as 0. Since the memory is vague, though, don't quote me on it.

<comment><USER22> >it is a bit weird to say they are null-terminated

Yeah, it would be. They're NUL-terminated.

<comment><USER35> Unfortunately, "null-terminated", although incorrect, is widely used. :(

[http://googlefight.com/index.php?lang=en_GB&word1=%22nul...](http://googlefight.com/index.php?lang=en_GB&word1=%22null- terminated%22&word2=%22nul-terminated%22)

I hate all the variations of nothing. undef, null, NULL, NIL, NUL...

<comment><USER36> How can "null-terminated" be incorrect when that is the language used by the C standard?

<comment><USER35> I stand corrected. I looked at my old ASCII tables. This is a silly semantic argument.

<http://www.asciitable.com/>

The character shorthand is "NUL", but the full name is "null". I still stand by my (silly semantic) point that the use of NULL is overloaded here. NULL is a pointer value, not a character value. The string does not terminate at a pointer; it terminates with a magic character. This has, in fact, bitten me in the past where '\0' was a legitimate member of my string, and I have to write my own accessors.

<comment><USER37> I'm not convinced that NUL vs. C's "null character" is just a silly semantic argument. NUL is an ASCII abbreviation and the implementors probably wanted to avoid being tied to a particular character encoding - there is no mention of NUL in the C standard.

As for the NULL, it needn't be a pointer value, the standard permits it being "an integral constant expression with the value 0", so in certain implementations it can be the same as '\0'.

</comment></comment></comment></comment></comment></comment></comment><comment><AUTHOR> Taster of the analysis to come: <http://news.ycombinator.com/item?id=1404347>

</comment><comment><USER38> You can add a little twist to this test to make it slightly more difficult by changing the char to remove to be an array of char's to remove.

</comment><comment><USER39> Funny how readable Python is:

def condense(s, remove): return "".join([c for c in s if c != remove])

Cheating (2.6+): s.translate(None, remove)

<comment><USER24> You are aware that this is, to a C programmer, horribly inefficient? (Specifically, it violates the "in-place" requirement, but the actual overhead of that is dwarfed by everything else.)

</comment></comment><comment><USER40> Sadly, the code YOU wrote is suboptimal. It doesn't check for bad pointers, has no comments, doesn't take memory corruption into consideration, and assumes the replacement character is not '\0'.

You would get a C- if I graded your test.

Now you'll argue that it's just a test, but the fact is your best work should not come only when under unexpected scrutiny, as it does with impromptu tests, it should be a mental process that is not bypassed for any reason.

In this case you've thought about it for weeks and still botched it.

Kudos for trying. We'll call you if we are interested.

<comment><AUTHOR> Interesting - thank you for your feedback. It's educational to see the different points of view.

However, I wonder if you've actually taken on board either the point of the exercise, or the fact that it isn't yet finished.

However, questions such as those you raise are, of course, of great interest in production code, and would be raised in the discussion this code is intended to start. If someone started to write correct code that took these things into consideration the test would be stopped - it would've served its purpose already.

I'd be interested to know:

* Do you think every routine, every piece of code should have comments?

* Do you think every routine should test its input parameters? Every time?

* Do you think every routine should be checking for memory corruption? All the time?

* How do you cope with memory corruption in the program code itself?

* Do you think the routine fails if the char to remove is '\0'? Are you sure? You seem to claim it does.

* Do you believe that all code should always be written to the same standard?

Having written code in an environment where any given memory location has a MTC (Mean Time to Corruption) of 12 hours, I have considered these issues. I'd be interested to hear your experiences in these matters.

I notice also that you created your username specifically to reply to this item.

Welcome to Hacker News.</comment></comment>