Skip to content

Instantly share code, notes, and snippets.

View uggedal's full-sized avatar

Eivind Uggedal uggedal

View GitHub Profile
Hello world!
@-moz-document url-prefix(http://github.com/)
{
pre, code {
font-family: MonoSpace !important;
font-size: 9pt !important;
}
}
#!/usr/bin/env ruby
require 'rubygems'
require 'awesomer'
def meminfo(key)
`cat /proc/meminfo | grep #{key}`[/\d+/].to_i / 1024
end
def load
`uptime`[/e: (\d\.\d\d),/, 1]
Exam Objectives
Section 1: Declarations, Initialization and Scoping
* Develop code that declares classes (including abstract and all forms of nested classes), interfaces, and enums, and includes the appropriate use of package and import statements (including static imports).
* Develop code that declares an interface. Develop code that implements or extends one or more interfaces. Develop code that declares an abstract class. Develop code that extends an abstract class.
* Develop code that declares, initializes, and uses primitives, arrays, enums, and objects as static, instance, and local variables. Also, use legal identifiers for variable names.
* Develop code that declares both static and non-static methods, and - if appropriate - use method names that adhere to the JavaBeans naming standards. Also develop code that declares and uses a variable-length argument list.
* Given a code example, determine if a method is correctly overriding or overloading another method, and identif
Differences Between SCJP 5 and 6
================================
From the Objectives
-------------------
"Given a scenario involving ... interacting with the user ... develop
the correct solution using the following classes from Java.io:
... Console."
--- src/java/com/sun/syndication/io/impl/NumberParser.java
+++ src/java/com/sun/syndication/io/impl/NumberParser.java
@@ -34,6 +34,8 @@
if (null != str) {
try {
return Long.valueOf(Long.parseLong(str.trim()));
+ } catch (NoSuchMethodError e) {
+ return new Long(Long.parseLong(str.trim()));
} catch (Exception e) {
// :IGNORE:
"""
This fabric file makes setting up and deploying a django application much
easier, but it does make a few assumptions. Namely that you're using Git,
Apache and mod_wsgi and your using Debian or Ubuntu. Also you should have
Django installed on your local machine and SSH installed on both the local
machine and any servers you want to deploy to.
_note that I've used the name project_name throughout this example. Replace
this with whatever your project is called._
"""
This fabric file makes setting up and deploying a django application much
easier, but it does make a few assumptions. Namely that you're using Git,
Apache and mod_wsgi and your using Debian or Ubuntu. Also you should have
Django installed on your local machine and SSH installed on both the local
machine and any servers you want to deploy to.
_note that I've used the name project_name throughout this example. Replace
this with whatever your project is called._
#!/usr/bin/env python
from __future__ import with_statement
# Requires httplib2:
# easy_install httplib2
# or:
# pip install httplib2
import re
import sys
##
## Helper functions:
##
def force_unicode(s, encoding='utf-8', errors='strict'):
if not isinstance(s, unicode):
s = unicode(s, encoding, errors)
return s
def force_bytestring(s, encoding='utf-8', errors='strict', string_only=False):