Include PHP-file in Smarty

I’m teaching myself PHP and Smarty these days, and today I ran across a common problem:

«How do I include a PHP-file – or execute PHP-code – when using the Smarty template engine?»

After banging my head against the wall for a couple of hours, I finally found the solution. To include a PHP-file in a Smarty template, use the following code:

{include_php file=”/path/to/somefile.php”}

You can also use the following code to run and/or execute PHP-code within Smarty:

{php}
include(“includes/myname.php”);
{/php}

Hope this blog post helps some poor soul one day… Keep hacking.

Top 15 Things We’ll Tell Our Grandkids

Image of the Future

1. Back in my day, we only needed 140 characters.

2. There used to be so much snow up here, you could strap a board to your feet and slide all the way down.

3. Televised contents gave cash prizes to whoever could store the most data in their head.

4. Well, the screens were bigger, but they only showed movies at certain times of day.

5. We all had one, but nobody actually used it. Come to think of it, I bet my Linkedin profile is still out there on the Web somewhere.

6. Chinese

7. Our bodies were made of meat and supported by little sticks of calcium.

8. You used to keep files right on your computer, and you had to go back to that same computer to access them!

9. Is that the new iPhone 27G? Does it have multitasking yet?

10. I just can’t get used to this darn vat-grown steak. Texture ain’t right.

11. Radio? It was a one-man version of Spotify.

12. We used to chop down trees and write yesterday’s news on them. Luckily, that was banned just before you were born.

13. I for one welcomed our new alien overlords.

14. Your grandma and me met a bar. It was a kind of “Second Life beta”, but with actual liquid drinks and smelly people.

15. Back in my day, “Skynet” was still known as “Google”.

First 10 entries courtesy of Wired magazine, Oct. 2009.

PLEASE DIGG: http://digg.com/d319SSd?t

Congo sues Norway for $500 BILLION dollars!

In the Republic of Congo, a surreal scenario is playing out: Two Norwegian citizens, Tjostolv Moland and Joshua French, have been jailed, apparently due to involvement in a murderscene in which an innocent cabdriver was killed. The Republic of Congo claims the Norwegians killed the driver over a money dispute – the Norwegians claims they were nothing more than witnesses to the crime, perpetrated by unknown gunmen in the middle of the jungle.

In any event, the Republic of Congo is furious – and claims that the killing represents an attack on «the body and soul of Congo itself». And what does Congo think would be a good compenstation for such a hideous crime against the Conglonese people? According to the State Attorney of the Republic of Congo, a mere $500 BILLION dollars will suffice.

Jailed Norwegians in Congo. Photo: Jørgen Braastad.

Norwegian media is present at the military tribunal hearings, and reports that the demand was put forth today. The Conglonese State Attorney insists that the two backpackers are undercover Norwegian agents, backing up this brash claim by pointing out that the two Norwegians were in fact equipped with – gasp! – Norwegian drivers licenses at the time of their arrest. As such – Congo claims – the state of Norway is morally and economically responsible for any and all wrong-doings their citizens do abroad.

Even though Norway is one of the richest countries in the world, enjoying the second highest GDP per-capita (after Luxembourg), even Disney’s Scrooge McDuck would have a hard time settling a $500 billion dollar debt. If Congo wins forth in their own military tribunal, God help Norway.

PLEASE DIGG: http://digg.com/world_news/Congo_sues_Norway_for_500_BILLION_dollars

Scrooge McDuck vs. Congo

What does Microsoft have against black people?

Every now and then, a Megacorp does something really stupid. Founded in 1975, you’d think Microsoft knew their way around international business by now – but then something like this shows up:

Compare Microsoft’s international Business Productivity website against
the Polish version of the same website. (Note: These are Actual Microsoft.com URLs)

Notice anything different?

For your convenience, check out this screenshot:

Microsoft website comparison
Microsoft website comparison

In the world of Business Productivity Infrastructure, I guess this is as “WTF??” as it gets.

Uncovered: The Truth Behind the AT&T 4chan-Block

AT&T
AT&T

Earlier this week I wrote about how AT&T suddenly started blocking the infamous imageboard 4chan.org for its 40-60 million customers. A mere 15-16 hours later the ban was suddenly, and mysteriously lifted – with little explanation from AT&T itself, save for a short and apologetic statement to TechCrunch. News quickly spread, and Mashable and several other media reported «Ceasefire declared», effectively sparing AT&T from the wratch of the Internet Hate Machine.

