- Meet Python - Python Basics
- Sharing Your Code
- Files and Exceptions
- Persistence: Saving Data to Files
- Comprehending Data
- Custom Data Objects
- Web Development
- Mobile App Development
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Contained within are all the useful functions learned in CS 341 this past semester (Fall 2012). | |
; NOTE: Any functions used that are not defined in this file are built-in functions in either | |
; MIT-Scheme or Racket. | |
; length | |
; returns the length of the input list | |
(define length | |
(lambda (ls) | |
(if (null? ls) | |
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Contained within are all the useful Prolog functions learned in CS 341 this past semester (Fall 2012). | |
% NOTE: Any functions used that are not defined in this file are built-in functions. | |
% length(+As,-N) | |
% returns in N the length of the list As | |
length([],0). | |
length([A|As],N) :- length(As,M), N is M+1. | |
% append(+As,+Bs,-Cs) | |
% returns in Cs the append of lists As and Bs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
/* constants */ | |
#define NUM 257 | |
/* global */ | |
int currentToken; | |
int currentAttribute; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A basic implementation of the Singleton design pattern for reference. | |
*/ | |
public class Singleton { | |
/** | |
* Stores the only instance of this object. The 'volatile' keyword ensures | |
* that multiple threads handle the uniqueInstance variable correctly when it | |
* is being initialized to the Singleton instance. | |
*/ | |
private volatile static Singleton uniqueInstance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ServletThreadSafety extends HttpServlet { | |
/* | |
* Since we have the context lock, we're assuming that once we get inside the synzchonized block, | |
* the context attributes are safe from other threads until we exit the block... soft of. Safe | |
* means "safe from any other code that ALSO synchonizes on the ServletContext". | |
* | |
* But this is the best you've got for making the context attributes as thread-safe as you can. | |
*/ | |
@Override | |
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Store the full directory name of the executing script, no matter where it is | |
# being called from. This will work as long as the last component of the path | |
# used to find the script is not a symlink; directory links are OK. | |
# SEE: http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
echo $DIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Store the full directory name of the executing script, no matter where it is | |
# being called from. This will work as long as the last component of the path | |
# used to find the script is not a symlink; directory links are OK. | |
# SEE: http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
echo ${DIR} |