CategorySite News

The book that I’ve been working on for some time is nearly finished. It is aimed at teaching young adults programming in a more formal setting, each chapter is a single lesson that can be taught over 1-2 hours. There are some draft chapters already available on the learning to program page, the completed chapters will be added here eventually.

The real aim is to produce a set of materials that can be used by students and an additional set of materials aimed at the teachers, including further reading and explanation of what happens in each session as well as model answers and suggested homework.

It will initially be released as an eBook and print copies available separately.

Merry Christmas!

Merry Christmas from me at Acodemics!

Here’s a little bit of code that will make snowfall in your terminal, it’s awkward on purpose 🙂

 

I think I should finally commit to using this site for something. Anytime I find out something useful or create something that has a remote chance of being reused I will stick it on here.

Maybe it could actually live up to the Acodemic name.

WordPress Twitter Integration

Moved host from the fairly useless 123-reg and am now with http://krystal.co.uk/ (their servers are located in an ex MOD bunker!), so I thought it was high time to give the website the usual refresh and do up. This time I am using WordPress and so far so good really. Excellent support and community, simply fantastic administration section. Couldn’t ask for more.

I’m in the process of adding features and fixing things around the site. Also I am moving content over from the old site to here as it can’t be easily imported. The old site is still available using an alternate link, http://www.low-tech.co.uk/, which will be moved over at a later date.

So one thing I thought I’d share is how I integrated my Twitter feed into my main feed on the site as I saw a few people asking about it and there isn’t a plugin available for it. It’s very simple really but requires editing of PHP files, I might make it into a plugin when I have a bit of spare time to learn how plugins work.

Firstly you need to set up some cron job or alternative for downloading your Twitter RSS feed however frequently you like. Your Twitter RSS feed is located at:

https://twitter.com/statuses/user_timeline/{your_twitter_username}.rss

Once you have got that inside a folder it’s time to parse it. Instead of using some sort of XML parser I am instead using a nice XML2Array function that I found here http://www.bin-co.com/php/scripts/xml2array/.

Create a function in your functions.php file to parse your RSS feed, mine looks like this.

Now in your home.php or index.php you need to use that function to get your array of tweets and then put them into your main feed. The idea is that in your main while loop you first check your tweet array to see if you have tweets that are newer than that post, if there are then display the tweet and remove it from the array. Eventually all the tweets left are older than the posts on that page so you can just output them at the end.

My home.php has this inside the main loop with $tweets being the array of tweets.

At the end simply repeat the foreach loop to print the remaining tweets in the tweet array.

© 2018 Acodemics

Theme by Anders NorénUp ↑