Even though the matter was quickly resolved, one question remains: How can one of the biggest cooperations in America, with hundreds of highly skilled PR-agents on its payroll, make the rookie mistake of blocking one of the biggest internet forums in existance – without any warning of any sort? Furthermore, a megacorp like AT&T had to understand that such an action could only be perceived as the first shot in the war of Net Neutrality – and that it would more than likely enrage the Internet Intelligensia? So why risk it?

The answer might be stranger than fiction.

My first post about this subject got nearly 12000 diggs, and my tiny blog received more than 180.000 visitors in one day. One of these employees – let’s call him «Soma» for the time being – emailed me, and had quite a story to tell. What follows is parts of the e-mail transcripts between the two of us. True or false – you decide:

My name is Soma. I work on the internet side of things in AT&T, and deal with everyone who is not a «Major Corporate account». Saying much more than that narrows down the list of people for executives to sift through and fire if truth and PR vary too much for them to let it go. Furthermore, I was at work on Sunday, which narrows the window of «who talked?» down further. AT&T is a very vindictive company – and prone to firing people for anything they choose not to like. Therefore, you will have to forgive my discreteness.

The 4chan thing was basicly a bunch of ignorant back-end network guys – primarily led by one guy – that claimed there was a SYN flood from an IP range in the 4chan IP blocks. The idiots flat out blocked the IP range, most likely thinking to themselves that «Hey, it’s Sunday, no need to wake up my boss for this».

If this backbone tech guy had done his job, he would have contacted the 4chan admin – or at least the hosting company – and given them a chance to reply.  This was a flood that spanned a couple days – hours of waiting for a reply from the 4chan admin wouldn’t have delayed anything.  We have dedicated policy experts scattered around our territories, and it’s not even beyond the call of duty for a average tech support agent to contact a hosting company and provide warning.  Others in his department verify the SYN flood appeared to be originating from 4chan IPs and they believe it wasn’t spoofed as a few other ISP’s acknowledge similar issues.

Anyway, by 22:00 CDT on Sunday the graveyard shift for numerous departments were on the clock, and being the odd-balls that graveyarders are, we knew of 4chan and the user usage.  We instantly heard about the 4chan-issue, as the DSL-side of things had already gotten a couple of hundred complaints – and I believe the U-Verse group had gotten at least 100.

By 22:45 we had gotten information to the right people and by 00:15 the «black-holed» IP range was once again opened up.  At that point most of the odd-balls began taking screenshots and making PDF’s of the «death of Randall Stephenson»-posts and keeping our names out of any of the mess.  We assumed the PR-department would have to weather some crap, but we all hoped it would calm down. It was tempting to let the problem build overnight, but it would have caused too much hassle – both for us and for AT&T.

But surely – after all this – the tech guy was sorry for the trouble he caused, right? … RIGHT?!

The worst part was the moron emailed everyone this morning to boast that he did the right thing. His emails to the groups that were affected (customer service-facing) sound as if a client (a customer above normal residential users) was the target, and the SYN/ACK was affecting various parts of our network – whilst in reality, it was mainly just slowing down traffic before being filtered out.

But 4Chan was definitely not blocked as a move towards censoring the internet. AT&T is rather bold when it comes to moves against the masses: About a year ago that AT&T had a job listing for about 2500 federal security clearance level jobs in San Antonio area for snooping (a joint site with the NSA, if I remember correctly), the case with the EFF is no secret, and there has been no secrecy in SBC/AT&T and the NARUS router frontier.

So what about the normal guys over at AT&T? What did they think about the whole mess?

As for what we thought? The normal 40-hour a day family man couldn’t care less than he did. The vast majority of workers had no clue – but the geeks, freaks, and techies all saw it and gave a sigh of «Great, we’ll get a shitstorm for this». Some were even tempted to let the storm come (Net neutrality doesn’t have a lot of fans among the people doing work, just the executives).

In the end, that subgroup of people that spend way too much time on the internet decided it was easier to fix the issue than to play dumb and let «the Company» eek out of it.  The correct person, that also happens to know what LOLCats, 4Chan, and other internet content are, was informed of the internal ticket and 4Chan was blocked, he checked and verified the SYN/ACK traffic had ceased and removed the block.

Honestly, until the PR group posted the official AT&T response, I doubt anyone outside the ISP side knew the issue occurred and I doubt Randall Stephenson knows that his Wikipedia page was massively edited or that iReport had him listed as dead.

So there you have it; the truth behind how AT&T unwittingly fired what many will consider the first shot in the war of Net Neutrality, propelling the issue into the searchlight. True or false, Soma’s story bear the markings of a real one – and if his story checks out, I guess we owe that AT&T «do-gooder» tech guy a thanks.

PLEASE DIGG: http://digg.com/tech_news/Uncovered_The_Truth_Behind_the_AT_T_4chan_Block

