Hacker Newsnew | comments | show | ask | jobs | submit | stickfigure's comments login

For a much simpler solution to the json graph problem:

https://github.com/jsog/jsog

Implementations in Javascript, Python, Ruby, and Java.

-----


I much prefer the JSON-API approach by Yehuda Katz, et al.[1]

https://gist.github.com/21echoes/a1ca3e4376262da32297

It's definitely designed to be used in a RESTful-esque situation (the reference keys are a type/id tuples), but that's the dominant JSON use case anyway.

For an example of why you'd want type/id tuples over JSOG's plain string @id -- while in the given JSOG example, all items are People, referencing an Address object from Sally (so that Bob can deliver her gift) introduces a potential conflict between Address @id: 1 and Person @id: 1. To disambiguate, you could of course prefix all "@id" value strings with e.g. "address-" or "person-", but then you've just re-invented JSON-API's solution, while making your @id not a real id (not usable in cases like e.g. `api.example.com/resource/<id>`, etc.).

The other solution is to say that JSOG @id's are only for use in one response parsing situation, and could be discarded afterwards. But that seems like quite a waste -- what if e.g. your API wanted to be able to send @id references over the wire without the overhead of sending the whole referenced object?

[1]http://jsonapi.org/

-----


JSOG solves one particular, widespread problem - reconstituting an object graph on the other side of a wire. As you said, the information is only meaningful during the exchange. JSOG isn't trying to solve some greater notion of object identity; that's your application's business.

-----


I agree that the type/id pair is quite helpful when reading the graph! Interestingly, this does have the effect of limiting you to N top-level types, but I don't actually think that's a big deal. Most applications, if you break them down, only have like 3 real types (one of which is always "user").

-----


also https://github.com/cognitect/transit-format

-----


Honest question, how is it simpler?

-----


One simple metric would be the number of lines of code:

https://github.com/jsog/jsog/blob/master/src/JSOG.coffee

-----


There are no paths to evaluate, just unique synthetic ids. The JSOG transmutation process is a simple recursive function; most of the implementations are just a handful of lines of code.

-----


Interesting. That looks very similar to YAML's anchor/alias feature.

-----


Drunk driving causes 10,000 deaths/year

Here's part of the problem. The actual statistic is that 10k deaths occur where one driver had a BAC of 0.08 or higher. It's purely an assumption that these deaths would not have occurred if the drivers were sober. Some, certainly; some, certainly not. We need better information.

The discussion lacks "scientific integrity", as Feynman would put it.

-----


Not meaningful in Java.

java.util.List is an interface; java.util.ArrayList is the most commonly used implementation.

-----


java.util.LinkedList also implements that interface. ArrayList has the same semantics under the hood as an array (fast insertion at arbitrary places, fast random access, slow extension), and any Java programmer who's remotely familiar with data structures should know the difference between the two. Especially when LinkedLists are so commonly used under the hood in e.g. the java.util.Queue family.

-----


Yes, of course. But if someone - especially a java programmer - asked me "list or array?", I would regard them amateur. In most of today's popular programming languages, list != linkedlist.

Of course, the proper response to a dumb interview question like this is "You mean linked list or array, right?" Because a reasonably seasoned programmer should recognize this poor choice of terminology for what it is.

-----


...which they would receive by drinking any sugary liquid.

-----


...until it stops being enough, either due to gradual tolerance making them seek a stronger and stronger fixes, or due to something that disrupts production by the yeast-culture.

-----


At which point they will seek the most sugary liquid ever.... The human brain.

-----


Too much sugar in brains, you say...

> How should I know? I'm a dentist. But here's what I do know: If a tooth is bad, you PULL IT. Yep, mad brain's got to come out, boy!

https://www.youtube.com/watch?v=_JHaeJyLw2o

-----


I don't see the problem with G and B in this role; at least they answer to the end user. Who does ICANN answer to? What is your alternative if you get crappy service from the .com operator? If what PG says is correct, you don't really have an alternative.

