Wednesday, April 30, 2014

How to Solve Programming Problems if you're learning Programming

Things can and will go wrong when you first start dabbling in programming. As with all new skills, you are going to get frustrated. Here are a few tips that may help you work through the frustration and solve many of your own problems.

 

Language Learning

Do not forget you are effectively learning a new language, or even languages. You will not be fluent in twenty minutes. But you can expect to start building your skills to the point where you can complete simple tasks, progressing into more difficult situations. When you are presented with new code, it's important that you take the time to really understand it. If you whip through a tutorial or cut and paste code snippets you find online, you may end up with a program that runs, but you will not understand it, nor will you be able to generalize the skills and write your own programs. Once you've got something that works, try making a backup copy and then changing things in your code one at a time. If you can predict the effect that your changes will have, you have a good understanding of what is going on. When you are surprised by the effect of a change, you have an opportunity to learn something new. When you've got something that doesn't work, make a backup copy and then try eliminating things that you don't understand. What is the simplest version that you can get to work? Once you have that version, you can try adding in new code, one thing at a time.

 

Search Engines

If you run into difficulties when writing computer code the great news is that the answer to almost any problem can be found online. Computer programmers constantly seek and give help on forums and mailing lists, and the questions and subsequent answers are readily available. This means the Internet is usually your best resource for finding help. If you run into a problem, the first thing you should do is type your problem into a search engine. More often than not someone has already asked your exact question, and other people have provided a range of answers. You might even find entire websites dedicated to solving your particular problem. When you are just starting out, it is very unlikely that you will come across a problem that no one has encountered before. Likewise, if you encounter an error message that you don't understand, cut and paste that error message into a search engine and surround it with quotation marks. Typically you will find dozens of explanations for why this error appeared and how to fix it. The more specific that you can be about your problem, the better the results you will find. Don't be discouraged if you don’t find the answer on your first search. Rephrase the search terms and try again.

 

Forums

If you’ve Googled it, Yahoo’d it, and tried various combinations of teas, coffees and energy drinks to no avail, you're going to need to ask for help. There are many Internet forums and mailing lists to which you can turn. At the time of writing, my favourite forum for general programming questions is Stack Overflow. There is also Tutor, a mailing list where people who are learning Python can ask questions, and people who are interested in teaching Python can answer them. At any given time there are swarms of friendly, knowledgeable people just waiting to answer your question. If you post your problem in a courteous manner, with a little bit of luck you will have a solution within a couple of hours. Keep in mind that it is bad form to post a question in more than one place in quick succession. It may not be the instant gratification we’ve come to expect, but don't forget, these people are volunteering to help you, and most probably if you're desperate enough to ask for help, you could use a few hours away from the keyboard anyway. Go for a walk, take a nap, or do something else to clear your mind and some new ideas will come to you.

 

Asking Good Questions

Clarity and specificity are your friends when it comes to asking for help on a forum. The FAQ page on Stack Overflow's website is great reading for anyone looking to ask a question about programming online. Even if you do not use the Stack Overflow forums, the messages here are essential. Remember, the people who read forums and offer their expertise are busy; make it easy for them by carefully thinking out your problem before you ask. Likewise, make sure you are asking a specific question to a narrowly defined problem. For example, don’t post something like: "Why won't my code work?" Instead, try: "Why am I getting a syntax error when I try to Push a value into an Object?" Always post the relevant section of your code (and only the relevant section of your code) along with your question. If possible, remove any unnecessary bits that are not immediately relevant to the question to make it easier for experts to help you solve your problem. If the answer you get does not do the trick and you are still stuck, be polite and try rephrasing the question. Remember, don’t bite the hand that feeds you; these are volunteers and they’re trying to help you!

 

 Debugging

When fixing problem code, systematically change one thing at a time and retry your program after each change. Often if you make three or four changes before retrying the program, you will solve one issue, but cause another one. This is frustrating and confusing. By changing one thing at a time and making sure it works before moving on, you will prevent a lot of confusion. It also helps to make notes of the things that you have tried, and of the solution when you find one. The more time that you spend programming and debugging, the more familiar various kinds of errors will become.