AT&T lifts 4chan-block, raid suspended

AT&T
AT&T

In a surprisingly swift move, AT&T has lifted the blockade of 4chan.org and its «/b/»-section.

We have earlier written about when and why the ban was put in place, but only 15-16 hours after the 4chan-block was first reported, CentralGadget and TechCrunch now reports that AT&T has indeed confirmed that the block has been lifted.

«AT&T has confirmed that they are currently blocking portions of the internet site 4chan.org, but states that they are «following the practices of their policy department.»»

At 11:15 PM, it appears AT&T have restored network-wide access to all areas of 4chan. Still, there has been no official confirmation to this from moot, the founder of 4chan.org.

On the «official» raid-forum, Anon rejoices and informs that «All rioting/’war’/protests have been suspended for the time being». That might be a good thing, considering there is already circulating rumors that Randall Stephenson, CEO of AT&T, has been found dead outside his home.

Assuming AT&T doesn’t repeat its mistakes, it seems the score is 0-1 in the fight between MegaCorp. vs. Net Neutrality – and another notch in the belt for 4chan’s Anonymous.

Digg: http://digg.com/gaming_news/AT_T_lifts_4chan_block_raid_suspended

AT&T blocks 4chan

UPDATED: Please view and digg the following:

Uncovered: The Truth Behind the AT&T 4chan-Block

Reports are spreading that AT&T is now blocking 4chan.org’s «/b/»-section.

Caption of 4chan.org
Caption of 4chan.org

Firing one of the first shots in the net neutrality war, AT&T has blocked 4chan’s /b/ image board. AT&T subscribers are unable to connect to /b/ and /r9k/ (both of which are hosted on img.4chan.org). However, subscribers can get on any of the so-called «worksafe» boards that 4chan.org offers.

The problem seems to be present only for wired connections only (AT&T Mobility customers are not affected). The problem is not caused by an DNS-error, as traceroutes indicates that AT&T is dropping img.4chan.org requests in the AT&T network.

Slashdot, Digg & Reddit are now running stories that are rapidly being upvoted about the topic.
http://www.reddit.com/r/reddit.com/comments/94pf2/att_is_now_blocking_all_access_to_img4chanorg/

As citizens of a free internet, what do we think about this kind of censorship?

UPDATED 1: Confirmation comes from several Reddit users that the website has indeed been blocked in a number of areas in the US and that it is not a technical issue.

UPDATED 2: A mere 5 hours after the problems were first reported on Reddit, sources on /b/ say that members of Anonymous has already started planning retaliation towards AT&T – amongst other things posting personal information about AT&T executives. One might quietly wonder if the AT&T megacorp. knows what’s it up against – with 4chan often being referred to as “The Internet Hate Machine”.

UPDATED 3: It turns out 15.5% of all US internet users use AT&T DSL, so this is quite a big problem. It will severly affect 4chan, both in regards of traffic and advertising volumes.

UPDATED 4: moot, the founder of 4chan, officially acknowledges the ban – calling for disconcerned users to «call or write customer support and corporate immediately»: http://status.4chan.org … Somehow, I get a feeling they’re gonna do a lot more than that, moot.

UPDATED 5: From rumors on /b/, it seems 4chan’s first retaliatory strike will be towards Randall Stephenson, CEO of AT&T. The Consumerist has more. There are also murmurs about the AT&T block being put into place because of supposed mass DDoS-attacks to and from img.4chan.org, but so far there has been no official, verifiable response from AT&T.

UPDATED 6: 4chan’s current gameplan evolving over at Encyclopedia Dramatica (Great stuff!). Also, from reports gathered on Reddit, it seems this block allegedly is because of massive DDoS-attacks against img.4chan.org.  The reports doesn’t say  anything about why AT&T would block 15.5% of all US internet users from using a specific website without any warning, though.

UPDATED 7: This article is now no. 1 on Digg.com – and has received more than 120.000 visitors in less than 10 hours. For now, I guess 4chan and Anon is showing AT&T its strength in pure numbers. Help spread the word, we need to raise awareness of this issue and Net neutrality.

UPDATED 8: According to CentralGadget, 4chan is now UNBLOCKED by AT&T. AT&T says they were «following the practices of their policy department», but that they have restored network-wide access to all areas of 4chan. Shitstorm averted? Also, according to CentralGadget, 4chan is currently down «due to a large DDOS attack, affecting most of 4chan’s servers.» This appears unrelated to the AT&T blockade, but may have been triggered by the high-profile attention that 4chan has received during the past 24 hours.

SSB og fri informasjonsflyt