-----


> at least they answer to the end user.

Yes they do. Just don't forget that the end user is the advertiser. We poor schmucks who type text in the search box are the product.

-----


That's a queer claim to make.

-----


i see wut you did there.

-----


"It tastes like chicken"

-----


While I also recoil at the $, I much prefer a functional programming style based on immutable objects. Defaulting to in-place mutation would ruin the API.

I probably would have gone with shuffleInPlace(), but the more I think about it, the more I like the $. Especially since it will rarely get used.

This library is pretty neat largely because it changes some common (and annoying) java idioms.

-----


In that case, have shuffle() always return a new copy, and there is no in-place shuffle. I would consider this a good solution, assuming that the loss of an in-place shuffle is acceptable. (This would basically be the .NET LINQ approach.)

-----


For a really class act, check out Ceylon's collection classes. As an example, Set and SetMutator are separate interfaces; a MutableSet has both. The whole standard library is really well thought out WRT typesafe functional programming.

-----


I don't get it. Mandating that auto manufacturers sell a certain percentage of electric vehicles seems a bit like legislating the weather. If CA really wants to push people into electric vehicles, why not manipulate the demand for electric vehicles? Perhaps add another dollar or two to the gasoline tax?

-----


It makes sense to me: they're forcing the automakers to subsidize the R&D of electric vehicles from their profits on ICE vehicles, which seems like a normal thing for a business to do when it benefits the business.

Since conventional automakers don't seem to be willing to aggressively pursue EVs on their own, this seems like a reasonable approach.

Or, put another way, the consumers who continue to buy ICE cars, and in doing so create pollution, are helping to pay for the EVs that other people are buying.

-----


> Since conventional automakers don't seem to be willing to aggressively pursue EVs on their own, this seems like a reasonable approach.

There are EV and plug-in hybrid options across many price ranges and car shapes.

-----


And California policy has had a not-insignificant impact on that range of options.

-----


I never knew that. I thought it was upcoming competition from Tesla and the "writing on the wall" so to speak... I didn't know that legislation was manipulating the product output mix of Big Auto...

-----


Yes it goes way back to California Emissions. California has legislated to drag auto manufacturers kicking and screaming to the contrary position for many years. I think it's unlikely engine efficiency, and battery technology would be as progressed as it is now without that.

There is such a thing as government failure, just as there's such a thing as market failure. The problem with both is that perfect information, and hence perfect markets don't exist. The role of a regulator is to try to get close to a perfect market (like truth in lending laws, anti-fraud laws, compulsory minimum warranty, lemon laws, competition law, etc.) in order to bring about a free market that can actually mostly let people (markets) determine outcome rather than it being a planned economy. Of course it doesn't always work for a litany of reasons, mainly because it's a difficult problem.

-----


People were buying Hondas, Toyotas and Datsuns in the '70s. Part of that was mileage, some of it was price, part of it was ... a sort of rebellion. There was interest.

The US automakers were just downright bellicose. No real surprise; they're huge organizations and turning a thing that large takes forever. This was so profound that Roger Smith of all people started the recently defunct Saturn marque. GM remains cast in the same shape today.

Outside of electronic engine control and the stupefyingly dumb leaded gasoline, most EPA style "improvements" made cars less efficient and would have been unnecessary for properly tuned vehicles. I suppose it's lost for all time now, but Robert Pease had a great story about his Beetle not registering any emissions and his trouble with that ( an aircooled Beetle has a high enough exhaust gas temperature to theoretically emit no carbon monoxide ).

Regulation is extremely difficult - I think of it in terms of Brian Kernighan's "debugging is twice as hard" maxim but with a higher multiplier.

I think if you want clean air, $10 a gallon gasoline is a good start. This will be very disruptive. I have never seen proof, but I have heard many times one reason Reagan was popular was because gas prices dropped during his tenure.