---
This post was originally published as part of the Programming Historian, and was co-authored by William J. Turkel. It has been reposted here without permission because all work on the Programming Historian is licensed under a CC-BY license. Photo credit: Peter Alfred Hess

Saturday, January 18, 2014

Saturday, December 7, 2013

Crymble Awards, Best of 2013

For this, the third year running (2011 & 2012), I've decided to acknowledge five projects who have most influenced my academic development in the past year. Winners have come up with ideas or shared their knowledge in a way that's had a real difference on the way I've approached my own work. This influence isn't always possible to measure by counting up citations in footnotes, but it's important to recognize.

Narrowing the list down to five projects each year is a challenge; there is so much great work going on that's worthy of praise. Nonetheless, I present to you my Crymble Award winners for 2013. Thank you for your inspiration.

1) Jorge Cham and Meg Rosenburg, 'Big Data + Old History' PhD Comics.

Belovedly known for his academic comic series, PhD Comics, Jorge Cham challenged PhD students to describe their thesis in two minutes, with the promise that he'd animate the twelve best entries. I was fortunate enough to be selected as one of the winners, and I'm thrilled by how Cham and his colleague Meg Rosenburg transformed my words into an engaging two-minute cartoon. I've had great feedback from the video (I think a couple people even think I'm cool now), and it's certainly showed me that the written word is not the only way we can share stories about the past.



Thanks very much to both Jorge and Meg for including me in the project. It was a great experience and a lot of fun.

2) Adam Frost and Tobias Sturt, The Guardian Data Blog.

In March I attended a one-day masterclass hosted by The Guardian newspaper on data visualization and visual storytelling. My award goes to two of the presenters on the day: Adam Frost and Tobias Sturt, both of whom worked at the time for the Guardian's Digital Agency (for-hire Guardian visualization experts). The pair hosted a great session on how the team at the Guardian Data Blog take raw data to the finished products which capture our imagination.


I'd definitely recommend the workshop - though I note they've raised the price from £99 to £250 since I attended. Not only did I see some great data visualization examples, but it got me thinking about the importance of answering the oft-ignored: who cares? As Frost noted that morning, without clarity and persuasion, data is just a spreadsheet. Visualization is about bringing data to life for an audience, and I'm grateful for Frost and Sturt for making that so clear for me. The graphs and visualizations I've been creating for my thesis have changed markedly as a result of their work, and I like to think it has been for the better.

3) Jelle van Lottum, 'Labour Migration and Economic Performance: London and the Ranstad, c. 1600-1800', The Economic History Review. Vol. 64, No. 2 (2011): 531-570.

Van Lottum is a historian at the University of Birmingham, but this paper was part of his British Academy fellowship at the University of Cambridge a few years ago. I stumbled across Van Lottum's article when researching some background material for an paper I was preparing with some colleagues on lower-class migration into eighteenth century London. It was a bit of a eureka moment for me, as I had been fumbling around in a new field, unsure even of what I'd been looking to do, and this article provided me with exactly the type of framework I was after. Since reading this paper I've  been drawn into an entirely different side of history, and read much more widely than I might ever have done, deliving deeply into the work of some talented economic historians and historical demographers. I've found these new fields a wonderful compliment to my interest in social history, and I owe that in part to what turned out to be a great article by van Lottum.

4) Anne Alexander, Social Media Knowledge Exchange (SMKE).

Anne wins an award for standing up for students' fiscal needs. SMKE was a year-long project that invited students to pitch an idea related to social media and academia. Winners were offered a £500 budget and £500 for themselves. As someone funding my own education, this was an incredibly important opportunity for me. There are so many organizations out there offering funding to pay for conference travel, or for student-run initiatives to pay to bring in senior speakers, or even for expenses to go visit libraries. And yet I get the sense that there's a desperate attempt to ensure students aren't trusted with any money they might use to live on. Those who consider themselves older and wiser and who control the purse-strings of granting agencies of all sizes seem convinced that any money they give directly to students will go straight to the pub. I spent mine on my tuition bill. And I thank Anne heartily for giving me that opportunity by taking a stand and putting value on student work.