Følg saken på Twitter: #ssbdata
I internett sin spede begynnelse runget krigsropet «Information wants to be free» blant cyber-aktivistene. Mottoet henspeilte på revolusjonen som internett representerte, og måten samfunnet og informasjonsvoktere måtte tilpasse seg dette nye mediet. Mange følte seg sikkert truet av dette (og noen er det fortsatt), men vi skriver 2009, og det er på tide at vi tar det neste steget: Vi må begynne å forlange fri informasjonsflyt, også fra myndighetene våre.

I en alder hvor myndighetene selv etterstreber åpen kildekode er det naturlig at Norske myndigheter også ser på relaterte områder for innovasjon. For åpen kildekode er vel og bra – men vel så viktig er fri informasjonsflyt. Den fremste informasjonsvokteren her til lands heter Statistisk Sentralbyrå, og forvalter en fantastisk mengde informasjon.

Statistisk sentralbyrå
SSB logoStatistisk sentralbyrå samler inn, bearbeider og formidler en rekke ulike statistiske undersøkelser hvert år, blant annet konsumprisindeksen, befolkningsstatistikk, kriminalitet, miljø, utdanning, innvandring, arbeidsmarked, helse og lønn. Statistisk sentralbyrå publiserer også prognoser for hvordan norsk og internasjonal økonomi vil utvikle seg i årene fremover – herunder renteutviklingen, arbeidsledigheten og veksten i bruttonasjonalproduktet (BNP).

Til tross for denne utstrakte dataekspertisen, så er ikke SSB representert på verken Twitter, Facebook eller i noen andre sosiale medier – og nettsidene deres er en dyster affære, hvor man kun kan hente ut informasjon via tungvinte tabeller. SSB tilbyr heller ingen form for såkalte API‘er for eksterne privatpersoner eller bedrifter. (til informasjon: Et API er et system som lar deg hente ut rådata på en enkel, automatisert måte – slik at disse dataene f. eks. kan sammenstilles med annen data utenfor sin opprinnelige kontekst).

En banal tanke
Audi automatgirJeg begynte først å tenke på hvor banalt dette var da jeg kjørte min nye Audi på vei hjem fra jobb en dag. Jeg tok nettopp førerkortet, og Audien min er utstyrt med automatgir. Det slo meg at automatgiret sørget for at jeg kunne konsentere meg mer om kjøringen. Min neste tanke var om det fantes ulykkesstatistikk som kunne underbygge dette; at automatgir er mindre involvert i ulykker, fordi føreren ikke trenger å tenke på giring.

Nå er jeg ikke sikker på om SSB i det hele tatt fører statistikk over dette, men tenk konsekvensene dersom man på selvstendig basis kunne sammenstille ulykkesstatistikk med informasjon om den involverte bilen hadde automatgir eller ikke. La oss tenke oss at det viste seg at biler med automatgir hadde 10% lavere sjanse for å havne i trafikkulykker; hvordan ville dette da påvirket ditt neste bilkjøp? Og – over tid – hvordan ville det påvirket norske lovgivere?

Et åpent, gratis API fra Statistisk sentralbyrå vil tillate borgerne av Norge å utføre statistiske sammenstillinger og analyser som SSB og myndighetene ikke selv har tid eller ressurser til å gjennomføre. Resultatene av denne crowdsourcingen vil være underbygget av offisielle data, og vil kunne etterprøves på en enkel og vitenskaplig måte.

Et åpent, gratis API
Andre applikasjonsområder for et åpent, gratis API fra Statistisk sentralbyrå kan være visuelle presentasjoner av statistisk data eller relevante, statistiske sammenstillinger som SSB ikke har mulighet til å foreta – slik som f. eks:

  • En mashup som viser økningen i BNP parallelt med kvinner i styrerommene
  • En graf som viser økningen i grensehandelen opp i mot arbeidsledigheten
  • En graf som viser norsk navnestatistikk opp i mot innvandringsveksten
  • Veksten i avfall (målt i tonn) opp i mot den generelle befolkningsveksten

Kort sagt; bare kreativiteten setter grenser for hvilken ny og spennende kunnskap vi kan tilegne oss som samfunn, dersom SSB først åpner slusene for sitt nysgjerrige folk.

I 1984 oppstod uttrykket «Information wants to be free» blant amerikanske cyber-aktivister, men 25 år senere er vi ikke helt der enda. En mer åpen holdning fra norske myndigheter og SSB til fri informasjonsflyt vil kunne bringe oss litt nærmere dette målet.

«Knowledge is Power» – Sir Francis Bacon, 1597.

Følg saken på Twitter: #ssbdata

(Retweet, kommenter og besøk gjerne min Twitter-profil)