The sad part is that we mostly use cars to subsidize land use patterns that could be taxed. Commuting is the least efficient thing ever devised.

-----


> I think if you want clean air, $10 a gallon gasoline is a good start. This will be very disruptive.

It's interesting to think about how, due to the price inelasticity of gasoline, every penny in price increase results in a certain number of bankruptcies. My pet economic theory is that the gas price spike in the summer of 2008 is what tipped over the first domino in the global financial crisis. That was just a $2-3 per gallon spike. You're seriously advocating a $7+ dollar spike? If by disruptive, you mean collapse of society, sure. That would be very disruptive.

-----


It is beyond interesting.

I don't think $10 gasoline would cause a ..."zombie apocalypse" level perturbation, but it would doubtless be bad.

I, perhaps surprisingly, agree wholeheartedly with your pet theory.

I have also read more than one (monetarist) economist who holds your pet theory, with a few modifications - the oil price spike was interpreted by the Fed as inflation so they did nothing to ease the money supply, worsening ( or some say starting) the whole shebang.

-----


Recent story inre GM’s poor quality and high prices relative to Japanese automakers: https://news.ycombinator.com/item?id=9946385

I agree that high priced gasoline, fees for parking and road use, and changes to zoning and land use policy would be great, but perhaps we still also want some regulation of car emissions?

Do you have a link explaining how EPA improvements made cars less efficient?

-----


This glances at it a bit.

http://jalopnik.com/5551040/why-old-cars-suck

Spark control was much more primitive, carbureted engines just were not good candidates for all the complexity of hoses and such, gas of varying quality would clog catalytic converters... the technologies were just in an intermediate state. There were all "add parts" improvements.

Japanese cars could be better but frequently were even much more complex.

They might meet EPA off the lot, new, but after five years... I had a 1979 Buick Regal (normally aspirated, 3.8 L V6 ) that was getting like 8 MPG when I sold it in 1993 or so. No mechanic in three states could find anything wrong.

-----


I guess I’m not understanding your original point... it seems like cars have gotten much better than they used to be. Are you saying in a counterfactual world without the EPA, they would be even better still? Or are you saying that those improvements were inevitable and cars would be equally good but cheaper without the EPA regulations? Or are you saying that regulations are better now than they were in the 80s? Or ...

It seems to me that an alternate explanation could be that it took auto makers 10–20 years to figure out how to build good compliant cars, with their first tries sucking, but once the regulatory regime had been stable for a while they figured out how to make big improvements. In a counterfactual world without those requirements they might be much more polluting today. [I dunno, I’m not at all an expert in this subject, I’m just speculating.]

At any rate, as someone who grew up in the 90s in southern CA, I’m very thankful that emissions of cars made in the 80s/90s were much better than cars 20 years prior; cleaner cars were a big part of the radical drop in air pollution throughout the area.

-----


It's the "it took 10-20 years" thing. Really, the advance of digital technology made it all work out in the end - trying to do all that stuff in the mechanical domain was charming but it took more talent than was readily available and raised the price of cars. Digital just means a different class of engineer could address the problem and the replicability of digital helped. A generation had to exit the workforce and be replaced for it to actually work.

My more central point is that they didn't have to be polluting at all, using older technology. Properly tuned engines didn't pollute much.

Most if not all issues addressed were really down to proper maintenance. The "people who aren't there" in the modern software that runs cars do that for you now. As hard as it may be to believe, people were more or less expected to do their own maintenance on cars. Of course they didn't. But that is just how I was raised.

Again, we use cars to rejigger location in real estate. It's the use of a technology to solve something that is ultimately a governance problem. I suspect land rent taxes would be more efficient.

-----


Political expedience. Mandating that an unloved industry do X makes it the industry's problem. Trying to do Y yourself exposes you to criticism about choice of Y, ability to implement it and consequences of the outcome.

-----


Taxing gas will hurt a lot of people and wouldn't stimulate the economy since people will just stay home instead of travel.

