Dojo: Simple code to dynamically generate widgets and add them to an element

Following on from the last post, this post is about the Dojo JavaScript framework, sorry guys.

Another snippet of code that might help you dynamically generate multiple widgets (hopefully from widgets that you’ve created) based on feeds or array data or pretty much anything.

It was an absolute nightmare to track down how to do this on the Dojo documentation (Dojo has such terrible documentation, they should spend some time working on it, which is why I’m posting sections that people should find helpful)

If you have a dom element and you’re trying to append a series of n nodes to the dom element, that are all generated from material within a greater array of objects:

this.myArray = [{objtype1},{objtype2},{objtype3}];
//For example if you are creating widgets called 'myWidget', to which you pass the arrayValue
 
dojo.forEach(this.myArray,function(arrayObject){
//In this example I'm populating list elements into a UL with the id 'ulHead'
node = document.createElement("li");
dojo.byId('ulHead').appendChild(node);
//Remember to use the correct widget syntax when declaring
var widget = new myWidget({widgetObject:arrayObject},node);
});

I’ve just cross-coded that to a generic example from the actual one I’m using and have substituted a forEach in this section for the for loop I’m currently using, but this should help you on the right track if you’re finding the dojo documentation a bit lacking.

LOOK FORWARD TO MORE OF THESE EXCITING PROGRAMMING BLOG POSTS AS TIME WEARS ON.

Posted in dojo | Tagged , , , , , | Leave a comment

Help for Dojo JavaScript framework users

If you’re getting an error along the lines of:

Error: You cannot use the Render object without specifying where you want to render it' when calling method

You need to fix the declaration in the widget you’re creating, as you’ve missed something really simple.

Copy the constructor from a pre-existing widget to make sure you haven’t missed anything.

Also, make sure you’re specifying a valid ID within the DOM.

This just cost me an hour of my day, so I hope this saves you some time.

Posted in dojo | Tagged , , , , | Leave a comment

PM Abrogates God, News at 11.

In a divinely inspired statement for further polly-rigging, glorious leader K Ruddkip has confirmed that he starts each day with a prayer:

KEVIN Rudd has revealed he tries to start every day with a reading from a prayer book.

But the PM admitted he does not always remember the Christian missive that life is not “all about me”.

“When I manage to remember that principle . . . I’m much the better person for it,” said Mr Rudd, who has been criticised for a tantrum on a VIP plane and is known for fruity language in private.

Mr Rudd told the Salvation Army’s War Cry his preferred book of daily devotionals was My Utmost for His Highest, which features a spiritual truth for every day of the year.

“I work out of that and the scriptural readings upon which each day’s devotions are based,” he said.

“And I try very, very hard to reflect on that before I get stuck into the day.”

The best-selling My Utmost for His Highest was written by the Scottish-born World War I AIF chaplain Oswald Chambers.

Asked how he would advise couples with marriage troubles, Mr Rudd suggested they see their local pastor, priest or minister.

So we’ve basically got a puff piece that Commander Rudd is a pious sort all in touch with Jesus and what. Why is this even a story? So the guy prays occasionally, so what? We are one of the few countries in the world that has had an openly Atheist individual as a Prime Minister (Bob Hawke), so why have we not left this whole religious issue behind closed doors where it belongs?

It saddens me to no end that this is newsworthy, and I’m sure there are countless Christians out there cringing at the idea of Rudd selling them short for a few extra points in a poll.

Fuck the media has been juvenile lately. Is it just me or has everything seriously taken a turn for the worse in the past two months?

Posted in Steven Fielding does not have a medical license | Tagged , , | 1 Comment

Linkbait and hotness, for your time.

Friend of the blog Tim Andrews has put together somewhat of a gallery of hotties that he says will save the liberal party.

Good way to waste 5 minutes.

*Hat tip* to the special ladies and friends of the blog that made the list. Be proud of your sexy nature, etc.

Lemon Out.

Posted in Steven Fielding does not have a medical license | Tagged , , | Leave a comment

Making your Idiocy Quotient

From Whirlpool:

It’s facts. Fluoride is a poison and used by Stalin and Hitler in prison camps to suppress people from rebelling. It’s so toxic that if a child eats a pea sized amount of toothpaste they can die.

Toothpaste contains 1500 times more fluoride then water.

Fluoride is a slow poisoning, so you wont notice effects. It also takes years to detox.

Yep.

Yep.

Yep.



Posted in Steven Fielding does not have a medical license | Tagged , , | Leave a comment

Stockpile, but don’t panic?

Is this honestly helping?

Residents are advised to stock their pantries with drinks, including three litres of water for each person each day, dried and long-life food such as canned meals, toilet paper, batteries, candles, matches, manual can openers and water sterilising tablets. Analgesics, masks, gloves, a thermometer, disinfectant and prescription medications should also be stockpiled and people should have enough supplies to stay in their homes for 14 days.