I incorporated Anne's idea into a workshop I hosted last month, passing on the bulk of the funding I had to early career students who gave talks at the event. I'd challenge others to do the same. Don't reimburse travel for students; offer grants or honorariums to students for participating, and empower them to make their own decisions about how they get there or where they stay. Thanks to Anne for showing me that.

5) Shoaib Sufi, Neil Chue Hong, Aleksandra Pawlik, et. al. Software Sustainability Institute (SSI).

This year's final award goes to the team at the Software Sustainability Institute, based at the University of Edinburgh. Until I saw the call put out by the SSI looking for fellows late last year, I had never even given a thought to the idea of software sustainability. Since applying (and winning!) sustainability has been a major part of my strategy for all of my work. I was introduced to a wonderful network of people in fields ranging from engineering and physics, to computer science and geography, all who are struggling to ensure their work is useable for the long-term. As a society we put so much time and money into building tools and programmes to assist our research, but so little into planning for the future of that work.

As part of my fellowship I was given £3,000 of funding, which I used to host an event, Sustainable History: Ensuring Today's Digital History Lasts. The event was held at the Institute of Historical Research in London (cohosted by Jane Winters and Tim Hitchcock) and brought together a great group of scholars and information professionals to discuss what historians can and should be doing to ensure their projects and their data survives. It's a little question, but one I'm glad the team at the SSI challenged me to think about.

 * * *

Congratulations to this year's winners, but more importantly, thank you to all of them for shaping the way I approach my research. You join a very talented group of previous winners. Keep on inspiring!

Winners for 2012 and current affiliations:
  • Julia Flanders (Northeastern University)
  • Luke Blaxill (University of Oxford)
  • Peter King (University of Leicester)
  • Andrew Marr (BBC)
  • Fred Gibbs (University of New Mexico) & Miriam Posner (UCLA)
Winners for 2011 and current affiliations:
  • Tim Hitchcock (University of Sussex) & William J. Turkel (Western University)
  • Tim Sherratt (National Library of Australia)
  • Ben Schmidt (Northeastern University)
  • Sean Kheraj (York University)
  • Jeremy Boggs (University of Virginia)
As a final aside, eight of the twelve previous winners have moved on to new institutions and more impressive positions since winning. Can we thank the Crymble Awards for tipping their applications over the threshold? I suppose we may never know...


Tuesday, October 29, 2013

Is Creative Commons Flexible Enough for Historians?

Gumby and Monkey, by Joe (CC-BY-SA)
Creative Commons licenses are incredibly useful. They're easy to use. More and more people understand them. It's even possible to do web searches of Creative Commons content making it easy to find content you can use with confidence. The Open Access movement, particularly in the UK, seems to be promoting Creative Commons licensing as the best way to move towards open access to research, because it means we can (largely) leave lawyers out of it all and implement a standard set of licenses that everyone understands (or should understand). I see the practical merits in that and am a big fan of keeping costs at a minimum. But I also see the counterpoint, that many historians feel Creative Commons just isn't designed for them (see my previous post on Alternative Licensing). Sometimes that feeling is based on a misunderstanding. Sometimes, I think, it's justified. In the interest of opening that discussion, I thought I'd present a couple of scenarios in which I believe Creative Commons is not flexible enough for historians looking to manage the rights associated with their research.

For all of these scenarios, let's assume the work in question is an academic monograph written solely by me.

1) Supporting certain derivations

What I want: I'd like people to be able to translate my book into a range of formats (braile, French, audio, stage performance) without having to ask me, provided that every effort is made to ensure that the translation accurately represents the arguments and positions of the original, and the translator is listed as such on the title page or where applicable. This reuse is only permitted if the entire work is included in the translation.

Why this is important to me: I'm a big supporter of accessibility; I wouldn't want anyone working to provide access to my work for the blind to feel they were prevented from doing that good work by a legal restriction.

Why CC is not sufficient: CC-BY would allow this type of reuse. But it would also allow someone to translate only the introduction, or to pick and choose parts and rearrange them in a way that changes my message. I'm worried if they do that someone might get the wrong idea about my work. You may not think that's important, but it's my book and my reputation, and I am worried. I could use a 'no derivatives' license, CC-BY-ND, but I do want to allow certain types of derivatives under certain conditions.

2) Supporting certain commercial reuses

What I want: I'd like professors creating course readers to feel empowered to use parts of my book with their students. I'd also like private individuals to be able to use individual chapters in edited collections with modest print runs (let's say less than 500). I don't want Evil Publishing Ltd to be able to do the same without asking.

Why this is important to me: I'm a big supporter of ensuring students and my colleagues have access to my work. I also think it's important to support small entrepreneurs. But I know that the publishing industry is big business, and if they're going to make big money from my ideas, I think it's fair to ask that I get a cut of that. Anyone who has ever licensed stock imagery to use on a website or in print knows that the price of the license changes with the number of 'impressions'. In essence, the bigger the advertising campaign, the more money they want to charge you to use the image. This merely attempts to apply those types of restrictions on my book.

Why CC is not sufficient: CC-BY wouldn't give me the power to put the restrictions on Evil Publishing Ltd that I believe is important. Forcing me to use CC in this instance forces me to give away rights I would like to hold onto.

* * *

Those are just a couple of simple examples, which I don't believe are far fetched when considering licensing and reuse from the historian's perspective. For them to work, I think at the very least we need to adopt a CC-BUT license, in which creators are allowed to add restrictions to their license. As I said before, if the concerns of licensors aren't met, they won't get on board. I'd like them on board, but that may need to come at the expense of what seems on the surface to be a simple CC solution.

Monday, October 28, 2013

Sustainable History: Ensuring today's digital history survives


28 November 2013
10am-3:30pm
Institute of Historical Research,
Malet St, London
WC1E 7HU

Register: https://www.eventbrite.co.uk/event/8989595121 

How long will our digital research survive? Historical scholarship is increasingly digital; and yet we do not have an agreed form of best practices for ensuring that digital scholarship lasts. Speakers at this one day workshop will share practical advice on a range of pressing issues for historians and cultural heritage professionals working with digital material. From ensuring research data is archived safely, to building sustainable strategies into your project workflows, and even learning from the mistakes of others, this event promises practical solutions for big challenges facing digital scholarship.

Registration is free, but spaces are limited (Register here: https://www.eventbrite.co.uk/event/8989595121).


Sponsored by the Software Sustainability Institute, the Institute of Historical Research, the Programming Historian 2, and The AHRC Theme Leader Fellowship for Digital Transformations. 





Programme

Registration / Welcome  9:30-10:15am
Keynote Addresses  10:15-11am
  • Professor Andrew Prescott, (Dept. of Digital Humanities, King’s College London)
  •  Neil Grindley(JISC)
Tea / Coffee  11am-11:15am
Session 1: Preserving Resources 11:15am-12:15pm
  • Dr. James Baker (British Library) ‘Preserving Research Data for the Future’
  • Jennifer Doyle (King’s College London) ‘Working with Cultural Heritage to Open Research Data’
Lunch 12:15pm -1pm
Session 2: Working Together for the Long-term 1pm-2:30pm                                    
  • Dr. Gethin Rees (University of Cambridge) ‘Capturing and Documenting Workflows for Historical Scholarship’
  • Mia Ridge (Open University) ‘Sustaining Collaboration from Afar’
  • Claire Donaghue (Imperial College London) ‘Strategies for Working Together on Large Projects’
Tea / Coffee 2:30-2:45  
Keynote Address and Open Discussion 2:45-3:30                                                       
  •  Dr. Peter Webster (British Library)




Thursday, October 24, 2013

Academic Freedom License: An Alternative to CC-BY

Professor Peter Mandler, President of the Royal Historical Society allegedly made this comment today at an Open Access event held in London. I was not at the event, but I have heard this concern expressed before: CC-BY licenses allow someone to take an academic work, completely twist the words of the author, and republish it in a way that suggests those are the opinions of the author (either intentionally or through ignorance).

The fear is certainly valid, whether you agree with the interpretation of the license or not. No academic would be happy with the idea of someone twisting their words and republishing something that, if misconstrued, could damage their reputation as a scholar.

I'm inclined to suggest that a CC-BY license does not in fact grant these rights, as the fine print about 'moral rights' points out, noting that 'derogatory treatment' of the licensor's work is not permitted.


Nevertheless, the terms of the license do suggest it is up to the licensor to monitor and police this activity, and if necessary, turn to the courts to enforce it. That's just not practical for a busy academic.

Remixing isn't the only problem. Copyright of images or graphs can also be an issue. Anyone who gives a public lecture these days will be familiar with the release forms that you're asked to sign that require you to grant someone the right to reproduce images and graphs you don't own that happen to be on your powerpoint slides. Academic monographs have the same problem. How can we release our content as open access if the work contains someone else's work for which we have had to ask permission?

If I'm not mistaken, these two issues are the biggest objections to CC-BY licenses for the humanities and social sciences. Thankfully, Professor Mandler has offered another solution, and I'm all for solutions:

New License needed for HSS (Humanities and Social Sciences)

What a fabulous idea. What on earth are we waiting for? I present to you all for consultation: the Academic Freedom License, designed specifically with the needs of academics in mind, that both promotes open access and reuse, and prevents the types of abuses outlined above.

Academic Freedom License

For works released under an 'Academic Freedom License', you are granted the right:

To Share - to copy, distribute and transmit the work in its entirety only.
To Analyse - to data mine and study the work and publish or create work of your own based on that analysis.
To Sell - to make commercial use of the work in its entirety only.

Under the following conditions:

Attribution - You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work)

Excluding - You are prohibited from sharing, analysing, or selling any aspects of the work specified by the author or licensor (such as images under copyright or sections not produced by the author)

With the understanding that:

Waiver - Any of the above conditions can be waived if you get permission from the copyright holder.

Public Domain - Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license.

Other Rights - In no way are any of the following rights affected by the license:
  • Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations;
  • the author's moral rights
  • Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights

Thursday, October 10, 2013

Would you buy a product to support digital humanities?

I'm launching an experiment, and I'd love for you to be involved. My PhD funding has just run out and I've been given a final £350 tuition bill during what's known as my 'writing up' period. In my search for solutions to cover this cost, I've found dozens of small grants that will pay for me to buy train tickets or hotel stays for research trips or conferences. I've found dozens more that will let me buy train tickets or hotel stays for others to come to a conference I'd organize. I can even get money to buy equipment for my research projects. But no one will give me money to pay my rather modest fees.

So I've decided to be creative. Crowdfunding has become rather trendy lately. Sites such as Kickstarter are even being taught as part of digital humanities courses, suggesting those of us in the field need to get out there and convince the public to part with some money in support of the research we do. Shawn Graham at Carleton University is now using this idea to raise money for an Undergraduate Scholarship in digital history, with funds to be matched by his university if he meets a certain threshold, and I wish him the best with what I consider a great initiative. But I know the marketplace can only handle so many campaigns that take the same form. So I've decided to go another route and ask: would you buy a product if you knew the procedes went to support digital humanities? Or more specifically: helped to pay my tuition fees?

So I've teamed up with Cafepress, and designed some digital humanities schwag to tempt you into my experiment. I've focused my product line on three key areas for the digital humanities:

  1. Bags and Electronics - Your electronics never looked so digital humanities
  2. Baby Clothes - Your baby makes digital humanities look good
  3. Mugs and Water Bottles - Support digital humanities while you drink


All of my profits will go directly towards my tuition fees. And in the interest of this experiment, I'll report back on progress at the end of 2013 when these limited edition products will disappear FOREVER! Are baby clothes the key to the future of digital humanities? We'll soon find out.

I thank you most humbly for your support.
Edited note: It has been wisely pointed out to me that not everyone needs baby clothes or more 'stuff'. If you'd like to contribute directly, I've set up a link through Paypal where you can do so. Thanks again.