And I don't recall that many people that can afford electric car such as Tesla. Nissan Leaf might be cheaper but it still a 100 miles range IIRC. You're basically asking poor people to buy two car. One for daily travel and one to travel say from LA to LV just to play some casino games.

edit:

I think what she and California is doing now is a much better way, mandate it.

-----


If only there were businesses that specialized in letting you use a car for a predefined period of time if you agree to pay a daily fee for the privilege...

-----


Rental cars have their own weird tax structure. Lots of areas tax rental cars and hotels because out-of-towners bear the burden. Rental cars in the UK were startlingly cheap when I was there, like 1/3 the price I would expect in the US. And you could rent one with a stick.

-----


> One for daily travel and one to travel say from LA to LV just to play some casino games.

There are other ways to get a vehicle for a road trip, besides buying one.

There are also many plugin-hybrids now: 0 gaws for local driving, and a gas tank for long dries.

-----


>Perhaps add another dollar or two to the gasoline tax?

If only, the gas tax is waaaaaaaaaay too low.

-----


Increasing the price of gas would incentivize more efficient vehicles for sure, but it is also incredibly regressive, impacting lower-income individuals disproportionately.

The rich keep driving their Escalades since it makes little difference to them what the gas costs, but the poor can't afford to get to work... To the extent possible, it's best to try to avoid externalities like this, making a gas tax less appealing than it would otherwise be, free market or no.

-----


Use the proceeds to further subsidize and increase the coverage of public transit to make getting to work cheaper. A gas, or carbon (if you want to get closest to the raw input as possible) tax would probably be the best price signal to what you want to reduce demand for.

Forcing automakers to sell more EV's also makes cars more expensive. So then people don't buy new cars and continue to use old ones, the worst emission offenders?

-----


Public transit is cheaper for low income earners than driving and disproportionately used by them. Improving public transit is a much better solution.

http://www.rita.dot.gov/bts/sites/rita.dot.gov.bts/files/pub...

-----


Don't get me wrong - I'm a huge proponent of well-funded, and extensive public transit options... If you are advocating an expansion of public transit to counter the gas tax, I fear it may be more complicated than tit for tat...

In Seattle, where I live, for example, it is logistically and financially expensive to expand public transit. While the city is building out light rail, adding trolleys, and encouraging density, the city is growing too quickly for public investment to keep up. Moreover, the success of Amazon, Microsoft, etc. in adding great, high-paying jobs has the side effect of making the downtown core (where all the transit is) prohibitively expensive to live in.

More externalities... Thus, it comes to be that the poorer working class live further away, have to drive into the city for work, and would still be the hardest hit by a gas tax. Meanwhie, Microsoft provides a private bus/shuttle network to get its employees around from homes to its various campuses - the very people who could afford the extra cost of fuel.

None of this is bad, per se... It's great that there are all these good jobs available and that so many people are flocking to the city! The knock-on effects are to the detriment of the 50% living below the mean...

-----


If we had some kind of basic income, gas taxes, road use fees, parking fees, and many other prices attached to negative externalities (e.g. general carbon taxes) would be much more palatable at a societal level.

-----


Thats kind of what happens when you don't ever adjust it in 50 years and it's a fixed dollar amount.

-----


The federal gas tax was last increased in 1993, 22 years ago.

-----


Which is also why the federal highway trust fund is broke. Not just figuratively; it is literally out of funds.

-----


I'm guessing here, but since fleet fuel efficiency standards have been around for awhile, making cars like hybrids attractive to sell, extending that concept is natural.

I would love to buy an EV right now, but charging it really wouldn't be practical for me given where I live, so it isn't really a practical option, but I believe that could change in the future. As bad as gas prices could get, it still takes some incentive to get that kind of practical infrastructure change made, in terms of businesses to sell them and for parking lots to have them. If you have auto manufactures on the hook the sell them, they need to figure out those practicalities that go beyond R&D. Plenty of electric alternatives (e.g. hydrogen) have died out, despite R&D from a number of groups, in part because the lack of fueling stations make them incredibly impractical.

