Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| import hypermedia.video.*; // Imports the OpenCV library | |
| OpenCV opencv; // Creates a new OpenCV object | |
| PImage movementImg; // Creates a new PImage to hold the movement image | |
| int poppedBubbles; // Creates a variable to hold the total number of popped bubbles | |
| ArrayList bubbles; // Creates an ArrayList to hold the Bubble objects | |
| PImage bubblePNG; // Creates a PImage that will hold the image of the bubble | |
| PFont font; // Creates a new font object | |
| void setup() |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| __author__ = "Deepak.G.R." | |
| __credits__ = "Sumod Hajela" | |
| __license__ = 'Public Domain' | |
| """ | |
| usage: | |
| Go to command line and type |
| bool find_large_contour_center_of_gravity(cv::Mat &src_img, cv::Point &result) | |
| { | |
| cv::Mat gray_img, bin_img, erode_img, dilate_img; | |
| std::vector<std::vector<cv::Point> > contours; | |
| int max_area = 0; | |
| std::vector<cv::Point> large_contour; | |
| std::vector<cv::Point> convex_hull; | |
| // convert to grayscale | |
| cv::cvtColor(src_img, gray_img, CV_BGR2GRAY); |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| #!/usr/bin/env python | |
| # coding:utf-8 | |
| import sys | |
| import os | |
| import re | |
| import gevent | |
| import gevent.monkey | |
| import gevent.timeout | |
| gevent.monkey.patch_all() |
| ` | |
| // vim: nowrap | |
| // Copyright (c) 2013, smilekzs. (MIT Licensed) | |
| // ==UserScript== | |
| // @name renren-markdown | |
| // @namespace http://github.com/smilekzs | |
| // @version 0.4.15 | |
| // @description write well-formatted blogs on renren.com with markdown | |
| // @include *blog.renren.com/blog/*Blog* | |
| // @include *blog.renren.com/*Entry* |
| #!/usr/bin/env bash | |
| deliver_target=(example1@kindle.cn example2@kindle.cn) | |
| smtp_account="your-deliver@your-gmail.com" | |
| smpt_password="******" | |
| issue_archive_dir="/srv/ebook-deliver/archives" | |
| issue_name="solidot-$(date +%Y%m%d)" |
| var ids = document.querySelectorAll(".member_id"); | |
| var names = document.querySelectorAll(".member_name"); | |
| var output = "", length = ids.length; | |
| for(var i=0; i<length; i++){ | |
| output += ids[i].innerHTML.slice(1,-1) + ":" + names[i].innerHTML + "\n"; | |
| } | |
| console.log(output); |