7 rules of unobstrusive javascript - <AUTHOR> http://icant.co.uk/articles/seven-rules-of-unobtrusive-javascript/

<comment><USER2> _You don't expect JavaScript to be available but make it a nice-to-have rather than a dependency_

This one needs to be let go of, it is no longer a best practice and it is the norm among many of the most advanced web apps available to not only require JavaScript, but make it the core architectural underpinning of the solution. The days of web apps working without JavaScript have passed.

As of late, the market has refined itself into Web Sites and Web Apps. For web sites a CMS solution should be utilized, but for web apps, more and more it is refining it's own client side toolkits with HTML, CSS and JavaScript becoming the tools of choice.

<comment><USER3> I disagree. As long as Javascript remains a significant vector for "mal-ware", I'll leave it disabled by default and remain cautious about opting-in on a site by site and domain by domain basis. And I'll advise my family, friends, and users to do the same.

Note that, as part of this, you'd better have something to show me without Javascript enabled. If I get a "blank page", I'm unlikely to engage further.

I realize I'm increasingly in the minority and that perhaps the world is "passing me by". On the other hand, more and more "normal" people around me are being compromised by exploits and wondering "WTF".

There's a limited role for more advanced, scripted presentation. But a lot of what currently "requires" Javascript is just needless genuflection.

<comment><USER2> Please don't take this the wrong way, as it is not my intent to be rude, but you represent a statistically insignificant amount of revenue. It's smaller than a percent. But the new technology stacks and the features and services they can deliver offer real and tangible revenue or cost savings. When factored in, catering to your use case does not make viable business sense. If that ever changes, we as an industry will have to re-evaluate the technologies choices but as it sits now, progress and momentum are behind JavaScript web applications.

<comment><USER3> In turn, I hope that you didn't find me too rude -- rather, just to my personal point.

I welcome the discussion. And I realize that I'm an outlier.

Nonetheless, I see a lot of "required" Javascript these days that to me looks rather useless, or at least not really necessary.

I'd be curious as to a description of some of the specific revenue and cost saving advantages. However, I'm not specifically asking that of you, here, as this is an already nested set of comments where the cost/benefit of the effort -- even should you be inclined to consider it -- might well merit it. (And I'm being literal, not somehow snarky, in saying that -- just to be clear.)

If a description is not in the cards but you have some pertinent links handy, I'd welcome the opportunity to take a look at them. (But again, no expectations of a response on my part.)

Regardless, thanks for taking the time to respond. I appreciate the consideration your parent response shows. :-)

P.S. I don't want to sound too much like I'm asking/begging for a further response.

Perhaps I'm a bit of a "parasite". I come to the web mostly to acquire and to share information. Inasmuch, I find a lot of the current scripting a hindrance rather than an aid.

Also, having recently spent a weekend cleaning up a personal contact's business systems from a mal-ware infection (and all the crap that turned up once this crisis prompted them to call me and so cause a closer examination of their systems), I do feel some personal animosity towards poorly defended and utilized vectors for such stuff.

<comment><USER2> _I'd be curious as to a description of some of the specific revenue and cost saving advantages._

Sure no problem, the first and foremost that I can think of would be self contained widgets for third party sales channels. Lets say I sell hotel rooms. I can build a JavaScript widget that provides rates and inventory in a small list on the side of a page. A related sales site can then just drop it on their site, by adding a div with a certain CSS class assigned to it and it instantly giving me a direct sales channel where there was none. At little to no integration cost to them. So with that widget, I can implement a pretty robust affiliate sales channel. I could do the same with a static image or HTML as advertisement, but having real inventory and prices available is going drive up conversion. Thus it could be said to be a new channel of revenue.

Second would be in certain usage patterns, there are some usage patterns that when you have to submit a page back to the server for every step it becomes cumbersome and requires significantly more code. Lets take a grid for example, say I provide a list of items in a grid and I want that information to be sorted in one of several ways. With the old model of spitting it back to the server I have to hold on to a bunch of info on the server, and generate several views to re-sort it. With a JavaScript grid, I just have a couple of custom sort functions that I pass into the sort method on the array and then re-bind the results to my grid. So what would necessitate 5-6 different views generated by the server, I can manage with just a call to array.sort() the grid can observe the array.sort() and react to it being called. In these kind of multi-path UI workflows not round tripping to the server reduces a good deal of complexity from the system.