-----


CAFE is a farce, as it it forces manufacturers to design and build cars that no one buys. It's the wrong metric.

> https://en.wikipedia.org/wiki/Corporate_Average_Fuel_Economy...

https://en.wikipedia.org/wiki/Corporate_Average_Fuel_Economy

> The CAFE achieved by a given fleet of vehicles in a given model year is the production-weighted harmonic mean fuel economy, expressed in miles per U.S. gallon (mpg), of a manufacturer's fleet of current model year passenger cars or light trucks with a gross vehicle weight rating (GVWR) of 8,500 pounds (3,856 kg) or less (but also including medium-duty passenger vehicles—such as large sport-utility vehicles and passenger vans—with GVWR up to 10,000 pounds), produced for sale in the United States. "

(Bonus points for the stupidity of using "harmonic mean of mpg" instead of a simple "gpm")

Also, CA has to work around Federal pre-emption

> Through EPCA and EISA, U.S. law (49 U.S. Code § 32919) also requires that "a State ... may not adopt or enforce a law or regulation related to fuel economy standards or average fuel economy standards".

-----


... And yet CAFE has had an enormous positive effect on fleet milage in the US.

-----


Do you have evidence for this? I seem to recall that low-mpg light trucks and SUVs were wildly popular in the US until the price of gasoline went to $4.

-----


http://www.rita.dot.gov/bts/sites/rita.dot.gov.bts/files/pub...

Since 1980 we've gotten about 50% better mileage over all. Considering the number of cars is greater today the real effect of gas saved is even more.

-----


Is that due to CAFE or due to consumer preference for fuel-efficient cars within a class? Since MPGS are heavily touted in advertising, it seems to be related to consumer preference

-----


I'd credit most of that improvement on electronic engine control, and that really kind of had to evolve somewhat after 1980. You could see good improvement in cars from that time frame just by replacing the coil system with an SCR based ignition.

It's also difficult to explain how brittle a 1980 car's fuel handling system was. Now, having both controlled by the same computer leads to much improvement.

-----


I was hoping for evidence of causation, not correlation :-/

-----


Law passes requiring improved mileage or fines. Auto makers followed by increased mileage and avoided fines. It's pretty simple.

-----


Alternative narrative: Customer demand shifted to cars with higher mileage. Auto makers stopped resisting higher CAFE standards because the minor increment was meaningless. See also: The ongoing debate over minimum wage laws and unemployment.

Inferring causation from correlation is not "pretty simple", but a lot of poor decisions are made under that assumption.

-----


I can tell you for a fact that at least on large diesel truck forums when gas/diesel hit $4/gallon the number of used trucks being posted for sale was staggering. The number of people who couldn't afford to fill their trucks up and still make a payment was almost comical.

-----


Your comment reminds me of the ev2. Back then, the first electric vehicles were being piloted on the road, and then California tried to create some sort of mandate to force all vehicles to eventually become electric. The mandate backfired because car manufacturers were now trying persuade the state that no one wanted electric cars, eventually causing all electric cars to forcibly be taken off the roads.

-----


> Perhaps add another dollar or two to the gasoline tax?

Political suicide.

-----


> Mandating that auto manufacturers sell a certain percentage of electric vehicles seems a bit like legislating the weather.

nope. We have levers for the market that we don't have for the weather. In this situation the manufacturer's are forced by the state either to sell cheap EVs or develop more capable EVs - attracting buyers either way through pure market devices. As conservatives like to point, developing a more capable and cheaper car is not the business of government, it is the business of the car businesses. Government in this case does exactly what it does best - applies force.

-----


They hit the manufacturers because they're a large target.

An awful lot of people in or close to poverty still can't do without a car, and this will hit them the hardest. Even for people who make a modest living, an inordinate number of them drive something for their job.