No cases have been confirmed in Australia yet, but 40 million masks have been stockpiled for delivery to hospitals and medical centres. Mortuaries and clinical waste management services have been ordered to prepare for increased activity.

So we’re told to calmly prepare for what may either be the Aporkalypse or a media blowout, and we’re expected to assume that a bold monotype headline splashed across the top of a newspaper will be enough to assuage any issues we have with the problem?

Are you fucking kidding me? You’re telling people to stockpile food and water to last them two weeks. Given this nation’s tendency to panic at the smallest thing, it’s like shouting fire in a crowded theatre, embedded in concrete, at the bottom of the ocean. Of course people are going to fucking panic, it’s what we do best. We’re naturally trained to dump copious amounts of adrenaline into our system at the slightest sign of any danger, so now we’re doubly fucked. Not only are the supermarkets going to be filled with people hurriedly scurrying to stock up on as many Aldi Organic Sausage-Snacks as possible, but they’re all going to be potentialy capable of lifting up and throwing cars, too.

There has honestly got to be a better way of doing this that isn’t such an abominable clusterfuck. All of you, for a minute, imagine you’re either a politician or the editor in chief of a broadsheet newspaper. Punch yourself very hard in the testicles/breasts. I mean proper fucking hard. I want your skin to bruise and seep blood. I’ll wait.

Do it again.

And again.

Okay so by now you’re doubled over in pain and have been decorated in haematomas like a festive blood-puppet. Here’s what you do:

  1. You run the entire swine flu epidemic stuff somewhat as is, but you report the pure facts and you get the pure facts from the authorities
  2. You don’t run any fucking opinion pieces on the epidemic that allow spacktards and morons to claim everyone’s going to die because Jesus is pissed off or that a pharmaceutical company did swine/11 or whatever. Don’t give a voice to the nutjobs, it just makes sifting through this shit so much harder.
  3. Make it very clear to everyone that if they haven’t been to Mexico in the past few months and haven’t come into contact with anyone who has and they have the sniffles, it is extraordinarily unlikely that they have swine flu.
  4. Take into account the fact that people are stupid. ALONGSIDE the Swine flu coverage, post a ‘disaster agnostic’ series on disaster preparation, how to stockpile water, what things to get for purifying water, generator recommendations, emergency contact lists, etc.

Under no circumstances play this thing up to sell papers, airtime, etc. Inform and enlighten the public as best you can. Give them unadulterated facts and keep everyone calm. Give people the information that they need gently, rather than screaming it into their faces like an overclocked wind-turbine attached to a speech synthesiser.

For fuck’s sake the last thing I want is to be pummeled to death by a morbidly obese woman in a coles at 2 in the morning when I’m trying to buy munchies which she interprets as a threat on her life/stockpile of 15 litres of copha.

Fuck you all.

Posted in Steven Fielding does not have a medical license | Tagged , , | Leave a comment

If you only read one thing today, read this.

Ben Goldacre on the Aporkalypse.

The media is generally pretty dodgy, but distrusting the doctors in the scenario because of media hype is the worst decision you can make.

Posted in Steven Fielding does not have a medical license | Tagged , , | Leave a comment

Oh For fuck’s sake

http://www.abc.net.au/lateline/content/2008/s2555325.htm

THIS ISN’T PANDEMIC 2 NICOLA.

NICOLA ROXON: This is a precautionary step that the Government’s taken. The chief medical officer made the recommendation to me. We have other diseases that are already listed as quarantinable and they give the chief medical officer and then his delegate, for example at various airports across the country, the power to take additional steps. We’ve added swine flu to the list. It means that if the circumstances change very quickly, that we would be able to use those extra powers if they were needed. But I do need to hasten to reassure your audience that at this stage there is no suggestion that we’d need to use those powers, but we don’t want to be in a position if the circumstances change quickly that we are delayed for not having taken this precautionary step tonight.

NICOLA ROXON: It gives the chief medical officer the power to change circumstances, particularly at our airports or our ports. They – the most extreme of those would be, for example, isolating someone, perhaps in their own home. But there are other steps that are more minor; perhaps disinfecting aircraft when they’re arriving. These sorts of steps go from relatively mild to quite intrusive, and we certainly are a long way from needed to take those steps when we have no confirmed cases currently of swine flu in Australia.

NICOLA ROXON: Well, look, my understanding is that we haven’t needed to use these powers. We of course weren’t in government during the previous threats. But the powers have been put in place because we’ve seen in recent times and increased threat from SARS, from bird flu. But we need to make sure that the current threat from swine flu is included so that we can act quickly if circumstances need to change. I’m very pleased, though, the reports from the first day of the changed procedures at airports for flights from the Americas have shown the community to be very cooperative and we’ve had no suggestion that these powers would be needed, even if the alert moves to a higher level.

