Skip to content

Instantly share code, notes, and snippets.

View flyfire's full-sized avatar
🎯
Focusing

flyfire flyfire

🎯
Focusing
View GitHub Profile
#ifndef QUEUE_H
#define QUEUE_H
#include <stdexcept>
template <typename T>
class Queue {
static const int MAX_SIZE = 100;
int head, tail;
T queue[MAX_SIZE];
#ifndef STACK_H
#define STACK_H
#include <stdexcept>
template <typename T>
class Stack {
static const int MAX_SIZE = 100;
int top;
T stack[MAX_SIZE];
#include <iostream>
using namespace std;
void min_max(int a[], int size, int &min, int &max) {
int start;
if (size % 2) {
min = max = a[0];
start = 1;
}
#include <stdio.h>
void swap(int *a, int *b) {
if (a != b) {
*a ^= *b;
*b ^= *a;
*a ^= *b;
}
}
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
void insertion_sort(int a[], int size) {
for (int i = 1; i < size; ++i) {
int key = a[i];
int j = i - 1;

#LearningPython#

##Chapter01## HTMLGen可以从python类的描述中生成html文件。mod_python包可以使在Apache服务器上运行的python程序更具效率并支持python server page这样的服务器端模板,而且支持客户端运行的服务器端Applet。此外,Python涌现了许多Web开发工具包,例如,Django、TurboGears、Pylons、Zope和WebWare,使Python能够快速构建功能完善和高质量的网站。

为了在脚本中使用,在Python连接编译好组件时,例如,SWIG和SIP这样的代码生成工具可以让这部分工作自动完成。更大一些的框架,例如,Python的微软Windows所支持的COM、基于Java实现的Jython,基于.net实现的IronPython和各种Corba工具包,提供了多种不同的脚本组件。例如,在Windows中,Python脚本可利用框架对Microsoft Word和Excel文件进行脚本处理。

python标准的pickle模块提供了一个简单的对象持久化系统,它能够让程序轻松地将整个python对象保存和恢复至文件和文件类的对象中。在网络中,同样可以找到ZODB的第三方系统,他为python脚本提供了完整的面向对象数据库系统。从python2.5版本开始,SQLite已经成为python自带标准库的一部分了。

可以从Vaults of Parnassus以及新的PyPI网站找到其他领域的更多支持。

#!/usr/bin/env perl
# -*- coding: utf-8 -*-
use strict;
print <<END;
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
#!/bin/sh
# ADC downloader tool
#
# Usage:
# adc_download.sh [download URL]
#
# Michael Tyson, A Tasty Pixel <[email protected]>
#
# Multi-team support via Christopher Bowns (@cbowns, http://cbowns.com/)
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
import urllib
import os
from shutil import copyfile
HOSTS_URL='https://smarthosts.googlecode.com/svn/trunk/hosts'
LOCAL_HOSTS='/etc/hosts'