For me personally I think getting rid of SP (ASP, PHP, JSP) leads to a more maintainable system, because I think it is simpler. Having the UI and workflow concerns as a separate application that is delivered to the browser helps deal with a lot of Anti-patterns that the SP development model introduced. I prefer to write my front ends disconnected from the server and have their only connection be for data and business processing. I feel that it reduces the complexity of the solution and that it separates the concern of the workflow of a system from the processing of a system nicely. Some will differ on that and some will be more productive in the SP's. For me and the team I work with, we can deliver more compelling apps faster using JavaScript as our UI languadge. As well, I like the fact that the server architecture forces everything to be implemented behind addressable interfaces. It makes going to Mobile or other platforms as simple as creating a new work flow tailored for that specific device. JavaScript applications have evolved to take advantage of what the web is becoming. More and more people are implementing workflows never originally conceived of on top of unrelated back end systems. Taking services from Facebook, and Yelp or twitter etc. and implementing totally novel and new concepts, even if they are wholly unrelated to the companies that provide the services. This was not possible when UI's and data where locked, together, behind proprietary server technologies like the SP's. To me that is the greatest advantage, it provides a UI platform for an internet where all services are available as a collective platform. The entire web becomes the platform and anyone can write a workflow on-top of it.

As for useless features implemented in JavaScript I would say we had the same issue with Flash, just because you can does not make it the reason to do so. All I can speak for are the effort that I am part of and when we embark to build something we try to back it with real business need. Some people don't seems to put as much emphasis on not wasting time and money and I don't see that changing whether it is just a static web page, JavaScript or any other technology.

<comment><USER3> Well, that all makes sense to me (at a first read). And I will and do opt-in / enable scripting on a site by site basis in order to engage such features.

I don't like having to turn on scripting in order to see anything and to form an initial assessment/opinion, e.g on a front page. In that respect, I still favor "degrading gracefully", or "enhancing gracefully" -- I've seen it described both ways. (And that's just one of the "annoyances" I guess I was referring to.)

Back around the time Gmail was first "oohing" people, I did a small bit of snazzy scripting for a prototype to enable a much more user friendly interface on an internal corporate system. (Unfortunately, the powers that be -- or were -- didn't know what to make of it, and it languished.)

In the wild and woolly web, though, I still have concern about opening the scripting door to compromises. I'm not sure what the solution is to that.

Anyway, thanks very much for taking the time and effort to write up the description. I take your points, and I like numerous aspects of the direction you're describing. It does seem at least somewhat more in line with the so called "web application" paradigm as an alternative and/or successor to the "web page" paradigm.

If I may ask a follow-up, what's your perspective on keeping the pieces and the integration "safe"?

<comment><USER2> _If I may ask a follow-up, what's your perspective on keeping the pieces and the integration "safe"?_

For me, I would like to see the browser sand boxed completely away from the OS, with the cloud this may be a ever closer reality, have drop box like functionality for the browser where if you want to upload a file, you do so from the cloud not your local device. So say I want to send you a picture, I choose the picture from say Picasa or Flicker as opposed to going to my local drive.

I would like to see something like SSL certificates for web providers that want to be able to step past that sandbox. So providers prove their identity to get a certificate that lets browsers access files to upload or native apps are utilized to get content into the cloud. Cutting the filesystem away from the browser is the first step.

Second with HTML 5, there are browser based data stores available to developers. This should be the first option when a developer wants to keep file information on a users system. From there they should offer to save files to the cloud providers. With the way the web is moving, there are less and less legitimate reasons for a web provider to access the native system. If they do, they should be able to justify that reason for a certificate or they should be able to write a native app and supply it via an app store.

Naturally some providers will not like the thought of using an app store, in which case they can offer it for download with a certificate or via a whole lot of security exceptions on the part of the user. Much like Firefox does with a expired SSL certificate where they user has to basically insist that they know what they are doing. I would like to see enterprise controls on that as well, where an IT department can override the user and not allow acceptance of the risk by the user.</comment></comment></comment></comment></comment></comment></comment>


In Quest for a 'Legal High,' Chemists Outfox the Law - <AUTHOR> http://online.wsj.com/article/SB10001424052748704763904575550200845267526.html <comment><USER6> This is the effect of drug prohibition in our modern age. You can attack the supply chain, but not the demand. Savvy entrepreneurs, internet marketing and a cornucopia of untested synthetic drugs will continue to satisfy the demands of a largely youthful consumer base.

We've made the safest drugs illegal, only to open up a vast market in utter unknowns. Better the devil you know.

<comment><USER7> _We've made the safest drugs illegal_

This is the problem.. They've also made alcohol, which is supposedly more dangerous than, for example, cannabis or MDMA, legal. Nicotine is also dangerous and legal.

<comment><USER8> Sugary water will catch wild yeasts from the air and spontaneously ferment into alcohol [1]. It's _incredibly_ difficult to prevent its production. AFAIK, 5-MeO-DMT or "Meow Meow" don't magically appear just because you forgot to put a jug of apple cider in the fridge.

[1]: <http://www.homebrewtalk.com/wiki/index.php/Tej>

Also, alcohol generally isn't that dangerous, unless people are driving and/or concentrating it via distillation.

<comment><USER9> Generally, the safety of a given substance can be determined through its therapeutic index. The therapeutic index for a substance is calculated by taking the amount of the substance that will induce toxicity in 50% of a population divided the dose that will induce the effect of the drug in 50% of the population. In short, the ratio of how much will be (acutely) toxic to how much will make you high.

Here are some therapeutic indexes for common drugs [0]:

Heroin - <USER2>

Alcohol - <USER3>

Cocaine - <USER4>

MDMA - <USER5>

LSD - ~1000

THC - > 1000

Alcohol has very dangerous acute effects and it's very possible to overdose on alcohol. Compare to THC where a toxic dose is on the level of 15g. Assuming that THC is approximately 5% of the content of the cannabis [1] this would mean smoking 300 grams of cannabis (with 100% absorption by the body). That would make for ~600 joints (with a joint having about half a gram of cannabis) to get to a level of toxicity.

So relatively speaking, Alcohol (at least in the short term) is quite dangerous.

[0] PDF - [http://web.cgu.edu/faculty/gabler/toxicity%20Addiction%20off...](http://web.cgu.edu/faculty/gabler/toxicity%20Addiction%20offprint.pdf)

[1] <http://en.wikipedia.org/wiki/Cannabis_%28drug%29#Potency>

<comment><USER10> Those are great statistics for judging the likelihood of _overdosing_ (although, I'm not sure it's the only factor to consider - the physically small amount of cocaine needed to OD probably mitigates its higher therapeutic index).

If you want to evaluate _danger_ there are other factors that need to be considered -- i.e. people "safely" high on MDMA may dehydrate, and people "safely" high on LSD may jump off of a bridge.

<comment><USER11> _people "safely" high on LSD may jump off of a bridge._

Sober people may jump off a bridge too. Should we outlaw sobriety? The "man on LSD thinks he can fly and jumps out of window" myth is largely that: a myth. If I recall, it was inspired by a real story of LSD experimentation on some kind of federal agent, who was given a good dose of LSD without his knowledge, thought he was going mad, and threw himself out of a window to make it end.

<comment><USER12> I came here to post this and found a new possible source for the "jumping off the bridge" meme.

[http://www.cbc.ca/canada/british- columbia/story/2010/10/24/b...](http://www.cbc.ca/canada/british- columbia/story/2010/10/24/bc-capilano-suspension-bridge-death.html)

Long story short, a student took LSD on a class trip, which involved a visit to the Capilano Suspension Bridge. The student didn't jump off the bridge, but climbed a railing on an observation deck and fell.

</comment></comment></comment></comment></comment></comment></comment><comment><USER13> This was going on at least back in 2000-2001; I still have a "poisonous non- consumables" catalog in my basement somewhere (I have friends who are into this kind of thing).

Read the forum posts about this stuff online; it's funny, there's a backlash of enthusiasts calling vendors like this guy "slash and burn" outfits for popularizing chemicals and getting them banned.

</comment><comment><USER14> Meh, this has been going on since MDMA was put on banned substances lists across the world in the 1980's. Up until a few years ago, so-called 'smart shops' (in the Netherlands selling drug paraphernalia, 'coming down' products like vitamin pills and magic mushrooms before they were banned) would sell 2C-B which has been synthesized by Shulgin in the 1970's already, and documented along with MDMA, MDA, MDE etc. in PIHKAL.

Drug legislation that I am familiar with (all of them Western European) is designed to cope with this process. There is usually a 'drug act' which prohibits all materials on a secondary list, and this list is then to be adjust by 'the minister' or similar, which in practice means that there is a ministry that can fairly easily (within a few weeks) add substances that are banned. It's cat and mouse, true, but the 'war' (between chemists and the government) had largely calmed down by the late 1990's. I guess when new forms of drugs come into vogue, that variations pop up, but these too will be driven into the margins in a few years. (typically after a while the processes for manufacturing become so difficult or dependent on expensive/hard to get precursors that it get out of reach for amateur chemists, at which the police call it 'good enough'.)

For those interested, the Uncle Fester books (<http://nl.wikipedia.org/wiki/Steve_Preisler>) are readily available online and very interesting from a 'chemistry hacker' point of view (I don't know anything about chemistry but I still enjoyed reading them very much, for the 'underground glamour' aspect and the inventiveness. Don't take any of the legal advice in the books though, the guy may be a great chemist but on other things he has some strange ideas.).

As a side note, is this 'meow meow' really popular across Europe? I don't know much about it but it seems to me that it's only widely spread in the UK (then again I get all my information on 'the scene' from journal articles and government reports so I may just be lagging in information).

</comment><comment><USER15> Note that these chemicals are mostly automatically illegal in the USA under the Federal Analog Act. <http://en.wikipedia.org/wiki/Federal_Analog_Act>

However, the Federal Analog Act has been notably tested twice in court to criminalize new substances and the Act was not upheld the first time and was upheld the second time. So it is not of yet well established and it is suppliers that are at risk of prosecution, not consumers.

<comment><USER16> Not knowing enough about chemistry: what are the chances of people with medicine bought in another country being stopped as carrying something "substantially similar" to a drug?

<comment><USER15> 0+, the federal analog exists as a law on the books but takes a concerted prosecution effort to use.

</comment></comment></comment><comment><USER7> _European authorities blame mephedrone for the death of three young people in the U.K. and Sweden in recent years._

Except, at least in the case of the two teenagers who died in the UK, it was in the news a few months ago that autopsies later showed that they didn't actually have any mephedrone in their systems.

<comment><USER17> scare tactics induced by the media to try and cover up these drugs. I'm not defending drone, it's a horribly fiendish poison and it's certainly something which can kill you if taken in a large enough dose. But media corps lying about the facts on these drugs isn't helping us advance anywhere

<comment><USER7> I completely agree.

By the way, I know a few people who have taken mephedrone and the general consensus is that its bad: side-effects appear to include not being able to sleep for the next few days, depression, agitation and loss of concentration. I would very strongly advize people to _NOT_ take mephedrone.

</comment></comment></comment><comment><USER18> Under current policy regimes consumers seek drugs which aren't illegal yet and don't pay much attention to their safety or lack of safety testing. This seems suboptimal. If these drugs were legal, consumers would prefer drugs that made them feel good and had a good safety record.

<comment><USER19> I think libertarians under estimate the good that can come from regulation. Regulation can protect people before the bad thing happens. If the drug kills you, your family can take that company to court and get them shut down, but you are already dead and that sucks.

On the other hand, I suspect that over regulation by the US FDA has killed a large number of people by making it too difficult for new medicines to get to market.

Any choice in the prohibition/regulation debate is going result in some dead people. The goal is to find the point on the spectrum with the least number of deaths. I don't know exactly where that is, but I do feel over regulation is destroying Mexico and other parts of South America and we should move towards less regulation.

<comment><USER18> Keeping the conversation within the domain of the current article, there is no policy goal to mitigate harm from recreational drugs. If a drug makes people feel good it will be outlawed whether it is completely harmless or very dangerous. This has the side effect of pushing some people from relatively harmless but illegal drugs whose effects are well understood to potentially harmful new drugs that are not yet illegal.

No lives will be saved by this policy, which isn't surprising since the goal is not harm mitigation (despite the rhetoric of government officials) but keeping people from consuming psychoactive substances that make them feel good.

Are far as FDA regulation vs. liability is concerned - you cannot outlaw the production of drugs which will kill some people. All you can do is provide incentives for drug makers to research the risks of their products as thoroughly as possible. Drugs are still approved by the FDA that kill people despite the fact that the FDA approval process is stupidly expensive.

There is no perfect world. The goal of policy should be to reduce risk in a cost-effective way. Harm reduction should be balanced with the corresponding damage regulation does to life-saving medical research. After we weigh various policies we may find that the status quo is suboptimal.

As rational people we should keep our minds on the right trade-offs and the right metrics. Many people are comfortable with the idea of a regulatory state regardless of its effectiveness - it makes them feel safe. We should not let these emotions of safety influence our thinking overmuch.

<comment><USER20> _" If a drug makes people feel good it will be outlawed whether it is completely harmless or very dangerous."_

 _" ....the goal is not harm mitigation (despite the rhetoric of government officials) but keeping people from consuming psychoactive substances that make them feel good."_

Supporting evidence? Those are some dramatic claims you are making.

I felt good with morphine in my system after an operation, and felt a lot worse without it once the effects wore off. Also, a nice cold beer is just the ticket after a long week. No danger of those being banned anytime soon.

<comment><USER18> Marijuana is safer than alcohol or tobacco, and it's certainly safer than whatever recreational substance some guy is cooking up in his lab. Why is it illegal? Have you seen "Reefer Madness"? Scientific piece of work, that.

Meanwhile, some kids at Georgetown University face 20 years in prison for making an illegal but less intense version of a drug which is legal in 47 states: [http://reason.com/blog/2010/10/26/the-georgetown-drug-lab- bu...](http://reason.com/blog/2010/10/26/the-georgetown-drug-lab-bust-m).

A huge short-term risk from most recreational drugs is simply not knowing what is in them, especially if they come in a pill, powder, or liquid form. And that is an effect of prohibition, not the drugs themselves. Of course government officials will pontificate on the horrors of drugs every time prohibition kills another kid that doesn't know what is in his ecstasy.

</comment></comment></comment></comment></comment><comment><USER21> I think its going to be a pretty short trip from here to laws that are worded so "that which is not expressly permitted is automatically denied".

<comment><USER13> These chemicals are already illegal under straightforward interpretations of US law, but they're not illegal "enough" to prevent them from being sold online and shipped Fedex.

This seems like the kind of "illegal" that mostly matters if you hang a sign out your window and start doing business.

It's worth noting though that there's really no intellectually valid argument in support of mephedrone or MDAI or whatever-the-hell-else they're selling --- if you're going to make meth, cocaine, and LSD illegal, this stuff clearly should be too.

<comment><USER6> MDAI and MDAT seem to me to be particularly suitable drugs for therapy. Whenever you blanket ban a group of chemicals you also make research on medicinal use practically impossible.

</comment></comment></comment><comment><USER22> You can see the actual products the have for sale here: <http://alchemylabz.eu/products.php>. A little Googling on the listed analogues for sale reveals that most people in the usual forums for recreational drug use have long written these sorts of guys of as scammers. However, with this WSJ article, I'd say they are now verified as legit. I expect his business to pick up considerably...

Needless to say, this is quite an interesting game of cat and mouse and just goes further to illustrate the futility of prohibition.

</comment><comment><USER23> There was a small cafe here in Montreal that used to sell legal highs but had to shut its doors due to pressures from law enforcement. I once tried Salvia Divinorum (which has no known negative side effects [1]) and I can testify it's definitely not a placebo as I first suspected with "legal highs".

[1] <http://en.wikipedia.org/wiki/Salvia_divinorum#Long_term>

<comment><USER24> _I can testify it's definitely not a placebo as I first suspected with "legal highs"._

Cool! How did you set up the double-blind study?

<comment><USER25> Don't be fooled by thinking salvia is just a "legal high". It can cause profound ego-loss for upwards of ten minutes. The history is that it is what native american shamans used to chew on to see visions.

A common experience is one in which people say "I forgot that I was something, then I realized I was something but I wasn't sure what that was." They then had to figure out the world again as the drug wore off. I think it's foolish to group something this psychologically powerful within the same group as something that "just gets you high" like alcohol or pot.

<http://www.erowid.org/plants/salvia/salvia.shtml>

<comment><USER23> You're right that it's much more powerful than alcohol/pot but the truth is that _it is legal_ in most countries and states. The "upside" is that its effects totally wear off after ~15 minutes and there are no known long term or addictive effects.

<comment><USER7> The fact that some drugs are _legal_ certainly doesn't mean they're not as strong or powerful than ones that are illegal. Salvia is, apparently, one of the strongest hallucinogens there is. The difference between it and, say, LSD, is that the Salvia "trip" only lasts ten to twenty minutes. I have personally tried Salvia some years back and have had some seriously bizzare experiences. I'd rather not post them online, but if you're interested, send me an email.

</comment></comment></comment></comment></comment><comment><USER26> Mephedrone is horrible stuff, quite similar to methamphetamine in chemistry/effects on the body.[1] It was EXTREMELY popular in the UK when it was legal up until last year. This was due to the total and complete unavailability of the much safer, less addictive and much more well tested MDMA (ecstacy) from the summer of 2008 until mid 2009.

This has been speculated to have happened as a result of international co- operation to make sassafras oil, the main precursor of MDMA less available, and generally crack down on the production of one of the worlds most popular synthetic narcotic drugs. This almost certainly had a lot to do with the 2008 summer olympics in china, where a lot of production of precursors and final products occurs.

The law of unintended consequences rears its head again. Prevent the supply of one drug and the demand switches to a newer more dangerous drug, whose supply you have no ability to control.

[1] [http://www.homeoffice.gov.uk/publications/drugs/acmd1/acmd-c...](http://www.homeoffice.gov.uk/publications/drugs/acmd1/acmd- cathinodes-report-2010)

</comment><comment><USER27> Haha, reminds me of The 51st State (<http://www.imdb.com/title/tt0227984/>)</comment>