NICOLA ROXON: Yes, it’s probably not correct to say that we’ve got 89 suspected cases. We have 89 people who have been travelling in the area who are showing some flu symptoms. It can take anywhere from a day to several days because there are three different steps of testing and a person, of course, can be cleared from the first stage, then we get a result pretty quickly. If someone goes to the second or third stage, it takes us more time. It’s a very complex process of the way you treat the DNA and match it up with the identified signifiers, if you like, of this disease. So, really, it can be as quick as several hours. It can be as long as probably 48, slightly more, if there were some difficulty with the way the sample was being used or responding.

So basically the government overreacts to the issue and then uses laws designed to protect Australia against polio to pretty much round people up into camps.

Vunderbar! “The powers won’t be needed”. You’ve proven time and time again you refuse to relinquish powers. We’re all fucked. Hahahhahahaha.

Posted in Steven Fielding does not have a medical license | Tagged , , | Leave a comment

I would love to do some proper investigative journalism.

Any topics or ideas would be welcomed. Things you’re not too happy about, points that have been made or raised in the media that you’re skeptical of, flat earth news, etc?

I’d love for something to actually do within the next few weeks, so please, hit me up with some information, yo.

Posted in Steven Fielding does not have a medical license | Tagged , | Leave a comment

Mortality, Swine and the culture of Self-Preservation

I’ve come across a disturbing trend in my usual grokking of the inter-spheres. As with everything I tend to report on, I need to have either read a great deal about it or be horrendously drunk in order to add my own special brand of commentary. In this particular instance I’m more from column a than column b, but a man can dream.

There seems to be a particular strain of eschatological fervour at the idea of the ‘end times’, particularly end times brought by an invisible carrier that targets the youthful and the strong. This particular form of influenza, known colloquially as ‘Swine flu’ induces what is known as a Cytokine Storm, which basically turns the strong immune systems of those it infects, against the host. Don’t worry if you’re a child or a member of the elder classes, do absolutely shit yourself and run screaming into the streets if you’re a relatively healthy youngun. Though, whilst it’s usually good to take advice from Randall Munroe, the idea of drinking constantly and never sleeping to destroy your immune system and thus duck the deft destruction of death, is one that maybe isn’t a long-term solution.

Regardless, I’ve begun to notice a particular type of onanistic joy that has built up around this influenza. That is one of absolute, honest-to-goodness assurance that you’re number has been passed over. This is some WW1 level bullshit. The kind of insane mentality that made men charge machine guns under the foolish and utterly idiotic misconception that their name was on a bullet and it had already been decided. You lived because you weren’t meant to die, etc. What fatuous piffle. I suppose these same idiots assume that the millions of children that die each year of malnourishment had foodstuffs, that, unfortunately, lacked their name?

Now, this isn’t going to be a polemic about the poor, starving, huddled masses yearning to breathe free etc etc, but rather an acknolwedgement of our own particular collective mortality. First, it goes without saying that the human race will carry on. We’re like goddamn cockroaches, we seem to evolve and mutate at a pace that is quite honestly, breathtaking. Our genome, as a whole will be perfectly safe. The problem is that some of us, we fucked masses, will be utterly fucko-mc-cunted. Yeah, that’s right. If this panic and frenzy and other such nonsense blows out of proportion to the point that we’re all dying in the streets, coughing up blood and fucking anything remotely porcine, then yeah, some of us, fellow internet travellers, are going to die in the streets. You brave and worthy motherfuckers will have your lives ended purely because some microscopic motherfucker wants to turn your cells into multiple billions of itself. Now that shit, clearly, is not cool.

It’s a fact commonly remarked upon that our generation (I.E, Gen Y, or Z, not those Gen X idiots who are all balding and now have no money) has not ever known the true face of evil. We cling to causes like Animal-Rights, or N’s Liberation, or “Socialism” because we feel that there’s something inherently fucked up about the world but our built-in pattern-recognition software is broken. We can’t identify the threats to ourselves, and we’re so caught up in a tide of pure moral relativism that we can’t find a common bond either towards an external threat or promoting unity amongst ourselves. This is a good thing. No race of people ever died from thinking too much or being too reasonable (Excluding the fuckers in Pompeii who thought ‘oh look at the pretty sky flames, I’ll wait around for a while’). We now, for better or for worse, have this unifying threat. Microscopic, efficient, mass-produced killing machines that we ourselves perpetuate. Web 2.0 meet Virus 2.0. It’s decentralised, unique, highly social, and above all else fits in with our modern-day lifestyles.

Yet the vast majority of us, like our twitter accounts, our facebook accounts, all manner of social media extrusions of the self, feel we’re individually too important to be silenced amongst the crowd of braying cattle. It’s obvious that only time will tell, but isn’t it oddly fitting that all those who welcome chaos, who welcome this plague against humanity, media beat up or not, assume that they will be standing afterwards to tell the story? The grotesque solipsism of our generation continues even into territory we’re categorically unwilling and too arrogant to understand.

Posted in Steven Fielding does not have a medical license | Tagged , , , | Leave a comment

Ultimate Science Team is Digg proof thanks to caching by WP Super Cache!