55 MPG is an arbitrary and modestly ridiculous target that soon. A Prius stickers @ 51 MPG. And or course, SUVs and pickups are exempt.

At a loss of $15k per car, I'd have to seriously consider abandoning the California market were I Marchionne.

CARB are not ... nice people.

-----


You can encourage demand as much as you want, but if manufacturers are keen on selling the more profitable gas powered cars that demand will just go unfulfilled. By mandating that auto makers have to sell a quota of electric cars they have no choice but to fulfil the demand (and to create more demand if there isn't enough).

-----


Tax increase requires supermajority in CA.

-----


It does seem a bit backward. On the other hand, the auto manufacturers are perfectly capable of achieving this end result by themselves: Just subsidize the sale of electric vehicles by raising the price on non-electric vehicles.

-----


The poor, nor the California economy couldn't take on another tax on gasoline?

A lot of guys(including politicians, and the people who fund them) like their collector's cars/trucks. They want to drive that 455 Oldsmobile convertible on the weekends without gouging the wallet? (Collector car enthusiast are a big group of people, across all income levels. "Just try to pry my '65 Corvette from my cold, dead hands?"

California provides a big demand for the sales of automobiles; the legislature knows they can tell carmaker's what to do? I couldn't imagine being the guy who lost the sales rights to California? Not fair, but in this case I not crying over the car companies.(Car companies will get my sympathy when they start manufacturing cars that owners/independent shops can easily work on, or at least have access to the proprietary programs? I don't think I will buy a new car until I can have complete access to your programming? I buy your car. I buy your programming too--because I need to clean it up in so many cases? Seal off Emmissions--fine. Give me access to everything else?

(This is a note to CARB: right now you only require Emmission shops to have one reference on hand to verify smog requirements. Most shops take the cheep route and buy Motor Emmission publications.(The publication is filled with errors. Technicians and customers know this. Many smog customers are sent home with failed visual component tests, but smog compliant automobiles. There are mistakes in Volvo's, BMW's and Toyota(88 toyota's, air aspirated, do Not have an MIL light). These are just the mistakes I ran across. It took at least three emails to Emission Publications Ltd. for them to respond to my complaints about errors in their publications. They literally argued with me? They didn't know the difference between natural aspirated(carburetor), and FI(Fuel injection)? I was floored!

Require the smog shops to have access to two Emmission references? Ondemand5(Mitchell manuals) is a good alternative, and I have yet to found an error in it.)

-----


Don't you understand? When government mandates something, things happen. We've won Bush's war on terrorism, we've won Reagan's war on drugs, and we've won Nixon's war on cancer. Victory is at hand in Obama's war on gasoline powered cars, and you're going to feel pretty foolish when you miss the celebration.

-----


You forgot LBJ's war on poverty and Clinton's war on pants.

-----


If the war on drugs was to sell a certain amount of legal pills, or the war on terrorism was to kill a certain amount of terrorists, or the war on cancer was to cure a certain number of cancers, those would all be 'won'.

Your analogy is terrible, and with enough money and willpower the government could easily get rid of gasoline cars.

-----


You are massively overstating the case. While I'm vaguely aware from various news stories that sex tourism does exist in Thailand, it's hardly the first thing that comes to mind. Food and diving have 40X and 13X and more google hits, respectively, and sex tourism doesn't show up on the list of google typehead choices even if you push it to "thailand se".

-----


You are right of course - people have different perceptions; for me, diving is definitely the thing that comes to my mind from Thailand, even if I have never done any scuba diving myself. The next things are beaches, food and the tsunami.

But regarding what Google typeahead suggests to you, it depends on your location and perhaps your own search history. For me the options with "Thailand se" are september, seasons, sevärdheter ("sights" in Swedish). So if someone sees proposals with "Thailand sex", it could be because he or she has been doing previous searches for Thai sex tourism.

-----

More

Applications are open for YC Winter 2016

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: