UPD: задачи и решения переехали:
import com.sun.net.httpserver.HttpExchange; | |
import com.sun.net.httpserver.HttpHandler; | |
import com.sun.net.httpserver.HttpServer; | |
import java.io.*; | |
import java.net.InetSocketAddress; | |
import java.nio.charset.StandardCharsets; | |
import java.text.ParseException; | |
import java.text.SimpleDateFormat; | |
import java.util.*; |
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
require 'date' | |
def bad_usage | |
puts "Usage: ledger_graph <output.svg> month_expenses <limit> [<year> <month>]" | |
puts " or: ledger_graph <output.svg> last_assets <months>" | |
exit | |
end |
import gettext | |
lang = gettext.translation("wtf") | |
_ = lang.gettext | |
print(_("Program started")) # prints translated message | |
def work_hard(): | |
print(_("Working hard")) # raises UnboundLocalError: local variable '_' referenced before assignment | |
# |
for f in "$@" | |
do | |
if [ "`GetFileInfo -ae "$f"`" == "0" ] | |
then | |
SetFile -a E "$f" | |
else | |
SetFile -a e "$f" | |
fi | |
done |
import java.util.Iterator; | |
import java.util.NoSuchElementException; | |
final class Tree<T> { | |
private final T elem; | |
private final Tree<T> parent; | |
private Tree(T elem, Tree<T> parent) { | |
this.elem = elem; |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <stdbool.h> | |
typedef enum eChildKind { | |
LEFT, | |
RIGHT, | |
} ChildKind; |
The problem was fixed in less than a day after publication of this page.
Speaker Deck uses nice OpenSans font. However some characters are rendered using other fonts, e.g. cyrillic characters.
So if you mix in description both latin and cyrillic characters it looks bad. Latin characters are rendered using [lite 300 OpenSans
public class Absents { | |
public static void main(String args[]) { | |
try { callClone(null); } catch (Throwable e) { System.out.println(e); } | |
try { callToString(null); } catch (Throwable e) { System.out.println(e); } | |
} | |
static void callClone(Fail[] arr) { | |
arr.clone(); | |
} |
Original post at Coursera's proglang discussion forum is here.
After reviewing code of other students I formulated one very common problem: mixing tabs and spaces.
If student writes his code in editor which inserts tabs as is (as '\t'
character) it is OK. However when student starts to add extra formatting with
spaces (e.g. align if
, then
and else
) his code becomes a problem. Look at
the example with tab width 4 (tabs are shown as ->
, spaces as spaces):