klenwell information services : SpecialCocktailNapkin

Revision history for SpecialCocktailNapkin


Revision [3104]

Last edited on 2017-05-25 18:46:49 by KlenwellAdmin
Additions:
==== 2016 ====


Revision [3094]

Edited on 2016-09-10 05:41:32 by KlenwellAdmin
Additions:
=== Online Classes ===
Stanford Online [[http://online.stanford.edu/course/computer-science-101-self-paced|CS 101 Course]]


Revision [3093]

Edited on 2016-08-29 23:13:52 by KlenwellAdmin
Additions:
=== App Engine Mail Processor ===
https://cloud.google.com/appengine/docs/python/mail/receiving-mail-with-mail-api


Revision [3088]

Edited on 2016-08-25 16:22:36 by KlenwellAdmin
Additions:
Wilde's Phrases and Philosophies
[[https://news.ycombinator.com/item?id=12246556 | Why I'm Not a Fan of Scrum]] (Hacker News)
Deletions:
~- Wilde's Phrases and Philosophies
~- [[https://news.ycombinator.com/item?id=12246556 | Why I'm Not a Fan of Scrum]] (Hacker News)


Revision [3087]

Edited on 2016-08-25 16:22:15 by KlenwellAdmin
Additions:
=== Passpack ===
~- Wilde's Phrases and Philosophies
=== On Scrum ===


Revision [3086]

Edited on 2016-08-09 03:21:32 by KlenwellAdmin

No Differences

Revision [3085]

Edited on 2016-08-09 03:21:07 by KlenwellAdmin
Additions:
~- [[https://news.ycombinator.com/item?id=12246556 | Why I'm Not a Fan of Scrum]] (Hacker News)


Revision [3084]

Edited on 2016-07-28 15:43:22 by KlenwellAdmin
Additions:
=== Project Idea: Scrum App ===
=== Problem Solving with Data Structures and Algorithms ===
Deletions:
==== Project Idea: Scrum App ====
==== Problem Solving with Data Structures and Algorithms ====


Revision [3083]

Edited on 2016-07-28 15:42:45 by KlenwellAdmin
Additions:
==== Project Idea: Scrum App ====
See https://news.ycombinator.com/item?id=12177915.


Revision [3079]

Edited on 2016-07-09 16:54:44 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
""<small>links and notes for later organization</small>"">>[[CocktailNapkin2015 | 2015 Napkin]]
[[CocktailNapkin2014 | 2014 Napkin]]
[[CocktailNapkin2013 | 2013 Napkin]]
[[CocktailNapkin2012 | 2012 Napkin]]
[[CocktailNapkin2011 | 2011 Napkin]]
[[CocktailNapkin2010 | 2010 Napkin]]
[[CocktailNapkin2009 | 2009 Napkin]]
[[CocktailNapkin2008 | 2008 Napkin]]
[[CocktailNapkin2007 | 2007 Napkin]]>>
[[http://interactivepython.org/runestone/static/pythonds/index.html#introduction | Introduction]]
Deletions:
""<small>links and notes for later organization</small>"">>[[CocktailNapkin2015 2015 Napkin]]
[[CocktailNapkin2014 2014 Napkin]]
[[CocktailNapkin2013 2013 Napkin]]
[[CocktailNapkin2012 2012 Napkin]]
[[CocktailNapkin2011 2011 Napkin]]
[[CocktailNapkin2010 2010 Napkin]]
[[CocktailNapkin2009 2009 Napkin]]
[[CocktailNapkin2008 2008 Napkin]]
[[CocktailNapkin2007 2007 Napkin]]>>
[[http://interactivepython.org/runestone/static/pythonds/index.html#introduction Introduction]]


Revision [2917]

Edited on 2016-01-03 22:26:06 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
==== Problem Solving with Data Structures and Algorithms ====
[[http://interactivepython.org/runestone/static/pythonds/index.html#introduction Introduction]]


Revision [2914]

Edited on 2016-01-03 10:24:05 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
""<small>links and notes for later organization</small>"">>[[CocktailNapkin2015 2015 Napkin]]
[[CocktailNapkin2014 2014 Napkin]]
Deletions:
""<small>links and notes for later organization</small>"">>[[CocktailNapkin2014 2014 Napkin]]
=== Data Structures and Algorithms ===
~- [[http://interactivepython.org/runestone/static/pythonds/index.html | http://interactivepython.org/]]
~- http://visualgo.net/
~- [[http://www.cs.usfca.edu/~galles/visualization/Algorithms.html | http://www.cs.usfca.edu/~galles/]]
=== Rubocop with Minitest ===
%%(ruby)
# lib/tasks/test.rake
require 'rubocop/rake_task'
# Add additional test suite definitions to the default test task here
namespace :test do
desc 'Run RuboCop on all ruby source directories'
RuboCop::RakeTask.new(:rubocop) do |task|
task.patterns = ['lib/**/*.rb', 'app/**/*.rb', 'test/**/*.rb']
# Abort on failures (fix your code first)
task.fail_on_error = false
end
end
Rake::Task[:test].enhance ['test:rubocop']
%%
=== JSHint with Minitest ===
%%(ruby)
# lib/tasks/jshint.rake
desc "jshint"
task :jshint do
puts "# Running jshint:"
puts `jshint app/assets/javascripts/*`
raise "jshint did not run successfully" if ($?.exitstatus != 0)
puts "No errors found.\n\n"
end
Rake::Task[:test].enhance [:jshint]
%%
=== Rails Styling ===
~- SASS
~- Less
~- CDN
=== Wikka Formatter ===
%%(php)
<?php
/**
* https://gist.github.com/klenwell/d8e0555986f6c4639c51
* formatters/wikka_to_html.php
*/
class WikkaToHtmlFormatter {
public __construct($wikka) {
$this->wikka = $wikka;
}
public function to_xhtml($wikka_markup) {
$wikka_markup = $this->normalize_line_breaks($wikka_markup);
$xhtml = $this->wwml_to_xhtml($wikka_markup);
$xhtml = $this->snip_last_br_tag($xhtml);
$xhtml = $this->close_open_tags($xhtml);
$xhtml = $this->enhance_xhtml($xhtml);
$xhtml = $this->inject_actions($xhtml);
return $xhtml;
}
private function normalize_line_breaks($wikka_markup) {}
private function wwml_to_xhtml($wikka_markup) {}
private function snip_last_br_tag($xhtml) {}
private function close_open_tags($xhtml) {}
private function enhance_xhtml($xhtml) {}
private function inject_actions($xhtml) {}
}
%%
%%(php)
<?php
/**
* handlers/api/api.php
* http://localhost:3000/wikka.php?wakka=FormattingRules/api
*/
$test_markup = $this->page['body'];
// Old formatter: formatters/wakka.php
$expected = $this->Format($test_markup, 'wakka', 'page');
// New formatter: formatters/wikka_to_html.php
require_once('formatters/wikka_to_html.php');
$formatter = new WikkaToHtmlFormatter($this);
$xhtml = $formatter->to_xhtml($test_markup);
if ( $xhtml === $expected ) {
die('new formatter passed');
}
else {
print '<h4>Failed</h4>';
printf('<h2>Expected</h2><pre>%s</pre>',
Wakka::hsc_secure($expected,ENT_QUOTES));
print '<hr />';
printf('<h2>New Formatter</h2><pre>%s</pre>',
Wakka::hsc_secure($xhtml,ENT_QUOTES));
die('new formatter failed');
}
%%
=== On Long Hours and Productivity ===
Comment on [[http://www.adaptrm.com/blog/9-ways-to-be-more-productive-backed-by-science/ article]] that got flagged on HN:
> Studies shown if you lower your daily work hours from 20 to 8 and work 5 days instead of 6, your productivity increases!
#1 reaffirms something I strongly believe (whether on the basis of personal experience, something I've read before, or mere wishful thinking, I don't recall). It is a sensible constraint that came to mind in reading all the Amazon horror stories.
While reading that New York Times article I checked out the link to their 14 sacred principles. The funny thing was that I agreed with most of them. They were all ideas that occurred to me over the course of my career working independently, with small companies, and especially now in corp.
The one thing that was missing, I felt, was a Rule #15: Never work more than 8 hours a day.
Without it, it's no surprise you end up with the sort of dystopian workplace documented in the Times article and all over Reddit and HN here.
But then I suppose, as has been pointed before, long work hours are more about cultural signaling and penny-wise-pound-foolish accounting than really improving productivity.
=== ScoutWorks ===
WikiFish
~- [[https://github.com/jgm/pandoc Pandoc]]
~- [[https://github.com/ryakad/pandoc-php Pandoc-Php]]
=== Wikka Refactor ===
~- Merge Strategy
~- Functional Tests
~- Automated Deployment
=== Bundle, Rake, and rbenv ===
See http://benscheirman.com/2013/12/using-rbenv-in-cron-jobs/
=== Rails DOM Test with Nokogiri ===
Because ##assert_select## kinda sucks sometimes:
%%
# Collect rows and shift off header row. I'm using Nokogiri instead of css_select
# because I need to drill down to text node, which css_select makes hard if not
# impossible. Better element identifiers in template could have probably avoided this.
page = Nokogiri::HTML(@response.body)
transaction_rows = page.css("table#transactions tr")
transaction_rows.shift
%%
=== Unpublished Comment ===
https://news.ycombinator.com/item?id=9525582
I was hoping her model would get past the obvious shortcomings she glosses citing Yelp review at the end. I don't think Bernard Mandeville's poem is going to get us there.
The Righteous Society model sounds a lot like what we got on the Internet right now. See China's Human Search Engine for examples of this model in action:
http://www.bbc.com/news/magazine-25913472
I'm all for heroic efforts to spread justice. It's just that the old-fashioned techniques, marching in the streets, maybe even throwing a trash can through a shop window, seem like more measured approaches than a lot of what I seen come from the internet.
=== Interview Portfolio ===
http://www.codequizzes.com/
[[https://drive.google.com/folderview?id=0B6K9xXSLapkzfkhlX0NJTmZCa2hIcDFFa1pVVXFLOENsTGc1RUZmZ29TRGxPQ001NGdsaTQ&usp=sharing Google Drive]]
=== Wikka Before and After ===
Before: [[https://github.com/klenwell/WikkaWiki/blob/9dfc1/wikka.php wikka.php]]
After: [[https://github.com/klenwell/WikkaWiki/blob/klenwell-refactor/wikka.php wikka.php]]
=== Python with Jenkins ===
http://shiningpanda.com/python-multiple-versions-testing-with.html
=== Quick Temp Rails Controller ===
%%
# app/controllers/temps_controller.rb
# Add to routes.rb:
# resources :accounts, only: [:index]
class TempsController < ApplicationController
# GET /
def index
render html: 'hello world', layout: "application"
end
end
%%


Revision [2913]

Edited on 2015-12-31 07:40:59 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- [[http://interactivepython.org/runestone/static/pythonds/index.html | http://interactivepython.org/]]
Deletions:
~- http://interactivepython.org/runestone/static/pythonds/index.html


Revision [2912]

Edited on 2015-12-31 07:40:37 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- [[http://www.cs.usfca.edu/~galles/visualization/Algorithms.html | http://www.cs.usfca.edu/~galles/]]
Deletions:
~- http://www.cs.usfca.edu/~galles/visualization/Algorithms.html
~- ++Rockefeller Bot Models++
~- ++The Reboot++
~- SOQWA (Stack Overflow Questions Worth Answering)
~- http://www.cs.usfca.edu/~galles/visualization/Algorithms.html


Revision [2911]

Edited on 2015-12-31 07:39:51 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Data Structures and Algorithms ===
~- http://interactivepython.org/runestone/static/pythonds/index.html


Revision [2907]

Edited on 2015-12-01 09:55:08 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== JSHint with Minitest ===
# lib/tasks/jshint.rake
desc "jshint"
task :jshint do
puts "# Running jshint:"
puts `jshint app/assets/javascripts/*`
raise "jshint did not run successfully" if ($?.exitstatus != 0)
puts "No errors found.\n\n"
Rake::Task[:test].enhance [:jshint]


Revision [2906]

Edited on 2015-12-01 08:13:02 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Rubocop with Minitest ===
%%(ruby)
# lib/tasks/test.rake
require 'rubocop/rake_task'
# Add additional test suite definitions to the default test task here
namespace :test do
desc 'Run RuboCop on all ruby source directories'
RuboCop::RakeTask.new(:rubocop) do |task|
task.patterns = ['lib/**/*.rb', 'app/**/*.rb', 'test/**/*.rb']
# Abort on failures (fix your code first)
task.fail_on_error = false
Rake::Task[:test].enhance ['test:rubocop']


Revision [2905]

Edited on 2015-11-29 10:40:28 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Rails Styling ===
~- SASS
~- Less
~- CDN


Revision [2900]

Edited on 2015-10-20 07:29:06 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- http://visualgo.net/
~- http://www.cs.usfca.edu/~galles/visualization/Algorithms.html
Deletions:
~- Quicksort
~- Binary Search


Revision [2893]

Edited on 2015-09-07 10:14:46 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- SOQWA (Stack Overflow Questions Worth Answering)
Deletions:
~- SOQWA


Revision [2892]

Edited on 2015-09-07 10:14:13 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- SOQWA


Revision [2891]

Edited on 2015-09-06 11:37:31 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- ++Rockefeller Bot Models++
~- ++The Reboot++
~- Quicksort
~- Binary Search
Deletions:
~- Rockefeller Bot Models
~- The Reboot


Revision [2890]

Edited on 2015-09-01 15:20:56 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
$test_markup = $this->page['body'];
$expected = $this->Format($test_markup, 'wakka', 'page');
$formatter = new WikkaToHtmlFormatter($this);
$xhtml = $formatter->to_xhtml($test_markup);
if ( $xhtml === $expected ) {
print '<hr />';
Wakka::hsc_secure($xhtml,ENT_QUOTES));
Deletions:
$expected = $this->Format($this->page['body'], 'wakka', 'page');
$formatter = new WikkaToHtmlFormatter();
$html = $formatter->to_html($this->page['body']);
if ( $html === $expected ) {
Wakka::hsc_secure($html,ENT_QUOTES));


Revision [2889]

Edited on 2015-09-01 15:07:12 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
* https://gist.github.com/klenwell/d8e0555986f6c4639c51
* formatters/wikka_to_html.php
Deletions:
* https://gist.github.com/klenwell/d8e0555986f6c4639c51
* formatters/wikka_to_html.php


Revision [2888]

Edited on 2015-09-01 15:06:52 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
* https://gist.github.com/klenwell/d8e0555986f6c4639c51


Revision [2887]

Edited on 2015-09-01 15:01:46 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
public __construct($wikka) {
$this->wikka = $wikka;
public function to_xhtml($wikka_markup) {
$wikka_markup = $this->normalize_line_breaks($wikka_markup);
$xhtml = $this->wwml_to_xhtml($wikka_markup);
$xhtml = $this->snip_last_br_tag($xhtml);
$xhtml = $this->close_open_tags($xhtml);
$xhtml = $this->enhance_xhtml($xhtml);
$xhtml = $this->inject_actions($xhtml);
return $xhtml;
private function normalize_line_breaks($wikka_markup) {}
private function wwml_to_xhtml($wikka_markup) {}
private function snip_last_br_tag($xhtml) {}
private function close_open_tags($xhtml) {}
private function enhance_xhtml($xhtml) {}
private function inject_actions($xhtml) {}
Deletions:
public function to_html($wikka_markup) {
return $wikka_markup;


Revision [2886]

Edited on 2015-09-01 15:00:53 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
public function to_html($wikka_markup) {
return $wikka_markup;
}
%%
* handlers/api/api.php
* http://localhost:3000/wikka.php?wakka=FormattingRules/api
// Old formatter: formatters/wakka.php
$expected = $this->Format($this->page['body'], 'wakka', 'page');
// New formatter: formatters/wikka_to_html.php
require_once('formatters/wikka_to_html.php');
$formatter = new WikkaToHtmlFormatter();
$html = $formatter->to_html($this->page['body']);
if ( $html === $expected ) {
die('new formatter passed');
}
else {
print '<h4>Failed</h4>';
printf('<h2>Expected</h2><pre>%s</pre>',
Wakka::hsc_secure($expected,ENT_QUOTES));
printf('<h2>New Formatter</h2><pre>%s</pre>',
Wakka::hsc_secure($html,ENT_QUOTES));
die('new formatter failed');
}
%%
=== On Long Hours and Productivity ===
Comment on [[http://www.adaptrm.com/blog/9-ways-to-be-more-productive-backed-by-science/ article]] that got flagged on HN:
> Studies shown if you lower your daily work hours from 20 to 8 and work 5 days instead of 6, your productivity increases!
#1 reaffirms something I strongly believe (whether on the basis of personal experience, something I've read before, or mere wishful thinking, I don't recall). It is a sensible constraint that came to mind in reading all the Amazon horror stories.
While reading that New York Times article I checked out the link to their 14 sacred principles. The funny thing was that I agreed with most of them. They were all ideas that occurred to me over the course of my career working independently, with small companies, and especially now in corp.
The one thing that was missing, I felt, was a Rule #15: Never work more than 8 hours a day.
Without it, it's no surprise you end up with the sort of dystopian workplace documented in the Times article and all over Reddit and HN here.
But then I suppose, as has been pointed before, long work hours are more about cultural signaling and penny-wise-pound-foolish accounting than really improving productivity.
WikiFish
~- [[https://github.com/jgm/pandoc Pandoc]]
~- [[https://github.com/ryakad/pandoc-php Pandoc-Php]]
=== Wikka Refactor ===
~- Merge Strategy
~- Functional Tests
~- Automated Deployment
=== Bundle, Rake, and rbenv ===
See http://benscheirman.com/2013/12/using-rbenv-in-cron-jobs/
=== Rails DOM Test with Nokogiri ===
Because ##assert_select## kinda sucks sometimes:
%%
# Collect rows and shift off header row. I'm using Nokogiri instead of css_select
# because I need to drill down to text node, which css_select makes hard if not
# impossible. Better element identifiers in template could have probably avoided this.
page = Nokogiri::HTML(@response.body)
transaction_rows = page.css("table#transactions tr")
transaction_rows.shift
%%
=== Unpublished Comment ===
https://news.ycombinator.com/item?id=9525582
I was hoping her model would get past the obvious shortcomings she glosses citing Yelp review at the end. I don't think Bernard Mandeville's poem is going to get us there.
The Righteous Society model sounds a lot like what we got on the Internet right now. See China's Human Search Engine for examples of this model in action:
http://www.bbc.com/news/magazine-25913472
I'm all for heroic efforts to spread justice. It's just that the old-fashioned techniques, marching in the streets, maybe even throwing a trash can through a shop window, seem like more measured approaches than a lot of what I seen come from the internet.
=== Interview Portfolio ===
http://www.codequizzes.com/
[[https://drive.google.com/folderview?id=0B6K9xXSLapkzfkhlX0NJTmZCa2hIcDFFa1pVVXFLOENsTGc1RUZmZ29TRGxPQ001NGdsaTQ&usp=sharing Google Drive]]
=== Wikka Before and After ===
Before: [[https://github.com/klenwell/WikkaWiki/blob/9dfc1/wikka.php wikka.php]]
After: [[https://github.com/klenwell/WikkaWiki/blob/klenwell-refactor/wikka.php wikka.php]]
=== Python with Jenkins ===
http://shiningpanda.com/python-multiple-versions-testing-with.html
=== Quick Temp Rails Controller ===
%%
# app/controllers/temps_controller.rb
# Add to routes.rb:
# resources :accounts, only: [:index]
class TempsController < ApplicationController
# GET /
def index
render html: 'hello world', layout: "application"
end
end
%%
----
[[CategorySpecial]]
Deletions:
public function __construct($wikka) {
$this->wikka = $wikka;
public function to_xhtml($wikka_markup) {
$wikka_markup = $this->normalize_line_breaks($wikka_markup);
$xhtml = $this->wwml_to_xhtml($wikka_markup);
$xhtml = $this->snip_last_br_tag($xhtml);
$xhtml = $this->close_open_tags($xhtml);
$xhtml = $this->enhance_xhtml($xhtml);
$xhtml = $this->inject_actions($xhtml);
return $xhtml;
private function normalize_line_breaks($wikka_markup) {
return str_replace("\r\n", "\n", $wikka_markup);
private function wwml_to_xhtml($wikka_markup) {
$wikka_markup = $wikka_markup . "\n"; # Issue #444
if ($this->wikka->GetHandler() == "show") {
$mind_map_pattern = "<map.*?<\/map>";
}
else {
$mind_map_pattern = "";
}
$url_pattern = "\b[a-z]+:\/\/[[:alnum:]\/?;:@%&=\._-]+[[:alnum:]\/]";
$wiki_markup_pattern = join('', array(
"\*\*|\'\'|\#\#|\#\%|@@|::c::|\>\>|\<\<|


Revision [2885]

Edited on 2015-09-01 14:58:49 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
public function __construct($wikka) {
$this->wikka = $wikka;
public function to_xhtml($wikka_markup) {
$wikka_markup = $this->normalize_line_breaks($wikka_markup);
$xhtml = $this->wwml_to_xhtml($wikka_markup);
$xhtml = $this->snip_last_br_tag($xhtml);
$xhtml = $this->close_open_tags($xhtml);
$xhtml = $this->enhance_xhtml($xhtml);
$xhtml = $this->inject_actions($xhtml);
return $xhtml;
private function normalize_line_breaks($wikka_markup) {
return str_replace("\r\n", "\n", $wikka_markup);
private function wwml_to_xhtml($wikka_markup) {
$wikka_markup = $wikka_markup . "\n"; # Issue #444
if ($this->wikka->GetHandler() == "show") {
$mind_map_pattern = "<map.*?<\/map>";
}
else {
$mind_map_pattern = "";
}
$url_pattern = "\b[a-z]+:\/\/[[:alnum:]\/?;:@%&=\._-]+[[:alnum:]\/]";
$wiki_markup_pattern = join('', array(
"\*\*|\'\'|\#\#|\#\%|@@|::c::|\>\>|\<\<|
Deletions:
* handlers/api/api.php
* http://localhost:3000/wikka.php?wakka=FormattingRules/api
// Old formatter: formatters/wakka.php
$expected = $this->Format($this->page['body'], 'wakka', 'page');
// New formatter: formatters/wikka_to_html.php
require_once('formatters/wikka_to_html.php');
$formatter = new WikkaToHtmlFormatter();
$html = $formatter->to_html($this->page['body']);
if ( $html === $expected ) {
die('new formatter passed');
}
else {
print '<h4>Failed</h4>';
printf('<h2>Expected</h2><pre>%s</pre>',
Wakka::hsc_secure($expected,ENT_QUOTES));
printf('<h2>New Formatter</h2><pre>%s</pre>',
Wakka::hsc_secure($html,ENT_QUOTES));
die('new formatter failed');
}
%%
public function to_html($wikka_markup) {
return $wikka_markup;
}
%%
=== On Long Hours and Productivity ===
Comment on [[http://www.adaptrm.com/blog/9-ways-to-be-more-productive-backed-by-science/ article]] that got flagged on HN:
> Studies shown if you lower your daily work hours from 20 to 8 and work 5 days instead of 6, your productivity increases!
#1 reaffirms something I strongly believe (whether on the basis of personal experience, something I've read before, or mere wishful thinking, I don't recall). It is a sensible constraint that came to mind in reading all the Amazon horror stories.
While reading that New York Times article I checked out the link to their 14 sacred principles. The funny thing was that I agreed with most of them. They were all ideas that occurred to me over the course of my career working independently, with small companies, and especially now in corp.
The one thing that was missing, I felt, was a Rule #15: Never work more than 8 hours a day.
Without it, it's no surprise you end up with the sort of dystopian workplace documented in the Times article and all over Reddit and HN here.
But then I suppose, as has been pointed before, long work hours are more about cultural signaling and penny-wise-pound-foolish accounting than really improving productivity.
WikiFish
~- [[https://github.com/jgm/pandoc Pandoc]]
~- [[https://github.com/ryakad/pandoc-php Pandoc-Php]]
=== Wikka Refactor ===
~- Merge Strategy
~- Functional Tests
~- Automated Deployment
=== Bundle, Rake, and rbenv ===
See http://benscheirman.com/2013/12/using-rbenv-in-cron-jobs/
=== Rails DOM Test with Nokogiri ===
Because ##assert_select## kinda sucks sometimes:
%%
# Collect rows and shift off header row. I'm using Nokogiri instead of css_select
# because I need to drill down to text node, which css_select makes hard if not
# impossible. Better element identifiers in template could have probably avoided this.
page = Nokogiri::HTML(@response.body)
transaction_rows = page.css("table#transactions tr")
transaction_rows.shift
%%
=== Unpublished Comment ===
https://news.ycombinator.com/item?id=9525582
I was hoping her model would get past the obvious shortcomings she glosses citing Yelp review at the end. I don't think Bernard Mandeville's poem is going to get us there.
The Righteous Society model sounds a lot like what we got on the Internet right now. See China's Human Search Engine for examples of this model in action:
http://www.bbc.com/news/magazine-25913472
I'm all for heroic efforts to spread justice. It's just that the old-fashioned techniques, marching in the streets, maybe even throwing a trash can through a shop window, seem like more measured approaches than a lot of what I seen come from the internet.
=== Interview Portfolio ===
http://www.codequizzes.com/
[[https://drive.google.com/folderview?id=0B6K9xXSLapkzfkhlX0NJTmZCa2hIcDFFa1pVVXFLOENsTGc1RUZmZ29TRGxPQ001NGdsaTQ&usp=sharing Google Drive]]
=== Wikka Before and After ===
Before: [[https://github.com/klenwell/WikkaWiki/blob/9dfc1/wikka.php wikka.php]]
After: [[https://github.com/klenwell/WikkaWiki/blob/klenwell-refactor/wikka.php wikka.php]]
=== Python with Jenkins ===
http://shiningpanda.com/python-multiple-versions-testing-with.html
=== Quick Temp Rails Controller ===
%%
# app/controllers/temps_controller.rb
# Add to routes.rb:
# resources :accounts, only: [:index]
class TempsController < ApplicationController
# GET /
def index
render html: 'hello world', layout: "application"
end
end
%%
----
[[CategorySpecial]]


Revision [2884]

Edited on 2015-08-31 12:04:12 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
$expected = $this->Format($this->page['body'], 'wakka', 'page');
$html = $formatter->to_html($this->page['body']);
Deletions:
$test_markup = "======Wikka Formatting Guide======---<<===General Guidelines===If a markup sequence is not in these guidelines, then it is not officially supported. Use caution when implementing markup that is not officially supported by this document, as undocumented functionality may change with version updates.--- ---Unless otherwise stated in these guidelines, all markup is line based, that is, a newline character should not intervene. These are identified as \'inline\' markup.<<::c::---===Escaping Markup===---Anything between 2 sets of double-quotes is not formatted.\nThis is the equivalent of escaping a character(s):--- ---<<\n~##\"\"**two bold &#34&#34**&#34&#34 stars**\"\"##\n\n~**two bold \"\"**\"\" stars**\n<<In this case, the second set of \"\"**\"\" (escaped) stars will be ignored, //i.e.,// will not terminate the bold markup.--- ---You can also use double-quote escaping to avoid linking of \"\"CamelCase\"\" words, e.g.---<<\n~##\"\"""WikiWord"" is not parsed as a link\"\"##\n\n~\"\"WikiWord\"\" is not parsed as a link\n<<::c::===1. Text Formatting===---<<\n~##\"\"**I\'m bold**\"\"##\n\n~**I\'m bold**\n<<::c::<<\n~##\"\"//I\'m italic text!//\"\"##\n\n~//I\'m italic text!//\n<<::c::<<\n~##\"\"__And I\'m underlined!__\"\"##\n\n~__And I\'m underlined!__\n<<::c::<<\n~##\"\"##Monospace text##\"\"##\n\n~##Monospace text##\n<<::c::<<\n~##\"\"\'\'Highlighted text\'\'\"\"## (using 2 single quotes)\n\n~\'\'Highlighted text\'\'\n<<::c::<<\n~##\"\"++Strike through text++\"\"##\n\n~++Strike through text++\n<<::c::<<\n~##\"\"££Text insertion££\"\"##\n\n~ ££Text insertion££\n<<::c::<<\n~##\"\"¥¥Text deletion¥¥\"\"##\n\n~ ¥¥Text deletion¥¥\n<<::c::<<\n~##\"\"#%Press any key#%\"\"##\n\n~#%Press any key#%\n<<::c::<<\n~##\"\"@@Center text@@\"\"##\n\n~@@Center text@@\n<<::c::Elides (hides) content from displaying. Eliminates trailing whitespace so there are no unsightly gaps in output. Useful for commenting Wikka markup.---<<\n~##\"\"/*Elided content (eliminates trailing whitespace)*/\"\"##\n\n~/*Elided content (eliminates trailing whitespace)*/\n\n<--//there was a comment here followed by whitespace in the markup//\n<<::c::Elides (hides) content from displaying. Preserves trailing\nwhitespace (note the gap).---<<\n~##\"\"``Elided content (preserves trailing whitespace)``\"\"##\n\n~``Elided content (preserves trailing whitespace)``\n\n<--//there was a comment here followed by ws in the markup//\n<<::c::---===2. Headers===---Use between six ##=## (for the biggest header) and two ##=## (for the smallest header) on both sides of a text to render it as a header.--- ---<<\n~##\"\"======Really big header======\"\"##\n\n~======Really big header======\n<<::c::<<\n~##\"\"=====Rather big header=====\"\"##\n\n~=====Rather big header=====\n<<::c::<<\n~##\"\"====Medium header====\"\"##\n\n~====Medium header====\n<<::c::<<\n~##\"\"===Not-so-big header===\"\"##\n\n~===Not-so-big header===\n<<::c::<<\n~##\"\"==Smallish header==\"\"##\n\n~==Smallish header==\n<<::c::---===3. Horizontal separator===\n~##\"\"----\"\"##\n\n----\n---===4. Forced line break===---\n~##\"\"Line 1---Line 2\"\"##\n\nLine 1---Line 2\n---===5. Lists and indents===---You can indent text using a tilde (~), a tab, or four spaces (which will auto-convert into a tab).---<<\n##\"\"~This text is indented<br />~~This text is double-indented<br />    This text is also indented\"\"## <<::c::<<\n~This text is indented\n~~This text is double-indented\n~This text is also indented\n<<::c::---To create bulleted/ordered lists, use the following markup (you can always use 4 spaces instead of a tilde):--- ---**Bulleted lists**---<<\n##\"\"~- Line one\"\"##\n##\"\"~- Line two\"\"##\n<<::c::<<\n~- Line one\n~- Line two\n<<::c::---**Numbered lists**---<<\n##\"\"~1) Line one\"\"##\n##\"\"~1) Line two\"\"##\n<<::c::<<\n~1) Line one\n~1) Line two\n<<::c::---**Ordered lists using uppercase characters**---<<\n##\"\"~A) Line one\"\"##\n##\"\"~A) Line two\"\"##\n<<::c::<<\n~A) Line one \n~A) Line two \n<<::c::---**Ordered lists using lowercase characters**---<<\n##\"\"~a) Line one\"\"##\n##\"\"~a) Line two\"\"##\n<<::c::<<\n~a) Line one \n~a) Line two\n<<::c::---**Ordered lists using uppercase Roman numerals**---<<\n##\"\"~I) Line one\"\"##\n##\"\"~I) Line two\"\"##\n<<::c::<<\n~I) Line one \n~I) Line two\n<<::c::---**Ordered lists using lowercase Roman numerals**---<<\n##\"\"~i) Line one\"\"##\n##\"\"~i) Line two\"\"##\n<<::c::<<\n~i) Line one \n~i) Line two \n<<::c::---===6. Inline comments===---To format some text as an inline comment, use an indent (tilde, tab, or four spaces) followed by a **\"\"&\"\"**.--- ---<<\n##\"\"~& Comment\"\"##\n##\"\"~~& Subcomment\"\"##\n##\"\"~~~& Subsubcomment\"\"##\n<<::c::<<\n~& Comment \n~~& Subcomment \n~~~& Subsubcomment \n<<::c::--- ---===7. Images===---To place images on a Wiki page, you can use the ##image## action.--- ---Image links can be external or internal Wiki links. You don\'t need to enter a link at all, and in that case just an image will be inserted. You can use the optional classes ##left## and ##right## to float images left and right. You don\'t need to use all those attributes, only ##url## is required while ##alt## is recommended for\naccessibility.--- ---<<\n~##\"\"{{image class=\"center\" alt=\"DVD logo\" title=\"An image link\" url=\"images/dvdvideo.gif\" link=\"RecentChanges\"}}\"\"##\n---\n~{{image class=\"center\" alt=\"DVD logo\" title=\"An image link\" url=\"images/dvdvideo.gif\" link=\"RecentChanges\"}}\n<<::c::---===8. Links===---To create a ** link to a wiki page ** you can use any of the\nfollowing options:--- ---\n~- Type a ##\"\"WikiName\"\"## (works only for page names with no whitespace): --- --- ##\"\"FormattingRules\"\"## --- FormattingRules --- ---\n---\n~- Add a forced link surrounding the page name by ##\"\"[[\"\"## and ##\"\"]]\"\"## (everything after the | will be shown as description): --- --- ##\"\"[[SandBox|Test\nyour formatting skills]]\"\"## --- [[SandBox|Test your formatting skills]] --- --- ##\"\"[[SandBox|沙箱]]\"\"## --- [[SandBox|沙箱]] --- ---\n---\n~- Add an image with a link (see instructions above)\n--- ---To ** link to external pages **, you can do any of the following:--- ---\n~- Type a URL inside the page: --- --- ##\"\"http://blog.wikkawiki.org\"\"## --- http://blog.wikkawiki.org --- --- \n---\n~- Add a forced link surrounding the URL by ##\"\"[[\"\"## and ##\"\"]]\"\"## (everything after the | will be shown as description): --- --- ##\"\"[[http://docs.wikkawiki.org|Wikka documentation]]\"\"## --- [[http://docs.wikkawiki.org|Wikka documentation]] --- --- ##\"\"[[community@wikkawiki.org|Wikka community list]]\"\"## --- [[community@wikkawiki.org|Wikka community list]] --- ---\n---\n~- Add an image with a link (see instructions above) \n---\n~- Add an interwiki link ([[InterWiki browse the list of available interwiki tags]]): --- --- ##\"\"WikiPedia:WikkaWiki\"\"## --- WikiPedia:WikkaWiki --- --- ##\"\"Google:CSS\"\"## --- Google:CSS --- --- ##\"\"Thesaurus:Happy\"\"## --- Thesaurus:Happy --- ---\n--- ---===9. Tables===---<<The ##table## action has been deprecated as of Wikka version 1.2 and has been replaced with the syntax that follows. Please visit the [[Docs:TableActionInfo|Wikka documentation server]] for information about the older ##table## action.<<::c::---Tables can be created using two pipe (##\"\"||\"\"##) symbols. Everything in a single line is rendered as a table row.--- ---**Example:**--- ---\n##\"\"||Cell 1||Cell 2||\"\"##\n\n||Cell 1||Cell 2||\n--- ---Header cells can be rendered by placing an equals sign between the pipes.--- ---**Example:**\n##\"\"|=|Header 1|=|Header 2||\"\"##\n##\"\"||Cell 1||Cell 2||\"\"##\n\n|=|Header 1|=|Header 2||\n||Cell 1||Cell 2||\n--- ---Row and column spans are specified with ##x:## and ##y:## in parentheses just after the pipes.--- ---**Example:**--- ---\n##\"\"|=| |=|(x:2)Columns||\"\"##\n##\"\"|=|(y:2) Rows||Cell 1||Cell 2||\"\"##\n##\"\"||Cell 3||Cell 4||\"\"##\n\n|=| |=|(x:2)Columns||\n|=|(y:2) Rows||Cell 1||Cell 2||\n||Cell 3||Cell 4||\n--- ---Many additional features are available using table markup. A more comprehensive table markup guide is available on this server\'s TableMarkup page. A complete syntax reference is available on this server\'s TableMarkupReference page.--- ---===10. Colored Text===---Colored text can be created using the ##color## action:---<<\n~##\"\"{{color c=\"blue\" text=\"This is a test\"}}\"\"##\n~{{color c=\"blue\" text=\"This is a test\"}}\n<<::c::---You can also use hex values:---<<\n~##\"\"{{color hex=\"#DD0000\" text=\"This is another test\"}}\"\"## \n~{{color hex=\"#DD0000\" text=\"This is another test\"}}\n<<::c::---Alternatively, you can specify a foreground and background color using the ##fg## and ##bg## parameters (they accept both named and hex values):---<<\n~##\"\"{{color fg=\"#FF0000\" bg=\"#000000\" text=\"This is colored text on colored background\"}}\"\"##\n~{{color fg=\"#FF0000\" bg=\"#000000\" text=\"This is colored text on colored background\"}}\n<<::c::<<\n~##\"\"{{color fg=\"yellow\" bg=\"black\" text=\"This is colored text on colored background\"}}\"\"##\n~{{color fg=\"yellow\" bg=\"black\" text=\"This is colored text on colored background\"}}\n<<::c::--- ---===11. Floats===---To create a ** left floated box **, use two ##<## characters before and after the block.--- ---**Example:**--- ---\n~~##\"\"<< Some text in a left-floated box hanging around. << Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\"\"##--- ---<< Some text in a left-floated box hanging around. << Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\n::c::\nTo create a ** right floated box **, use two ##>## characters before and after the block.--- ---**Example:**--- ---\n~##\"\">> Some text in a right-floated box hanging around. >> Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\"\"##--- --->> Some text in a right-floated box hanging around. >> Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\n::c::\n** Note: Use ##\"\"::c::\"\"## to clear floated blocks. **--- ---===12. Code formatters===---You can easily embed code blocks in a wiki page using a simple markup. Anything within a code block is displayed literally. To create a ** generic code block ** you can use the following markup:--- ---\n~##\"\"%% This is a code block %%\"\"##. \n\n%% This is a code block %%\n---To create a ** code block with syntax highlighting **, you need to specify a // code formatter // (see below for a list of available code formatters).--- ---\n~##\"\"%%(\"\"{{color c=\"red\" text=\"php\"}}\"\")<br /><?php<br />echo \"Hello, World!\";<br />?><br />%%\"\"##\n---\n%%(php)\n<?php\necho \"Hello, World!\";\n?>\n%%\n--- ---You can also specify an optional // starting line // number.---\n~##\"\"%%(php;\"\"{{color c=\"red\" text=\"15\"}}\"\")<br /><?php<br />echo \"Hello, World!\";<br />?><br />%%\"\"##\n---\n%%(php;15)\n<?php\necho \"Hello, World!\";\n?>\n%%\n--- ---If you specify a // filename //, this will be used for downloading the code.---\n~##\"\"%%(php;15;\"\"{{color c=\"red\" text=\"test.php\"}}\"\")<br /><?php<br />echo \"Hello, World!\";<br />?><br />%%\"\"##\n---\n%%(php;15;test.php)\n<?php\necho \"Hello, World!\";\n?>\n%%\n--- ---\n|?|List of available code formatters||\n||\n|=|Language|=|Formatter|=|Language|=|Formatter|=|Language|=|Formatter||\n|#|\n|=|Actionscript||##actionscript##|=|ABAP||##abap##|=|ADA||##ada##||\n|=|Apache Log||##apache##|=|\"\"AppleScript\"\"||##applescript##|=|ASM||##asm##||\n|=|ASP||##asp##|=|\"\"AutoIT\"\"||##autoit##|=|Bash||##bash##||\n|=|\"\"BlitzBasic\"\"||##blitzbasic##|=|\"\"Basic4GL\"\"||##basic4gl##|=|bnf||##bnf##||\n|=|C||##c##|=|C for Macs||##c_mac##|=|C#||##csharp##||\n|=|C\"\"++\"\"||##cpp##|=|C\"\"++\"\" (+QT)||##cpp-qt##|=|CAD DCL||##caddcl##||\n|=|\"\"CadLisp\"\"||##cadlisp##|=|CFDG||##cfdg##|=|\"\"ColdFusion\"\"||##cfm##||\n|=|CSS||##css##|=|D||##d##|=|Delphi||##delphi##||\n|=|Diff-Output||##diff##|=|DIV||##div##|=|DOS||##dos##||\n|=|Dot||##dot##|=|Eiffel||##eiffel##|=|Fortran||##fortran##||\n|=|\"\"FreeBasic\"\"||##freebasic##|=|FOURJ\'s Genero 4GL||##genero##|=|GML||##gml##||\n|=|Groovy||##groovy##|=|Haskell||##haskell##|=|HTML||##html4strict##||\n|=|INI||##ini##|=|Inno Script||##inno##|=|Io||##io##||\n|=|Java 5||##java5##|=|Java||##java##|=|Javascript||##javascript##||\n|=|\"\"LaTeX\"\"||##latex##|=|Lisp||##lisp##|=|Lua||##lua##||\n|=|Matlab||##matlab##|=|mIRC Scripting||##mirc##|=|Microchip Assembler||##mpasm##||\n|=|Microsoft Registry||##reg##|=|Motorola 68k Assembler||##m68k##|=|\"\"MySQL\"\"||##mysql##||\n|=|NSIS||##nsis##|=|Objective C||##objc##|=|\"\"OpenOffice\"\" BASIC||##oobas##||\n|=|Objective Caml||##ocaml##|=|Objective Caml (brief)||##ocaml-brief##|=|Oracle 8||##oracle8##||\n|=|Pascal||##pascal##|=|Per (FOURJ\'s Genero 4GL)||##per##|=|Perl||##perl##||\n|=|PHP||##php##|=|PHP (brief)||##php-brief##|=|PL/SQL||##plsql##||\n|=|Python||##phyton##|=|Q(uick)BASIC||##qbasic##|=|robots.txt||##robots##||\n|=|Ruby on Rails||##rails##|=|Ruby||##ruby##|=|SAS||##sas##||\n|=|Scheme||##scheme##|=|sdlBasic||##sdlbasic##|=|Smarty||##smarty##||\n|=|SQL||##sql##|=|TCL/iTCL||##tcl##|=|T-SQL||##tsql##||\n|=|Text||##text##|=|thinBasic||##thinbasic##|=|Unoidl||##idl##||\n|=|VB.NET||##vbnet##|=|VHDL||##vhdl##|=|Visual BASIC||##vb##||\n|=|Visual Fox Pro||##visualfoxpro##|=|\"\"WinBatch\"\"||##winbatch##|=|XML||##xml##||\n|=|X\"\"++\"\"||##xpp##|=|\"\"ZiLOG\"\" Z80 Assembler||##z80##|=| ||\n--- ---===13. Mindmaps===---Wikka has native support for [[Wikka:FreeMind|mindmaps]]. There are two options for embedding a mindmap in a wiki page.--- --- **Option 1:** Upload a \"\"FreeMind\"\" file to a webserver, and then place a link to it on a wikka page: ##\"\"http://yourdomain.com/freemind/freemind.mm\"\"## No special formatting is necessary. --- ---**Option 2:** Paste the \"\"FreeMind\"\" data directly into a wikka page:\n\n~-Open a \"\"FreeMind\"\" file with a text editor.\n~-Select all, and copy the data.\n~-Browse to your Wikka site and paste the Freemind data into a page.\n::c::\n---===14. Embedded HTML===---You can easily paste HTML in a wiki page by wrapping it into two sets of doublequotes.--- ---\n~##""[html code]""##\n<<\n~##""y = x<sup>n+1</sup>""##\n~\"\"y = x<sup>n+1</sup>\"\"\n<<::c::<<\n~##""<acronym title=\"Cascade Style Sheet\">CSS</acronym>""##\n~\"\"<acronym title=\"Cascade Style Sheet\">CSS</acronym>\"\"\n<<::c::---By default, some HTML tags are removed by the \"\"SafeHTML\"\" parser to protect against potentially dangerous code. The list of tags that are stripped can be found on the Wikka:SafeHTML page.--- ---It is possible to allow // all // HTML tags to be used, see Wikka:UsingHTML for more information.--- --- ----CategoryWiki";
$expected = $this->Format($test_markup, 'wakka', 'page');
$html = $formatter->to_html($test_markup);


Revision [2883]

Edited on 2015-08-31 12:03:22 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
$test_markup = "======Wikka Formatting Guide======---<<===General Guidelines===If a markup sequence is not in these guidelines, then it is not officially supported. Use caution when implementing markup that is not officially supported by this document, as undocumented functionality may change with version updates.--- ---Unless otherwise stated in these guidelines, all markup is line based, that is, a newline character should not intervene. These are identified as \'inline\' markup.<<::c::---===Escaping Markup===---Anything between 2 sets of double-quotes is not formatted.\nThis is the equivalent of escaping a character(s):--- ---<<\n~##\"\"**two bold &#34&#34**&#34&#34 stars**\"\"##\n\n~**two bold \"\"**\"\" stars**\n<<In this case, the second set of \"\"**\"\" (escaped) stars will be ignored, //i.e.,// will not terminate the bold markup.--- ---You can also use double-quote escaping to avoid linking of \"\"CamelCase\"\" words, e.g.---<<\n~##\"\"""WikiWord"" is not parsed as a link\"\"##\n\n~\"\"WikiWord\"\" is not parsed as a link\n<<::c::===1. Text Formatting===---<<\n~##\"\"**I\'m bold**\"\"##\n\n~**I\'m bold**\n<<::c::<<\n~##\"\"//I\'m italic text!//\"\"##\n\n~//I\'m italic text!//\n<<::c::<<\n~##\"\"__And I\'m underlined!__\"\"##\n\n~__And I\'m underlined!__\n<<::c::<<\n~##\"\"##Monospace text##\"\"##\n\n~##Monospace text##\n<<::c::<<\n~##\"\"\'\'Highlighted text\'\'\"\"## (using 2 single quotes)\n\n~\'\'Highlighted text\'\'\n<<::c::<<\n~##\"\"++Strike through text++\"\"##\n\n~++Strike through text++\n<<::c::<<\n~##\"\"££Text insertion££\"\"##\n\n~ ££Text insertion££\n<<::c::<<\n~##\"\"¥¥Text deletion¥¥\"\"##\n\n~ ¥¥Text deletion¥¥\n<<::c::<<\n~##\"\"#%Press any key#%\"\"##\n\n~#%Press any key#%\n<<::c::<<\n~##\"\"@@Center text@@\"\"##\n\n~@@Center text@@\n<<::c::Elides (hides) content from displaying. Eliminates trailing whitespace so there are no unsightly gaps in output. Useful for commenting Wikka markup.---<<\n~##\"\"/*Elided content (eliminates trailing whitespace)*/\"\"##\n\n~/*Elided content (eliminates trailing whitespace)*/\n\n<--//there was a comment here followed by whitespace in the markup//\n<<::c::Elides (hides) content from displaying. Preserves trailing\nwhitespace (note the gap).---<<\n~##\"\"``Elided content (preserves trailing whitespace)``\"\"##\n\n~``Elided content (preserves trailing whitespace)``\n\n<--//there was a comment here followed by ws in the markup//\n<<::c::---===2. Headers===---Use between six ##=## (for the biggest header) and two ##=## (for the smallest header) on both sides of a text to render it as a header.--- ---<<\n~##\"\"======Really big header======\"\"##\n\n~======Really big header======\n<<::c::<<\n~##\"\"=====Rather big header=====\"\"##\n\n~=====Rather big header=====\n<<::c::<<\n~##\"\"====Medium header====\"\"##\n\n~====Medium header====\n<<::c::<<\n~##\"\"===Not-so-big header===\"\"##\n\n~===Not-so-big header===\n<<::c::<<\n~##\"\"==Smallish header==\"\"##\n\n~==Smallish header==\n<<::c::---===3. Horizontal separator===\n~##\"\"----\"\"##\n\n----\n---===4. Forced line break===---\n~##\"\"Line 1---Line 2\"\"##\n\nLine 1---Line 2\n---===5. Lists and indents===---You can indent text using a tilde (~), a tab, or four spaces (which will auto-convert into a tab).---<<\n##\"\"~This text is indented<br />~~This text is double-indented<br />    This text is also indented\"\"## <<::c::<<\n~This text is indented\n~~This text is double-indented\n~This text is also indented\n<<::c::---To create bulleted/ordered lists, use the following markup (you can always use 4 spaces instead of a tilde):--- ---**Bulleted lists**---<<\n##\"\"~- Line one\"\"##\n##\"\"~- Line two\"\"##\n<<::c::<<\n~- Line one\n~- Line two\n<<::c::---**Numbered lists**---<<\n##\"\"~1) Line one\"\"##\n##\"\"~1) Line two\"\"##\n<<::c::<<\n~1) Line one\n~1) Line two\n<<::c::---**Ordered lists using uppercase characters**---<<\n##\"\"~A) Line one\"\"##\n##\"\"~A) Line two\"\"##\n<<::c::<<\n~A) Line one \n~A) Line two \n<<::c::---**Ordered lists using lowercase characters**---<<\n##\"\"~a) Line one\"\"##\n##\"\"~a) Line two\"\"##\n<<::c::<<\n~a) Line one \n~a) Line two\n<<::c::---**Ordered lists using uppercase Roman numerals**---<<\n##\"\"~I) Line one\"\"##\n##\"\"~I) Line two\"\"##\n<<::c::<<\n~I) Line one \n~I) Line two\n<<::c::---**Ordered lists using lowercase Roman numerals**---<<\n##\"\"~i) Line one\"\"##\n##\"\"~i) Line two\"\"##\n<<::c::<<\n~i) Line one \n~i) Line two \n<<::c::---===6. Inline comments===---To format some text as an inline comment, use an indent (tilde, tab, or four spaces) followed by a **\"\"&\"\"**.--- ---<<\n##\"\"~& Comment\"\"##\n##\"\"~~& Subcomment\"\"##\n##\"\"~~~& Subsubcomment\"\"##\n<<::c::<<\n~& Comment \n~~& Subcomment \n~~~& Subsubcomment \n<<::c::--- ---===7. Images===---To place images on a Wiki page, you can use the ##image## action.--- ---Image links can be external or internal Wiki links. You don\'t need to enter a link at all, and in that case just an image will be inserted. You can use the optional classes ##left## and ##right## to float images left and right. You don\'t need to use all those attributes, only ##url## is required while ##alt## is recommended for\naccessibility.--- ---<<\n~##\"\"{{image class=\"center\" alt=\"DVD logo\" title=\"An image link\" url=\"images/dvdvideo.gif\" link=\"RecentChanges\"}}\"\"##\n---\n~{{image class=\"center\" alt=\"DVD logo\" title=\"An image link\" url=\"images/dvdvideo.gif\" link=\"RecentChanges\"}}\n<<::c::---===8. Links===---To create a ** link to a wiki page ** you can use any of the\nfollowing options:--- ---\n~- Type a ##\"\"WikiName\"\"## (works only for page names with no whitespace): --- --- ##\"\"FormattingRules\"\"## --- FormattingRules --- ---\n---\n~- Add a forced link surrounding the page name by ##\"\"[[\"\"## and ##\"\"]]\"\"## (everything after the | will be shown as description): --- --- ##\"\"[[SandBox|Test\nyour formatting skills]]\"\"## --- [[SandBox|Test your formatting skills]] --- --- ##\"\"[[SandBox|沙箱]]\"\"## --- [[SandBox|沙箱]] --- ---\n---\n~- Add an image with a link (see instructions above)\n--- ---To ** link to external pages **, you can do any of the following:--- ---\n~- Type a URL inside the page: --- --- ##\"\"http://blog.wikkawiki.org\"\"## --- http://blog.wikkawiki.org --- --- \n---\n~- Add a forced link surrounding the URL by ##\"\"[[\"\"## and ##\"\"]]\"\"## (everything after the | will be shown as description): --- --- ##\"\"[[http://docs.wikkawiki.org|Wikka documentation]]\"\"## --- [[http://docs.wikkawiki.org|Wikka documentation]] --- --- ##\"\"[[community@wikkawiki.org|Wikka community list]]\"\"## --- [[community@wikkawiki.org|Wikka community list]] --- ---\n---\n~- Add an image with a link (see instructions above) \n---\n~- Add an interwiki link ([[InterWiki browse the list of available interwiki tags]]): --- --- ##\"\"WikiPedia:WikkaWiki\"\"## --- WikiPedia:WikkaWiki --- --- ##\"\"Google:CSS\"\"## --- Google:CSS --- --- ##\"\"Thesaurus:Happy\"\"## --- Thesaurus:Happy --- ---\n--- ---===9. Tables===---<<The ##table## action has been deprecated as of Wikka version 1.2 and has been replaced with the syntax that follows. Please visit the [[Docs:TableActionInfo|Wikka documentation server]] for information about the older ##table## action.<<::c::---Tables can be created using two pipe (##\"\"||\"\"##) symbols. Everything in a single line is rendered as a table row.--- ---**Example:**--- ---\n##\"\"||Cell 1||Cell 2||\"\"##\n\n||Cell 1||Cell 2||\n--- ---Header cells can be rendered by placing an equals sign between the pipes.--- ---**Example:**\n##\"\"|=|Header 1|=|Header 2||\"\"##\n##\"\"||Cell 1||Cell 2||\"\"##\n\n|=|Header 1|=|Header 2||\n||Cell 1||Cell 2||\n--- ---Row and column spans are specified with ##x:## and ##y:## in parentheses just after the pipes.--- ---**Example:**--- ---\n##\"\"|=| |=|(x:2)Columns||\"\"##\n##\"\"|=|(y:2) Rows||Cell 1||Cell 2||\"\"##\n##\"\"||Cell 3||Cell 4||\"\"##\n\n|=| |=|(x:2)Columns||\n|=|(y:2) Rows||Cell 1||Cell 2||\n||Cell 3||Cell 4||\n--- ---Many additional features are available using table markup. A more comprehensive table markup guide is available on this server\'s TableMarkup page. A complete syntax reference is available on this server\'s TableMarkupReference page.--- ---===10. Colored Text===---Colored text can be created using the ##color## action:---<<\n~##\"\"{{color c=\"blue\" text=\"This is a test\"}}\"\"##\n~{{color c=\"blue\" text=\"This is a test\"}}\n<<::c::---You can also use hex values:---<<\n~##\"\"{{color hex=\"#DD0000\" text=\"This is another test\"}}\"\"## \n~{{color hex=\"#DD0000\" text=\"This is another test\"}}\n<<::c::---Alternatively, you can specify a foreground and background color using the ##fg## and ##bg## parameters (they accept both named and hex values):---<<\n~##\"\"{{color fg=\"#FF0000\" bg=\"#000000\" text=\"This is colored text on colored background\"}}\"\"##\n~{{color fg=\"#FF0000\" bg=\"#000000\" text=\"This is colored text on colored background\"}}\n<<::c::<<\n~##\"\"{{color fg=\"yellow\" bg=\"black\" text=\"This is colored text on colored background\"}}\"\"##\n~{{color fg=\"yellow\" bg=\"black\" text=\"This is colored text on colored background\"}}\n<<::c::--- ---===11. Floats===---To create a ** left floated box **, use two ##<## characters before and after the block.--- ---**Example:**--- ---\n~~##\"\"<< Some text in a left-floated box hanging around. << Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\"\"##--- ---<< Some text in a left-floated box hanging around. << Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\n::c::\nTo create a ** right floated box **, use two ##>## characters before and after the block.--- ---**Example:**--- ---\n~##\"\">> Some text in a right-floated box hanging around. >> Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\"\"##--- --->> Some text in a right-floated box hanging around. >> Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\n::c::\n** Note: Use ##\"\"::c::\"\"## to clear floated blocks. **--- ---===12. Code formatters===---You can easily embed code blocks in a wiki page using a simple markup. Anything within a code block is displayed literally. To create a ** generic code block ** you can use the following markup:--- ---\n~##\"\"%% This is a code block %%\"\"##. \n\n%% This is a code block %%\n---To create a ** code block with syntax highlighting **, you need to specify a // code formatter // (see below for a list of available code formatters).--- ---\n~##\"\"%%(\"\"{{color c=\"red\" text=\"php\"}}\"\")<br /><?php<br />echo \"Hello, World!\";<br />?><br />%%\"\"##\n---\n%%(php)\n<?php\necho \"Hello, World!\";\n?>\n%%\n--- ---You can also specify an optional // starting line // number.---\n~##\"\"%%(php;\"\"{{color c=\"red\" text=\"15\"}}\"\")<br /><?php<br />echo \"Hello, World!\";<br />?><br />%%\"\"##\n---\n%%(php;15)\n<?php\necho \"Hello, World!\";\n?>\n%%\n--- ---If you specify a // filename //, this will be used for downloading the code.---\n~##\"\"%%(php;15;\"\"{{color c=\"red\" text=\"test.php\"}}\"\")<br /><?php<br />echo \"Hello, World!\";<br />?><br />%%\"\"##\n---\n%%(php;15;test.php)\n<?php\necho \"Hello, World!\";\n?>\n%%\n--- ---\n|?|List of available code formatters||\n||\n|=|Language|=|Formatter|=|Language|=|Formatter|=|Language|=|Formatter||\n|#|\n|=|Actionscript||##actionscript##|=|ABAP||##abap##|=|ADA||##ada##||\n|=|Apache Log||##apache##|=|\"\"AppleScript\"\"||##applescript##|=|ASM||##asm##||\n|=|ASP||##asp##|=|\"\"AutoIT\"\"||##autoit##|=|Bash||##bash##||\n|=|\"\"BlitzBasic\"\"||##blitzbasic##|=|\"\"Basic4GL\"\"||##basic4gl##|=|bnf||##bnf##||\n|=|C||##c##|=|C for Macs||##c_mac##|=|C#||##csharp##||\n|=|C\"\"++\"\"||##cpp##|=|C\"\"++\"\" (+QT)||##cpp-qt##|=|CAD DCL||##caddcl##||\n|=|\"\"CadLisp\"\"||##cadlisp##|=|CFDG||##cfdg##|=|\"\"ColdFusion\"\"||##cfm##||\n|=|CSS||##css##|=|D||##d##|=|Delphi||##delphi##||\n|=|Diff-Output||##diff##|=|DIV||##div##|=|DOS||##dos##||\n|=|Dot||##dot##|=|Eiffel||##eiffel##|=|Fortran||##fortran##||\n|=|\"\"FreeBasic\"\"||##freebasic##|=|FOURJ\'s Genero 4GL||##genero##|=|GML||##gml##||\n|=|Groovy||##groovy##|=|Haskell||##haskell##|=|HTML||##html4strict##||\n|=|INI||##ini##|=|Inno Script||##inno##|=|Io||##io##||\n|=|Java 5||##java5##|=|Java||##java##|=|Javascript||##javascript##||\n|=|\"\"LaTeX\"\"||##latex##|=|Lisp||##lisp##|=|Lua||##lua##||\n|=|Matlab||##matlab##|=|mIRC Scripting||##mirc##|=|Microchip Assembler||##mpasm##||\n|=|Microsoft Registry||##reg##|=|Motorola 68k Assembler||##m68k##|=|\"\"MySQL\"\"||##mysql##||\n|=|NSIS||##nsis##|=|Objective C||##objc##|=|\"\"OpenOffice\"\" BASIC||##oobas##||\n|=|Objective Caml||##ocaml##|=|Objective Caml (brief)||##ocaml-brief##|=|Oracle 8||##oracle8##||\n|=|Pascal||##pascal##|=|Per (FOURJ\'s Genero 4GL)||##per##|=|Perl||##perl##||\n|=|PHP||##php##|=|PHP (brief)||##php-brief##|=|PL/SQL||##plsql##||\n|=|Python||##phyton##|=|Q(uick)BASIC||##qbasic##|=|robots.txt||##robots##||\n|=|Ruby on Rails||##rails##|=|Ruby||##ruby##|=|SAS||##sas##||\n|=|Scheme||##scheme##|=|sdlBasic||##sdlbasic##|=|Smarty||##smarty##||\n|=|SQL||##sql##|=|TCL/iTCL||##tcl##|=|T-SQL||##tsql##||\n|=|Text||##text##|=|thinBasic||##thinbasic##|=|Unoidl||##idl##||\n|=|VB.NET||##vbnet##|=|VHDL||##vhdl##|=|Visual BASIC||##vb##||\n|=|Visual Fox Pro||##visualfoxpro##|=|\"\"WinBatch\"\"||##winbatch##|=|XML||##xml##||\n|=|X\"\"++\"\"||##xpp##|=|\"\"ZiLOG\"\" Z80 Assembler||##z80##|=| ||\n--- ---===13. Mindmaps===---Wikka has native support for [[Wikka:FreeMind|mindmaps]]. There are two options for embedding a mindmap in a wiki page.--- --- **Option 1:** Upload a \"\"FreeMind\"\" file to a webserver, and then place a link to it on a wikka page: ##\"\"http://yourdomain.com/freemind/freemind.mm\"\"## No special formatting is necessary. --- ---**Option 2:** Paste the \"\"FreeMind\"\" data directly into a wikka page:\n\n~-Open a \"\"FreeMind\"\" file with a text editor.\n~-Select all, and copy the data.\n~-Browse to your Wikka site and paste the Freemind data into a page.\n::c::\n---===14. Embedded HTML===---You can easily paste HTML in a wiki page by wrapping it into two sets of doublequotes.--- ---\n~##""[html code]""##\n<<\n~##""y = x<sup>n+1</sup>""##\n~\"\"y = x<sup>n+1</sup>\"\"\n<<::c::<<\n~##""<acronym title=\"Cascade Style Sheet\">CSS</acronym>""##\n~\"\"<acronym title=\"Cascade Style Sheet\">CSS</acronym>\"\"\n<<::c::---By default, some HTML tags are removed by the \"\"SafeHTML\"\" parser to protect against potentially dangerous code. The list of tags that are stripped can be found on the Wikka:SafeHTML page.--- ---It is possible to allow // all // HTML tags to be used, see Wikka:UsingHTML for more information.--- --- ----CategoryWiki";
$expected = $this->Format($test_markup, 'wakka', 'page');
$html = $formatter->to_html($test_markup);
Deletions:
$expected = $this->Format($this->page['body'], 'wakka', 'page');
$html = $formatter->to_html($this->page['body']);


Revision [2882]

Edited on 2015-08-31 11:49:41 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
die('new formatter passed');
Deletions:
die('new formater passed');


Revision [2881]

Edited on 2015-08-31 11:48:24 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
* formatters/wikka_to_html.php
class WikkaToHtmlFormatter {
public function to_html($wikka_markup) {
return $wikka_markup;
}


Revision [2880]

Edited on 2015-08-31 11:47:54 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Wikka Formatter ===
%%(php)
<?php
/**
* handlers/api/api.php
* http://localhost:3000/wikka.php?wakka=FormattingRules/api
*/
// Old formatter: formatters/wakka.php
$expected = $this->Format($this->page['body'], 'wakka', 'page');
// New formatter: formatters/wikka_to_html.php
require_once('formatters/wikka_to_html.php');
$formatter = new WikkaToHtmlFormatter();
$html = $formatter->to_html($this->page['body']);
if ( $html === $expected ) {
die('new formater passed');
}
else {
print '<h4>Failed</h4>';
printf('<h2>Expected</h2><pre>%s</pre>',
Wakka::hsc_secure($expected,ENT_QUOTES));
printf('<h2>New Formatter</h2><pre>%s</pre>',
Wakka::hsc_secure($html,ENT_QUOTES));
die('new formatter failed');
}


Revision [2879]

Edited on 2015-08-30 18:50:34 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- The Reboot


Revision [2875]

Edited on 2015-08-23 20:51:36 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Deletions:
==== 2014 ====
https://news.ycombinator.com/item?id=8777899
The author frames the stigma associated with "survival jobs" (and the challenge faced nowadays by anybody not optimizing their future around the effective use of capital) in an interesting way. What alarms me, in part, is how many jobs I've come to see as survival jobs.
A couple years ago when Hostess went out of business after a strike by workers, I overheard a project manager in our breakroom scoffing at the idea that their senior bakery workers thought they deserved $60,000/year. The question I wanted to put to him is one I come back to regularly: how much do you think experience baker (or a dutiful custodian or a reliable service worker) should make? And how do you get to that figure?
Incidentally, that project manager is probably making at least twice as much as the best paid of those bakery workers, yet if you asked his teammates, and those who worked regularly with him, what have been his most important contributions to the projects that he has worked on over the course of his several years with the company, they'd probably be left to cite the office betting pools he organizes for each of the major sporting events throughout the year.
=== Interactive SICP ===
~- http://xuanji.appspot.com/isicp/index.html
~- http://interactivepython.org/runestone/static/thinkcspy/index.html
=== Job Search ===
Job search as SQL query:
%%(sql)
SELECT
# Company details
co.overview AS company,
# Job details
job.overview AS overview,
job.title AS title,
job.duration AS duration,
job.salary AS salary,
job.annual_pto_days AS pto,
job.telecommute AS telecommute,
# Distance from my ideal geolocation in miles
# 3959: distance from center to surface of earth
# 33.70, -117.88: my preferred geolocation (lat, long)
# Source: http://stackoverflow.com/a/8994850/1093087
(3959 *
ACOS(
COS(radians(33.70)) * COS(radians(job.lat)) *
COS(radians(job.lng)-radians(-117.88)) + SIN(radians(33.70)) *
SIN(radians(job.lat))
)
) AS distance
FROM companies AS co
JOIN jobs AS job ON job.company_id = co.id
WHERE
job.salary >= 120000 AND
job.annual_pto_days >= 20 AND
job.duration = 'permanent'
HAVING
(distance < 10 OR telecommute = 1)
ORDER BY
distance ASC,
salary DESC
=== Install Websphere MQ with Ansible ===
#
# WebSphere MQ Settings
#
websphere_mq:
zip_file: mqc7_7.0.1.4_linuxx86.tar.gz

user:
name: mqm
home: /var/mqm

packages:
- alien
- ksh
#
# Install WebSphere MQ
#
- name: Install WebSphere MQ
hosts: ${host}
user: root
vars_files:
- vars.yml
gather_facts: false

tasks:
- name: Install debian packages
apt: pkg=${item} state=installed
with_items: ${websphere_mq.packages}

- name: Untar MQ Client
command: tar zxf ${websphere_mq.zip_file}
chdir=${target.wd}
creates=${target.wd}/mqlicense.sh

# Need to run this with ksh; script syntax is not bash-compliant
- name: Accept MQ Client license
command: ksh mqlicense.sh -accept
chdir=${target.wd}
creates=${target.wd}/mqseriesruntime_7.0.1-5_i386.deb

- name: Setup mqm user
user: name=${websphere_mq.user.name}
home=${websphere_mq.user.home}
state=present

- name: Create MQ series deb packages using alien
command: alien --scripts --to-deb ${item.rpm}-7.0.1-4.i386.rpm
chdir=${target.wd}
creates=${target.wd}/${item.deb}_7.0.1-5_i386.deb
with_items:
- { rpm: 'MQSeriesRuntime', deb: 'mqseriesruntime' }
- { rpm: 'MQSeriesClient', deb: 'mqseriesclient' }
- { rpm: 'MQSeriesSDK', deb: 'mqseriessdk' }

- name: Install MQ series packages
command: dpkg --skip-same-version -i ${item}_7.0.1-5_i386.deb
chdir=${target.wd}
with_items:
- mqseriesruntime
- mqseriesclient
- mqseriessdk
=== Moving Average ===
%%(python)
# .venv/bin/python sandbox/python/sandbox/moving_average.py
import random
# Initial sets
mean_player_score = 55 * 11
target_player_score = 66 * 11
players = [mean_player_score] * 5
def team_avg(players):
return team_total(players) / float(len(players))
def team_total(players):
return sum(players)
def replace_worst_player(players):
current_total = team_total(players)
current_avg = team_avg(players)
target_avg = round(current_avg) + 1
target_total = target_avg * 5
team_diff = target_total - current_total
sorted_players = sorted(players, reverse=True)
cut = sorted_players.pop()
draft = cut + random.randint(1, team_diff)
sorted_players.append(draft)
return sorted_players
def replace_player(players):
current_total = team_total(players)
current_avg = team_avg(players)
target_avg = round(current_avg) + 1
target_total = target_avg * 5
team_diff = target_total - current_total
sorted_players = sorted(players, reverse=True)
# Keep top 2
players = list(sorted_players[:2])
# Cut one of remain 3
chopping_block = list(sorted_players[2:])
random.shuffle(chopping_block)
cut = chopping_block.pop()
players += chopping_block
# Replace
draft = cut + random.randint(1, team_diff)
players.append(draft)
return sorted(players, reverse=True)
def main():
global players, target_player_score
team_avgs = []
rosters = [players]
while team_avg(players) < target_player_score:
players = replace_player(players)
team_avgs.append(team_avg(players))
rosters.append(players)
print team_avgs
print rosters[:10]
print rosters[-10:]
print len(team_avgs)
if __name__ == '__main__':
main()
=== Pygame Basics ===
~- [[Pygame]]
~- http://www.pygame.org/docs/tut/tom/games2.html
Also see: https://news.ycombinator.com/item?id=8349271
=== Internet of Things ===
https://news.ycombinator.com/item?id=8237952
~- Open endpoints
~- Easy daily reminders (IFTTT)
=== Stack Overflow Query I'd Like to Run ===
A Python script: https://gist.github.com/klenwell/16dd32f4438c53042b6e
%%(sql)
SELECT
question.id,
question.url,
question.text,
question.createdat
user.karma
FROM
questions question
JOIN
users user on user.id = question.user_id
WHERE
question.accepted = FALSE AND
question.answers <= 1 AND
user.karma > 20 AND
question.createdat < NOW() - 4 HOURS AND
'ajax' IN question.tags
ORDER BY
question.votes DESC, question.created_at ASC
=== Mathematics as Daily Routine ===
http://steve-yegge.blogspot.ca/2006/03/math-for-programmers.html
~- http://en.wikipedia.org/wiki/Mathematics
~~- "Mathematics can, broadly speaking, be subdivided into the study of quantity, structure, space, and change (i.e. arithmetic, algebra, geometry, and analysis)"
https://news.ycombinator.com/item?id=7925474
Envy and the need for social status are part of the evolutionary hard-wiring for human beings. It is in many respects a zero-sum game.
It seems to me that those who are prepared to defend unchecked economic inequality, or robber baronhood in the abstract, are just underlining their own kind of envy and deference to social status. They offer their admiration for an elite ruling class that is nakedly ambitious and unapologetic greedy as a corrective against another criteria that they find exclusionary or unfair.
=== Minify ===
Grunt: http://stackoverflow.com/questions/19664662/
App Engine Page Speed: [[https://developers.google.com/appengine/docs/python/config/appconfig?hl=en#Python_app_yaml_Custom_PageSpeed_configuration https://developers.google.com/appengine/docs]]
=== Wikka New User ===
INSERT INTO users SET name='NewUser', email='NewUser@delete.me', password=MD5('password'), signuptime = NOW();
=== jQuery Validator ===
http://jsfiddle.net/8JDqZ/2/
%%(html)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>jQuery Validator</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet"
href="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
</head>
<body>
<!-- Start HTML -->
<form class="cmxform" id="commentForm" method="get" action="">
<fieldset>
<legend>Comment Form</legend>
<p>
<label for="name">Name</label>
<input id="name" name="name" type="text" required/>
</p>
<p>
<label for="email">E-Mail</label>
<input id="email" type="email" name="email" required/>
</p>
<p>
<label for="curl">URL (optional)</label>
<input id="curl" type="url" name="url"/>
</p>
<p>
<label for="comment">Your comment</label>
<textarea id="comment" name="comment" required></textarea>
</p>
<p>
<input class="submit" type="submit" value="Submit"/>
</p>
</fieldset>
</form>
<!-- End HTML -->
<!-- Javascript Here -->
<script
src="//code.jquery.com/jquery-2.1.1.min.js">
</script>
<script
src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.12.0/jquery.validate.min.js">
</script>
<script
src="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js">
</script>
<script src="fiddle.js"></script>
</body>
</html>
fiddle.js
%%(javascript)
$(document).ready(function() {
$("#commentForm").validate({
rules: form_rules,
messages: form_messages,
submitHandler: function(form) {
console.debug('submitHandler', form);
return false;
},
invalidHandler: function(event, validator) {
console.debug("INVALID:", validator.numberOfInvalids(), "errors");
},
});
console.debug('document ready');
});
$('input.submit').on('click', function() {
var is_valid = $("#commentForm").valid();
console.debug('form valid?', is_valid);
if ( is_valid ) alert('form ready for submission');
return false;
});
var form_rules = {
name: {
required: true,
minlength: 2
},
email: {
email: true
},
comment: {
minlength: 5
},
};
var form_messages = {
name: {
required: "Please enter a name",
minlength: "Your name is not long enough"
},
email: {},
comment: {
minlength: "Please add a little meat to your comment"
},
};
=== Php Closures ===
%%(php)
class Enclosure {

public $closures = array();
public $foo = '';

function add_closure($closure) {
$this->closures[] = $closure;
}

function run() {
foreach( $this->closures as $closure ) {
$closure($this);
}
}

function println($m) {
printf("%s\n", $m);
}
}
$o = new Enclosure();
$o->add_closure(function($self) {
$self->println('closure #1');
});
$o->add_closure(function($self) {
$self->println('closure #2: set foo and dump');
$self->foo = 'bar';
var_dump($self->foo);
});
$o->run();
=== Wikka Forms ===
%%(php)
class WikkaForm {
public function __construct() {}
public function open() {}
public function close() {}
public function input_text() {}
public function input_checkbox() {}
public function add_validator() {}
public function is_valid() {}
public function set_template() {}
public function render() {}
protected function validates() {}
}
class WikkaFormField {
public function __construct() {}
public function add_validator() {}
public function validates() {}
public function set_template() {}
public function render() {}
}
# Load form
$this->form = new WikkaForm();
$this->form->open();
$this->form->input_text('mysql_host', 'MySQL Host',
$this->get_config_value('mysql_host'),
$this->help_text['mysql_host']);
$this->form->hidden_text();
$this->form->close(TRUE);

# Process form request
if ( $this->form->is_submitted() ) {
$this->config = array_merge($this->config, $this->form->values());

if ( $this->form->is_valid() ) {
# Update Session data
$_SESSION['install']['config'] = $this->config;
# Change State
return $this->change_state('wiki_settings_form');
}
}
=== PHP: Dynamic Method Call ===
%%(php)
class Calculator {
function add($a, $b) { return $a + $b; }
function subtract($a, $b) { return $a - $b; }
function square_of($a) { return sqrt($a); }

}
class User {
function __construct() {
$this->calc = new Calculator();
}

function input($command) {
list($method, $args) = $command;
return call_user_func_array(array($this->calc, $method), $args);
}
}
$user = new User();
$commands = array(
array('add', array(10, 10)),
array('subtract', array(0, 10)),
array('square_of', array(64)),
);
foreach ($commands as $command) {
$output = $user->input($command);
var_dump($command);
var_dump($output);
}
=== PDO ===
%%(php)
#
# Connection
#
$pdo = new PDO(sprintf('mysql:host=%s;dbname=%s', $host, $db_name),
$user_name, $user_pass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
var_dump($pdo->getAttribute(PDO::ATTR_CONNECTION_STATUS));
#
# Raw SQL
#
$sql = <<<ENDSQL
CREATE TABLE pdo_test(
`id` INT(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`foo` varchar(50) DEFAULT NULL,
`created_at` timestamp DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `unique` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
ENDSQL;
$rows_affected = $pdo->exec($sql);
var_dump($rows_affected);
#
# Insert (with statement preparation)
#
$users = array('alovelace', 'bgates', 'sjobs');
$sql = 'INSERT INTO pdo_test (name) VALUES (?)';
$stmt = $pdo->prepare($sql);
foreach ( $users as $user ) {
$stmt->execute(array($user));
}
#
# Select (with query)
#
$sql = "SELECT * FROM pdo_test";
$rows = $pdo->query($sql);
$first_row = $rows->fetch();
foreach ( $rows as $row ) {
var_dump($row);
}
var_dump($rows->rowCount());
#
# Update
#
$sql = "UPDATE pdo_test SET foo='bar'";
$rows_updated = $pdo->exec($sql);
var_dump($rows_updated);
#
# Drop
#
$sql = "DROP TABLE pdo_test";
$rows_affected = $pdo->exec($sql);
var_dump($rows_affected);
===Wikka Migrations===
%%(php)
require_once('libs/install/migrator.php')
$migrator = new WikkaMigrator($migrations_file);
$migrator->run_migrations();
%%(php)
$old_version = $config;
$new_version = CONSTANT;
$active = FALSE;
$logged = array();
foreach ( $migrations as $v => $statements ) {
if ( $active ) {
# SQL Migrations
foreach ( $statements as $sql ) {
$sql = prep_sql($sql);
$result = run_sql($sql);
log_sql_migration($sql, $result);
}

# Config Migrations
if ( isset($config_migrations[$v]) ) {
foreach ( $config_migrations[$v] as $instruction ) {
update_config(instruction);
log_config_migration($instruction, $result);
}
}
}

# Found old version, start applying migrations with next migration
if ( $v == $old_version ) {
$apply = TRUE;
}

# Found current version, stop applying migrations
if ( $v == $new_version ) {
break;
}
}
===Install WikkaWiki From Git===
**Set Up**
cd ~/projects
git clone https://github.com/wikkawik/WikkaWiki.git ww-git
ln -sv ~/projects/ww-git /var/www
mysqladmin -uroot -p create ww_git
http://localhost/ww-git
'mysql_database' => 'ww_git',
'mysql_user' => 'root',
'mysql_password' => '<pass>'
chmod -v 777 /var/www/ww-git/config
touch /var/www/ww-git/wikka.config.php ; chmod 666 /var/www/ww-git/wikka.config.php
**Tear Down**
mysqladmin -uroot -p drop ww_git
rm -Rf ~/projects/ww-git
rm -vf /var/www/ww-git
===Reminder===
~- Return ##$magic_quotes_were_enabled## [[https://github.com/klenwell/WikkaWiki/blob/klenwell-refactor/wikka/web_service.php#L53 here]].
~- Move session start and csrf set before building request [[https://github.com/klenwell/WikkaWiki/blob/klenwell-refactor/wikka.php#L44 here]].
===Wikka Handler Refactor===
%%(php)
public function process_request($request) {
$route = $this->route_request($request);
$response = $this->run_wikka_handler($route['page'], $route['handler']);

$response->set_header('Cache-Control', 'no-cache');
$response->set_header('ETag', md5($content));
$response->set_header('Content-Length:', strlen($content));

return $response;
}

private function run_wikka_handler($page_name, $handler_name) {
$wikka = new WikkaBlob($this->config);
$wikka->connect_to_db();
$wikka->save_session_to_db();
$wikka->validate_handler_name($handler_name);

if ( $wikka->is_new_style_handler($handler_name) ) {
$handler = $wikka->load_handler_class($handler_name);
$response = $handler->handle();
return $response;
}
else {
return $this->run_old_style_handler($page_name, $handler_name);
}
}

private function run_old_style_handler($page_name, $handler_name) {
$wikka = new WikkaBlob($this->config);
$wikka->globalize_this_as_wakka_var();
$wikka->open_buffer();
$wikka->Run($page_name, $handler_name);
$content = $wikka->close_buffer();

# create response object
$response = new WikkaResponse($content, 200);
$response->set_header('Content-Type', 'text/html; charset=utf-8');

# Set header for response object from headers list
$headers = headers_sent();
foreach ($headers as $header) {
list($key, $value) = explode(':', $header, 1);
$response->set_header($key, $value);
}
return $response;
}
===Wikka Install Exception===
%%(php)
try {
$request = $webservice->prepare_request();
$webservice->start_session();
$webservice->set_csrf_token();
$webservice->raise_exception_if_install_required();
$response = $webservice->process_request($request);
}
catch (WikkaInstallException $e) {
$response = $webservice->process_installer($request);
}
catch (Exception $e) {
$response = $webservice->process_error($e);
}
===Unpublished Comment===
In response to https://news.ycombinator.com/item?id=7341400:
//I get this impression with a lot of libertarian social ideas, e.g. socialized health coverage or newfangled food supplements.
It seems to be one area where recapitulation theory[1] applies. Only by seeing ontogeny recapitulate phylogeny for themselves will some people -- strike that, most people -- appreciate the hoary inefficient logic behind long-established conventions and institution.
[1] http://en.wikipedia.org/wiki/Recapitulation_theory //

===Test Local Site on Android Chrome Attached by USB===
Full instructions here:
https://developers.google.com/chrome-developer-tools/docs/remote-debugging
DESKTOP: local machine where you doing your development
PHONE: Android device connection to DESKTOP by USB
1. On DESKTOP: Get network IP address
- Open terminal
- Run: ifconfig
- Copy inet addr for eth0 (e.g., inet addr:192.168.1.101)
2. On DESKTOP: Set up port forwarding for Chrome
- In address bar, enter: about:inspect
- Check checkbox for Discover USB devices
- Click Port Forwarding button
- In pop-up for Port Forwarding Settings, enter:
8080 <IP ADDRESS>:80

For example:
8080 192.168.1.101:80

3. On PHONE: Go to website
- In address bar, enter: 192.168.1.101:80*
* Note: This can also be done in the inspect tab by using Open tab with url
field. Just enter same value there and if Chrome is open on your phone, it
will automatically load that page.

===2014 Cocktail Napkin===
Happy New Year!


Revision [2874]

Edited on 2015-08-23 20:50:57 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
""<small>links and notes for later organization</small>"">>[[CocktailNapkin2014 2014 Napkin]]
[[CocktailNapkin2013 2013 Napkin]]
~- Rockefeller Bot Models
Deletions:
""<small>links and notes for later organization</small>"">>[[CocktailNapkin2013 2013 Napkin]]


Revision [2873]

Edited on 2015-08-20 09:13:49 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== On Long Hours and Productivity ===
Comment on [[http://www.adaptrm.com/blog/9-ways-to-be-more-productive-backed-by-science/ article]] that got flagged on HN:
> Studies shown if you lower your daily work hours from 20 to 8 and work 5 days instead of 6, your productivity increases!
#1 reaffirms something I strongly believe (whether on the basis of personal experience, something I've read before, or mere wishful thinking, I don't recall). It is a sensible constraint that came to mind in reading all the Amazon horror stories.
While reading that New York Times article I checked out the link to their 14 sacred principles. The funny thing was that I agreed with most of them. They were all ideas that occurred to me over the course of my career working independently, with small companies, and especially now in corp.
The one thing that was missing, I felt, was a Rule #15: Never work more than 8 hours a day.
Without it, it's no surprise you end up with the sort of dystopian workplace documented in the Times article and all over Reddit and HN here.
But then I suppose, as has been pointed before, long work hours are more about cultural signaling and penny-wise-pound-foolish accounting than really improving productivity.


Revision [2872]

Edited on 2015-08-17 20:02:57 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- [[https://github.com/jgm/pandoc Pandoc]]
~- [[https://github.com/ryakad/pandoc-php Pandoc-Php]]
Deletions:
~- Markdown
~- Wikka
~- MediaWiki
~- RST
~- HTML


Revision [2871]

Edited on 2015-08-16 20:39:45 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== ScoutWorks ===
WikiFish
~- Markdown
~- Wikka
~- MediaWiki
~- RST
~- HTML


Revision [2870]

Edited on 2015-08-06 06:38:27 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Wikka Refactor ===
~- Merge Strategy
~- Functional Tests
~- Automated Deployment


Revision [2863]

Edited on 2015-06-05 14:14:49 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Bundle, Rake, and rbenv ===
See http://benscheirman.com/2013/12/using-rbenv-in-cron-jobs/


Revision [2862]

Edited on 2015-06-02 11:33:08 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
Because ##assert_select## kinda sucks sometimes:
Deletions:
Because ##assert_select## kinda sucks:


Revision [2861]

Edited on 2015-06-02 11:27:45 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Rails DOM Test with Nokogiri ===
Because ##assert_select## kinda sucks:
# Collect rows and shift off header row. I'm using Nokogiri instead of css_select
# because I need to drill down to text node, which css_select makes hard if not
# impossible. Better element identifiers in template could have probably avoided this.
page = Nokogiri::HTML(@response.body)
transaction_rows = page.css("table#transactions tr")
transaction_rows.shift


Revision [2860]

Edited on 2015-05-11 11:07:42 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
https://news.ycombinator.com/item?id=9525582
I was hoping her model would get past the obvious shortcomings she glosses citing Yelp review at the end. I don't think Bernard Mandeville's poem is going to get us there.
The Righteous Society model sounds a lot like what we got on the Internet right now. See China's Human Search Engine for examples of this model in action:
http://www.bbc.com/news/magazine-25913472
I'm all for heroic efforts to spread justice. It's just that the old-fashioned techniques, marching in the streets, maybe even throwing a trash can through a shop window, seem like more measured approaches than a lot of what I seen come from the internet.


Revision [2856]

Edited on 2015-04-06 13:36:20 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
http://www.codequizzes.com/


Revision [2855]

Edited on 2015-04-04 09:37:21 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Interview Portfolio ===
[[https://drive.google.com/folderview?id=0B6K9xXSLapkzfkhlX0NJTmZCa2hIcDFFa1pVVXFLOENsTGc1RUZmZ29TRGxPQ001NGdsaTQ&usp=sharing Google Drive]]


Revision [2853]

Edited on 2015-03-27 10:53:25 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
Before: [[https://github.com/klenwell/WikkaWiki/blob/9dfc1/wikka.php wikka.php]]
After: [[https://github.com/klenwell/WikkaWiki/blob/klenwell-refactor/wikka.php wikka.php]]
Deletions:
Before: https://github.com/klenwell/WikkaWiki/blob/9dfc1/wikka.php
After: https://github.com/klenwell/WikkaWiki/blob/klenwell-refactor/wikka.php


Revision [2852]

Edited on 2015-03-27 10:52:48 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Wikka Before and After ===
Before: https://github.com/klenwell/WikkaWiki/blob/9dfc1/wikka.php
After: https://github.com/klenwell/WikkaWiki/blob/klenwell-refactor/wikka.php


Revision [2836]

Edited on 2015-01-21 14:36:30 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Python with Jenkins ===
http://shiningpanda.com/python-multiple-versions-testing-with.html


Revision [2834]

Edited on 2015-01-14 11:37:51 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Quick Temp Rails Controller ===
# app/controllers/temps_controller.rb
# Add to routes.rb:
# resources :accounts, only: [:index]
class TempsController < ApplicationController
# GET /
def index
render html: 'hello world', layout: "application"
end
end
==== 2014 ====


Revision [2824]

Edited on 2014-12-20 15:08:17 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
https://news.ycombinator.com/item?id=8777899
The author frames the stigma associated with "survival jobs" (and the challenge faced nowadays by anybody not optimizing their future around the effective use of capital) in an interesting way. What alarms me, in part, is how many jobs I've come to see as survival jobs.
A couple years ago when Hostess went out of business after a strike by workers, I overheard a project manager in our breakroom scoffing at the idea that their senior bakery workers thought they deserved $60,000/year. The question I wanted to put to him is one I come back to regularly: how much do you think experience baker (or a dutiful custodian or a reliable service worker) should make? And how do you get to that figure?
Incidentally, that project manager is probably making at least twice as much as the best paid of those bakery workers, yet if you asked his teammates, and those who worked regularly with him, what have been his most important contributions to the projects that he has worked on over the course of his several years with the company, they'd probably be left to cite the office betting pools he organizes for each of the major sporting events throughout the year.


Revision [2823]

Edited on 2014-11-03 09:47:44 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- http://xuanji.appspot.com/isicp/index.html
~- http://interactivepython.org/runestone/static/thinkcspy/index.html
Deletions:
http://xuanji.appspot.com/isicp/index.html


Revision [2822]

Edited on 2014-11-03 08:22:43 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Interactive SICP ===
http://xuanji.appspot.com/isicp/index.html


Revision [2798]

Edited on 2014-10-27 16:52:36 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Job Search ===
Job search as SQL query:
# Company details
co.overview AS company,
# Job details
job.overview AS overview,
job.title AS title,
job.duration AS duration,
job.salary AS salary,
job.annual_pto_days AS pto,
job.telecommute AS telecommute,
# Distance from my ideal geolocation in miles
# 3959: distance from center to surface of earth
# 33.70, -117.88: my preferred geolocation (lat, long)
# Source: http://stackoverflow.com/a/8994850/1093087
(3959 *
ACOS(
COS(radians(33.70)) * COS(radians(job.lat)) *
COS(radians(job.lng)-radians(-117.88)) + SIN(radians(33.70)) *
SIN(radians(job.lat))
)
) AS distance
FROM companies AS co
JOIN jobs AS job ON job.company_id = co.id
job.salary >= 120000 AND
job.annual_pto_days >= 20 AND
job.duration = 'permanent'
HAVING
(distance < 10 OR telecommute = 1)
ORDER BY
distance ASC,
salary DESC


Revision [2789]

Edited on 2014-09-22 08:52:37 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
Also see: https://news.ycombinator.com/item?id=8349271


Revision [2788]

Edited on 2014-09-19 09:11:30 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
# WebSphere MQ Settings
websphere_mq:
zip_file: mqc7_7.0.1.4_linuxx86.tar.gz
user:
name: mqm
home: /var/mqm
packages:
- alien
- ksh


Revision [2787]

Edited on 2014-09-19 09:10:11 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Install Websphere MQ with Ansible ===
# Install WebSphere MQ
- name: Install WebSphere MQ
hosts: ${host}
user: root
vars_files:
- vars.yml
gather_facts: false

tasks:
- name: Install debian packages
apt: pkg=${item} state=installed
with_items: ${websphere_mq.packages}
- name: Untar MQ Client
command: tar zxf ${websphere_mq.zip_file}
chdir=${target.wd}
creates=${target.wd}/mqlicense.sh
# Need to run this with ksh; script syntax is not bash-compliant
- name: Accept MQ Client license
command: ksh mqlicense.sh -accept
chdir=${target.wd}
creates=${target.wd}/mqseriesruntime_7.0.1-5_i386.deb

- name: Setup mqm user
user: name=${websphere_mq.user.name}
home=${websphere_mq.user.home}
state=present
- name: Create MQ series deb packages using alien
command: alien --scripts --to-deb ${item.rpm}-7.0.1-4.i386.rpm
chdir=${target.wd}
creates=${target.wd}/${item.deb}_7.0.1-5_i386.deb
with_items:
- { rpm: 'MQSeriesRuntime', deb: 'mqseriesruntime' }
- { rpm: 'MQSeriesClient', deb: 'mqseriesclient' }
- { rpm: 'MQSeriesSDK', deb: 'mqseriessdk' }
- name: Install MQ series packages
command: dpkg --skip-same-version -i ${item}_7.0.1-5_i386.deb
chdir=${target.wd}
with_items:
- mqseriesruntime
- mqseriesclient
- mqseriessdk


Revision [2786]

Edited on 2014-09-16 12:29:55 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Moving Average ===
%%(python)
# .venv/bin/python sandbox/python/sandbox/moving_average.py
import random
# Initial sets
mean_player_score = 55 * 11
target_player_score = 66 * 11
players = [mean_player_score] * 5
def team_avg(players):
return team_total(players) / float(len(players))
def team_total(players):
return sum(players)
def replace_worst_player(players):
current_total = team_total(players)
current_avg = team_avg(players)
target_avg = round(current_avg) + 1
target_total = target_avg * 5
team_diff = target_total - current_total
sorted_players = sorted(players, reverse=True)
cut = sorted_players.pop()
draft = cut + random.randint(1, team_diff)
sorted_players.append(draft)
return sorted_players
def replace_player(players):
current_total = team_total(players)
current_avg = team_avg(players)
target_avg = round(current_avg) + 1
target_total = target_avg * 5
team_diff = target_total - current_total
sorted_players = sorted(players, reverse=True)
# Keep top 2
players = list(sorted_players[:2])
# Cut one of remain 3
chopping_block = list(sorted_players[2:])
random.shuffle(chopping_block)
cut = chopping_block.pop()
players += chopping_block
# Replace
draft = cut + random.randint(1, team_diff)
players.append(draft)
return sorted(players, reverse=True)
def main():
global players, target_player_score
team_avgs = []
rosters = [players]
while team_avg(players) < target_player_score:
players = replace_player(players)
team_avgs.append(team_avg(players))
rosters.append(players)
print team_avgs
print rosters[:10]
print rosters[-10:]
print len(team_avgs)
if __name__ == '__main__':
main()


Revision [2785]

Edited on 2014-09-09 12:04:22 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- [[Pygame]]
~- http://www.pygame.org/docs/tut/tom/games2.html
Deletions:
See http://www.pygame.org/docs/tut/tom/games2.html


Revision [2784]

Edited on 2014-09-09 12:02:41 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Pygame Basics ===
See http://www.pygame.org/docs/tut/tom/games2.html


Revision [2783]

Edited on 2014-08-28 12:13:59 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Internet of Things ===
https://news.ycombinator.com/item?id=8237952
~- Open endpoints
~- Easy daily reminders (IFTTT)


Revision [2778]

Edited on 2014-07-19 21:45:06 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
A Python script: https://gist.github.com/klenwell/16dd32f4438c53042b6e


Revision [2777]

Edited on 2014-07-19 17:07:44 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Stack Overflow Query I'd Like to Run ===
%%(sql)
SELECT
question.id,
question.url,
question.text,
question.createdat
user.karma
FROM
questions question
JOIN
users user on user.id = question.user_id
WHERE
question.accepted = FALSE AND
question.answers <= 1 AND
user.karma > 20 AND
question.createdat < NOW() - 4 HOURS AND
'ajax' IN question.tags
ORDER BY
question.votes DESC, question.created_at ASC


Revision [2775]

Edited on 2014-07-03 12:18:09 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~~- "Mathematics can, broadly speaking, be subdivided into the study of quantity, structure, space, and change (i.e. arithmetic, algebra, geometry, and analysis)"


Revision [2774]

Edited on 2014-07-03 12:11:58 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Mathematics as Daily Routine ===
http://steve-yegge.blogspot.ca/2006/03/math-for-programmers.html
~- http://en.wikipedia.org/wiki/Mathematics


Revision [2771]

Edited on 2014-06-21 10:46:03 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Unpublished Comment ===
https://news.ycombinator.com/item?id=7925474
Envy and the need for social status are part of the evolutionary hard-wiring for human beings. It is in many respects a zero-sum game.
It seems to me that those who are prepared to defend unchecked economic inequality, or robber baronhood in the abstract, are just underlining their own kind of envy and deference to social status. They offer their admiration for an elite ruling class that is nakedly ambitious and unapologetic greedy as a corrective against another criteria that they find exclusionary or unfair.


Revision [2766]

Edited on 2014-06-17 16:09:22 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
App Engine Page Speed: [[https://developers.google.com/appengine/docs/python/config/appconfig?hl=en#Python_app_yaml_Custom_PageSpeed_configuration https://developers.google.com/appengine/docs]]
Deletions:
App Engine Page Speed: https://developers.google.com/appengine/docs/python/config/appconfig?hl=en#Python_app_yaml_Custom_PageSpeed_configuration


Revision [2765]

Edited on 2014-06-17 16:09:00 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Minify ===
Grunt: http://stackoverflow.com/questions/19664662/
App Engine Page Speed: https://developers.google.com/appengine/docs/python/config/appconfig?hl=en#Python_app_yaml_Custom_PageSpeed_configuration


Revision [2763]

Edited on 2014-06-17 06:25:29 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
INSERT INTO users SET name='NewUser', email='NewUser@delete.me', password=MD5('password'), signuptime = NOW();
Deletions:
INSERT INTO users SET name='NewUser', email='NewUser@delete.me', password=MD5('trust123'), signuptime = NOW();


Revision [2762]

Edited on 2014-06-17 06:24:45 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Wikka New User ===
INSERT INTO users SET name='NewUser', email='NewUser@delete.me', password=MD5('trust123'), signuptime = NOW();


Revision [2761]

Edited on 2014-06-16 13:12:03 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
%%(html)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>jQuery Validator</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet"
href="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
</head>
<body>
<!-- Start HTML -->
<form class="cmxform" id="commentForm" method="get" action="">
<fieldset>
<legend>Comment Form</legend>
<p>
<label for="name">Name</label>
<input id="name" name="name" type="text" required/>
</p>
<p>
<label for="email">E-Mail</label>
<input id="email" type="email" name="email" required/>
</p>
<p>
<label for="curl">URL (optional)</label>
<input id="curl" type="url" name="url"/>
</p>
<p>
<label for="comment">Your comment</label>
<textarea id="comment" name="comment" required></textarea>
</p>
<p>
<input class="submit" type="submit" value="Submit"/>
</p>
</fieldset>
</form>
<!-- End HTML -->
<!-- Javascript Here -->
<script
src="//code.jquery.com/jquery-2.1.1.min.js">
</script>
<script
src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.12.0/jquery.validate.min.js">
</script>
<script
src="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js">
</script>
<script src="fiddle.js"></script>
</body>
</html>
fiddle.js
%%(javascript)
$(document).ready(function() {
$("#commentForm").validate({
rules: form_rules,
messages: form_messages,
submitHandler: function(form) {
console.debug('submitHandler', form);
return false;
},
invalidHandler: function(event, validator) {
console.debug("INVALID:", validator.numberOfInvalids(), "errors");
},
});
console.debug('document ready');
$('input.submit').on('click', function() {
var is_valid = $("#commentForm").valid();
console.debug('form valid?', is_valid);
if ( is_valid ) alert('form ready for submission');
return false;
var form_rules = {
name: {
required: true,
minlength: 2
},
email: {
email: true
},
comment: {
minlength: 5
},
};
var form_messages = {
name: {
required: "Please enter a name",
minlength: "Your name is not long enough"
},
email: {},
comment: {
minlength: "Please add a little meat to your comment"
},
};


Revision [2760]

Edited on 2014-06-16 09:53:41 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== jQuery Validator ===
http://jsfiddle.net/8JDqZ/2/


Revision [2734]

Edited on 2014-03-21 10:58:40 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Php Closures ===
class Enclosure {
public $closures = array();
public $foo = '';
function add_closure($closure) {
$this->closures[] = $closure;
function run() {
foreach( $this->closures as $closure ) {
$closure($this);
function println($m) {
printf("%s\n", $m);
$o = new Enclosure();
$o->add_closure(function($self) {
$self->println('closure #1');
});
$o->add_closure(function($self) {
$self->println('closure #2: set foo and dump');
$self->foo = 'bar';
var_dump($self->foo);
});
$o->run();


Revision [2733]

Edited on 2014-03-21 07:27:34 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
# Load form
$this->form = new WikkaForm();
$this->form->open();
$this->form->input_text('mysql_host', 'MySQL Host',
$this->get_config_value('mysql_host'),
$this->help_text['mysql_host']);
$this->form->hidden_text();
$this->form->close(TRUE);
# Process form request
if ( $this->form->is_submitted() ) {
$this->config = array_merge($this->config, $this->form->values());

if ( $this->form->is_valid() ) {
# Update Session data
$_SESSION['install']['config'] = $this->config;
# Change State
return $this->change_state('wiki_settings_form');
}


Revision [2732]

Edited on 2014-03-21 07:14:56 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== Wikka Forms ===
Deletions:
=== WikkaForm ===


Revision [2731]

Edited on 2014-03-21 07:14:31 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== WikkaForm ===
class WikkaForm {
public function __construct() {}
public function open() {}
public function close() {}
public function input_text() {}
public function input_checkbox() {}
public function add_validator() {}
public function is_valid() {}
public function set_template() {}
public function render() {}
protected function validates() {}
class WikkaFormField {
public function __construct() {}
public function add_validator() {}
public function validates() {}
public function set_template() {}
public function render() {}


Revision [2730]

Edited on 2014-03-20 18:32:32 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
$first_row = $rows->fetch();


Revision [2729]

Edited on 2014-03-18 15:24:21 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== PHP: Dynamic Method Call ===
class Calculator {
function add($a, $b) { return $a + $b; }
function subtract($a, $b) { return $a - $b; }
function square_of($a) { return sqrt($a); }
class User {
function __construct() {
$this->calc = new Calculator();
function input($command) {
list($method, $args) = $command;
return call_user_func_array(array($this->calc, $method), $args);
$user = new User();
$commands = array(
array('add', array(10, 10)),
array('subtract', array(0, 10)),
array('square_of', array(64)),
);
foreach ($commands as $command) {
$output = $user->input($command);
var_dump($command);
var_dump($output);


Revision [2728]

Edited on 2014-03-18 08:41:25 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
$rows_updated = $pdo->exec($sql);
var_dump($rows_updated);
Deletions:
$rows_update = $pdo->exec($sql);
var_dump($rows_update);


Revision [2727]

Edited on 2014-03-18 08:39:59 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
=== PDO ===
#
# Connection
#
$pdo = new PDO(sprintf('mysql:host=%s;dbname=%s', $host, $db_name),
$user_name, $user_pass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
var_dump($pdo->getAttribute(PDO::ATTR_CONNECTION_STATUS));
#
# Raw SQL
#
$sql = <<<ENDSQL
CREATE TABLE pdo_test(
`id` INT(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`foo` varchar(50) DEFAULT NULL,
`created_at` timestamp DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `unique` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
ENDSQL;
$rows_affected = $pdo->exec($sql);
var_dump($rows_affected);
#
# Insert (with statement preparation)
#
$users = array('alovelace', 'bgates', 'sjobs');
$sql = 'INSERT INTO pdo_test (name) VALUES (?)';
$stmt = $pdo->prepare($sql);
foreach ( $users as $user ) {
$stmt->execute(array($user));
#
# Select (with query)
#
$sql = "SELECT * FROM pdo_test";
$rows = $pdo->query($sql);
foreach ( $rows as $row ) {
var_dump($row);
var_dump($rows->rowCount());
#
# Update
#
$sql = "UPDATE pdo_test SET foo='bar'";
$rows_update = $pdo->exec($sql);
var_dump($rows_update);
#
# Drop
#
$sql = "DROP TABLE pdo_test";
$rows_affected = $pdo->exec($sql);
var_dump($rows_affected);


Revision [2726]

Edited on 2014-03-17 15:46:44 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
require_once('libs/install/migrator.php')
$migrator = new WikkaMigrator($migrations_file);
$migrator->run_migrations();


Revision [2725]

Edited on 2014-03-17 13:27:54 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
log_sql_migration($sql, $result);
log_config_migration($instruction, $result);
Deletions:
log_result($sql, $result);


Revision [2724]

Edited on 2014-03-17 13:25:59 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
===Wikka Migrations===
$old_version = $config;
$new_version = CONSTANT;
$active = FALSE;
$logged = array();
foreach ( $migrations as $v => $statements ) {
if ( $active ) {
# SQL Migrations
foreach ( $statements as $sql ) {
$sql = prep_sql($sql);
$result = run_sql($sql);
log_result($sql, $result);
# Config Migrations
if ( isset($config_migrations[$v]) ) {
foreach ( $config_migrations[$v] as $instruction ) {
update_config(instruction);
}
# Found old version, start applying migrations with next migration
if ( $v == $old_version ) {
$apply = TRUE;
# Found current version, stop applying migrations
if ( $v == $new_version ) {
break;


Revision [2723]

Edited on 2014-03-16 08:58:23 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
cd ~/projects
ln -sv ~/projects/ww-git /var/www
Deletions:
ln -sv ~/project/ww-git /var/www


Revision [2722]

Edited on 2014-03-15 22:47:57 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Set Up**
mysqladmin -uroot -p create ww_git
**Tear Down**
mysqladmin -uroot -p drop ww_git
rm -Rf ~/projects/ww-git
rm -vf /var/www/ww-git
Deletions:
====Set Up====
mysqladmin -uroot -p<pass> create ww_git
====Tear Down====


Revision [2721]

Edited on 2014-03-15 22:46:17 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
===Install WikkaWiki From Git===
====Set Up====
git clone https://github.com/wikkawik/WikkaWiki.git ww-git
ln -sv ~/project/ww-git /var/www
mysqladmin -uroot -p<pass> create ww_git
http://localhost/ww-git
'mysql_database' => 'ww_git',
'mysql_user' => 'root',
'mysql_password' => '<pass>'
chmod -v 777 /var/www/ww-git/config
touch /var/www/ww-git/wikka.config.php ; chmod 666 /var/www/ww-git/wikka.config.php
====Tear Down====


Revision [2720]

Edited on 2014-03-14 11:33:51 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- Return ##$magic_quotes_were_enabled## [[https://github.com/klenwell/WikkaWiki/blob/klenwell-refactor/wikka/web_service.php#L53 here]].
~- Move session start and csrf set before building request [[https://github.com/klenwell/WikkaWiki/blob/klenwell-refactor/wikka.php#L44 here]].
Deletions:
Return ##$magic_quotes_were_enabled## [[https://github.com/klenwell/WikkaWiki/blob/klenwell-refactor/wikka/web_service.php#L53 here]].


Revision [2719]

Edited on 2014-03-14 11:30:38 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
===Reminder===
Return ##$magic_quotes_were_enabled## [[https://github.com/klenwell/WikkaWiki/blob/klenwell-refactor/wikka/web_service.php#L53 here]].


Revision [2718]

Edited on 2014-03-13 08:19:44 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
===Wikka Handler Refactor===
public function process_request($request) {
$route = $this->route_request($request);
$response = $this->run_wikka_handler($route['page'], $route['handler']);

$response->set_header('Cache-Control', 'no-cache');
$response->set_header('ETag', md5($content));
$response->set_header('Content-Length:', strlen($content));

return $response;
}
private function run_wikka_handler($page_name, $handler_name) {
$wikka = new WikkaBlob($this->config);
$wikka->connect_to_db();
$wikka->save_session_to_db();
$wikka->validate_handler_name($handler_name);

if ( $wikka->is_new_style_handler($handler_name) ) {
$handler = $wikka->load_handler_class($handler_name);
$response = $handler->handle();
return $response;
}
else {
return $this->run_old_style_handler($page_name, $handler_name);
}
}
private function run_old_style_handler($page_name, $handler_name) {
$wikka = new WikkaBlob($this->config);
$wikka->globalize_this_as_wakka_var();
$wikka->open_buffer();
$wikka->Run($page_name, $handler_name);
$content = $wikka->close_buffer();

# create response object
$response = new WikkaResponse($content, 200);
$response->set_header('Content-Type', 'text/html; charset=utf-8');

# Set header for response object from headers list
$headers = headers_sent();
foreach ($headers as $header) {
list($key, $value) = explode(':', $header, 1);
$response->set_header($key, $value);
}
return $response;
}


Revision [2717]

Edited on 2014-03-12 11:38:21 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
$webservice->raise_exception_if_install_required();
Deletions:
$webservice->check_for_install(); # raises WikkaInstallException


Revision [2716]

Edited on 2014-03-12 11:37:00 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
===Wikka Install Exception===
%%(php)
try {
$request = $webservice->prepare_request();
$webservice->start_session();
$webservice->set_csrf_token();
$webservice->check_for_install(); # raises WikkaInstallException
$response = $webservice->process_request($request);
}
catch (WikkaInstallException $e) {
$response = $webservice->process_installer($request);
}
catch (Exception $e) {
$response = $webservice->process_error($e);
}
%%


Revision [2715]

Edited on 2014-03-04 10:10:35 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
[1] http://en.wikipedia.org/wiki/Recapitulation_theory //
Deletions:
[1] http://en.wikipedia.org/wiki/Recapitulation_theory//


Revision [2714]

Edited on 2014-03-04 10:10:24 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
//I get this impression with a lot of libertarian social ideas, e.g. socialized health coverage or newfangled food supplements.
It seems to be one area where recapitulation theory[1] applies. Only by seeing ontogeny recapitulate phylogeny for themselves will some people -- strike that, most people -- appreciate the hoary inefficient logic behind long-established conventions and institution.
[1] http://en.wikipedia.org/wiki/Recapitulation_theory//
Deletions:
I get this impression with a lot of libertarian social ideas, e.g. socialized health coverage.
It seems to be one area where recapitulation theory[1] applies. Only by seeing ontogeny recapitulate phylogeny for themselves will some people -- strike that, most people -- appreciate the hoary inefficient logic behind long-established conventions and institution.
[1] http://en.wikipedia.org/wiki/Recapitulation_theory


Revision [2713]

Edited on 2014-03-04 10:06:15 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
===Unpublished Comment===
In response to https://news.ycombinator.com/item?id=7341400:
I get this impression with a lot of libertarian social ideas, e.g. socialized health coverage.
It seems to be one area where recapitulation theory[1] applies. Only by seeing ontogeny recapitulate phylogeny for themselves will some people -- strike that, most people -- appreciate the hoary inefficient logic behind long-established conventions and institution.
[1] http://en.wikipedia.org/wiki/Recapitulation_theory


Revision [2711]

Edited on 2014-02-01 17:22:05 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
===Test Local Site on Android Chrome Attached by USB===
Full instructions here:
https://developers.google.com/chrome-developer-tools/docs/remote-debugging
DESKTOP: local machine where you doing your development
PHONE: Android device connection to DESKTOP by USB
1. On DESKTOP: Get network IP address
- Open terminal
- Run: ifconfig
- Copy inet addr for eth0 (e.g., inet addr:192.168.1.101)
2. On DESKTOP: Set up port forwarding for Chrome
- In address bar, enter: about:inspect
- Check checkbox for Discover USB devices
- Click Port Forwarding button
- In pop-up for Port Forwarding Settings, enter:
8080 <IP ADDRESS>:80

For example:
8080 192.168.1.101:80

3. On PHONE: Go to website
- In address bar, enter: 192.168.1.101:80*
* Note: This can also be done in the inspect tab by using Open tab with url
field. Just enter same value there and if Chrome is open on your phone, it
will automatically load that page.


Revision [2710]

Edited on 2014-01-18 11:44:23 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
===2014 Cocktail Napkin===
Happy New Year!


Revision [2709]

Edited on 2014-01-18 11:42:56 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]

No Differences

Revision [2707]

Edited on 2014-01-18 11:39:06 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
""<small>links and notes for later organization</small>"">>[[CocktailNapkin2013 2013 Napkin]]
[[CocktailNapkin2012 2012 Napkin]]
Deletions:
""<small>links and notes for later organization</small>"">>[[CocktailNapkin2012 2012 Napkin]]
**Ansible Setup**
~- MySQL: [[https://github.com/fourkitchens/server-playbooks github.com]] [[http://stackoverflow.com/q/16444306/1093087 stackoverflow.com]]
~- PHP
~- phpinfo script
~- db script
~- ##mkdir -pv deployment/roles/common/{tasks,handlers,templates,files,vars}##
~- ##mkdir -pv deployment/roles/{system,webserver,rails}/{tasks,handlers,templates,files,vars}##
**++Un++published Comment**
response to https://news.ycombinator.com/item?id=6571678
Here's an interesting point made about Arab Spring:
//While the poor struggle to survive from day to day, disappointed middle-class people are much more likely to engage in political activism to get their way.
This dynamic was evident in the Arab Spring, where regime-changing uprisings were led by tens of thousands of relatively well-educated young people. Both Tunisia and Egypt had produced large numbers of college graduates over the past generation. But the authoritarian governments of Zine El Abidine Ben Ali and Hosni Mubarak were classic crony-capitalist regimes, in which economic opportunities depended heavily on political connections. Neither country, in any event, had grown fast enough economically to provide jobs for ever-larger cohorts of young people. The result was political revolution.
None of this is a new phenomenon. The French, Bolshevik and Chinese Revolutions were all led by discontented middle-class individuals, even if their ultimate course was later affected by peasants, workers and the poor.//
I think both Occupy and Tea Party movements fit this model. College kids mired in debt who can't find decent jobs. Aging white middle class conservatives watching the financial class run away with the lion's share of economic growth (while being led to believe that's it's being siphoned off by immigrants, welfare queens, and gay married couples).
Also brings to mind the old "Revolution to Conserve" idea I was introduced to back in AP American History:
http://en.wikipedia.org/wiki/Clinton_Rossiter
**Kinetic Scaling**
~- For dragbounds, see https://github.com/ericdrowell/KineticJS/issues/216
~- Demo: http://www.html5canvastutorials.com/kineticjs/html5-canvas-kineticjs-scale-animation-tutorial/
~- Phonegap: http://w2davids.wordpress.com/html5-mobile-web-canvas-animation-using-phonegap-kinetic-js/
~- Scaling Demos
~~- http://stackoverflow.com/a/13663169/1093087
~~- http://stackoverflow.com/a/13895418/1093087
**Parasitic Simulation with KineticJS**
http://jsfiddle.net/klenwell/JvG2Z/
HTML
%%
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Sim</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="basic.css">
</head>

<body>
<div id="app-stage"></div>
<button id="stop-button">stop</button>

<!-- Javascript Here -->
<script src="kinetic-v4.7.1.js"></script>
<script src="fiddle.js"></script>
</body>
</html>
%%
CSS: basic.css
%%
div#app-stage .kineticjs-content {
margin:0 auto;
background-color:#EEEEEE;
border:1px solid #DDDDDD;
}
%%
** HocObject Neo-Parasitic Inheritance**
http://jsfiddle.net/klenwell/RV4a3/
http://jsfiddle.net/klenwell/MsTay/
**Javascript Parasitic Instance Inference**
I'm trying to develop a simple parasitic interface for my javascript classes modelled after Crockford and I'd like to implement some basic introspective methods. Given the class hierarchy below, how can I write class_name and is_a methods that correctly identify the object class? ... This question provides some additional information about my approach.
~- Stack Overflow: http://stackoverflow.com/q/18922197/1093087
~- Question: http://jsfiddle.net/xhcC2/
~- Solution: http://jsfiddle.net/F98Jz/1/
**Javascript Inheritance**
http://jsfiddle.net/AvdK2/4/
http://jsfiddle.net/SSDgv/23/
http://stackoverflow.com/questions/18776989/
~- http://www.crockford.com/javascript/inheritance.html
~- http://stackoverflow.com/questions/8165181/
~- http://stackoverflow.com/questions/5842654/
~- http://stackoverflow.com/questions/812961/
~- http://javascriptweblog.wordpress.com/2010/11/15/extending-objects-with-javascript-getters/
~- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty
~- https://github.com/ericdrowell/KineticJS/blob/master/src/Global.js
**Weather Data**
~- Requires token for NOAA (they're free): http://www.ncdc.noaa.gov/cdo-web/token
~- Data Services: http://www.ncdc.noaa.gov/cdo-services/services/datasets?token=Uvz...
~- Location Search: http://www.ncdc.noaa.gov/cdo-services/services/datasets/GHCND/locationsearch?_type=json&latitude=33.7408&longitude=-117.8814&radius=10&token=Uvz...
~- Data Types for Zip: http://www.ncdc.noaa.gov/cdo-services/services/datasets/GHCND/locations/ZIP:92701/datatypes?_type=json&token=Uvz...
~- Daily Historical Data by Zip: http://www.ncdc.noaa.gov/cdo-services/services/datasets/GHCND/locations/ZIP:92705/data?_type=json&year=1972&month=05&startday=22&endday=22&token=Uvz...
~- Daily Historical Data by Station: http://www.ncdc.noaa.gov/cdo-services/services/datasets/GHCND/stations/GHCND:USC00047888/data?_type=json&year=1972&month=05&startday=22&endday=22&token=Uvz...
~- Historical Daily High Temp for Month (Tenths of C): http://www.ncdc.noaa.gov/cdo-services/services/datasets/GHCND/stations/GHCND:USC00047888/datatypes/TMAX/data?_type=json&year=1972&month=05&token=Uvz...
%%(python)
"""
Get high temperatures from a given weather station
"""
from datetime import datetime
import time
import requests
from pprint import pprint
noaa_url = 'http://www.ncdc.noaa.gov/cdo-services/services'
noaa_service_f = 'datasets/GHCND/stations/%s/datatypes/TMAX/data'
token = 'YOUR TOKEN HERE'
station_id = 'GHCND:USC00047888'
api_rate_limit = 1.25 # seconds
def c10_to_f(value):
c = value / 10.0
f = c * (9.0 / 5) + 32
return '%.1f' % (f)

def get_tmax_data(station_id, start, stop=None):
records = []
start_year, start_month = start

if stop:
stop_year, stop_month = stop
else:
now = datetime.now()
stop_year, stop_month = now.year, now.month

months = range(1,13)
years = range(start_year, stop_year+1)

qstring_f = '_type=json&year=%d&month=%02d&token=%s'

noaa_service = noaa_service_f % (station_id)
base_url = '%s/%s' % (noaa_url, noaa_service)

ymd_f = '%Y-%m-%d'
min_date = datetime.strptime('%d-%02d-01' % (start_year, start_month), ymd_f)
max_date = datetime.strptime('%d-%02d-01' % (stop_year, stop_month+1), ymd_f)

for y in years:
for m in months:
# skip if date is too early
my_date = datetime.strptime('%d-%02d-15' % (y,m), '%Y-%m-%d')
if my_date < min_date:
continue

# stop if date is too late
if my_date > max_date:
break

qstring = qstring_f % (y, m, token)
request_url = '%s?%s' % (base_url, qstring)
print y, m, request_url

r = requests.get(request_url)
data = r.json()['dataCollection']['data']

for i,datum in enumerate(data):
dated = datum['date'].split('T')[0]
value = datum['value']
f = c10_to_f(value)
record = (dated, '%.1f' % (value), f)
records.append(record)

time.sleep(api_rate_limit)

return records

#
# Tests
#
pprint(get_tmax_data(station_id, (2013,8)))
%%
**Colors**
~- http://jsfiddle.net/SMrLk/1/
**Wine Recommendation**
~- http://www.chateaustjean.com/ (Sue, 2012.11.09)
**jTable Factory**
http://jsfiddle.net/rHmh6/1/
**Wikka Tasks Interface**
~- A ##tasks.php## script to run tasks in backend.
~- A ##tasks## directory in which to place them
~- A Tasks interface, like Actions, by which to define them
**CSS Balls**
http://jsfiddle.net/ZCR2H/17/
**jQuery $.when**
http://jsfiddle.net/3b2t9/4/
http://stackoverflow.com/a/9865124/1093087
http://stackoverflow.com/a/755913/1093087
**Javascript: String Objects vs String Literals**
http://stackoverflow.com/questions/3297867/
http://jsfiddle.net/E8DAW/1/
**Browser Storage Options**
~- [[http://csimms.botonomy.com/2011/05/html5-storage-wars-localstorage-vs-indexeddb-vs-web-sql.html localStorage v. IndexedDB v. Web SQL]] (csimms.botonomy.com)
~- http://diveintohtml5.info/storage.html
~- http://stackoverflow.com/questions/5924485/
**Jenkins Variables**
$WORKSPACE
$VIRTUAL_ENV
[[https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables Others]]
**Android Browser Translation App**
I'm looking for one: http://android.stackexchange.com/q/46414/35024
**The Locust Economy**
~- http://www.ribbonfarm.com/2013/04/03/the-locust-economy/
//There seems to be an implicit holier-than-thou assumption among sharing economy evangelists that social sharing is primarily about virtuous behaviors like generosity, empathy, minding the planet, conserving resources, avoiding waste and so forth. Only secondarily do they see it as a zero-sum/negative-sum adaptation to recessionary conditions -- Bruce Sterling's favela chic.//
~- Wage Service Scheduling Siphon: [[http://www.nytimes.com/2012/10/28/business/a-part-time-life-as-hours-shrink-and-shift-for-american-workers.html?pagewanted=all&_r=0 A Part-Time Life, as Hours Shrink and Shift (nytimes.com)]]
~- High Frequency Trading Algorithms
~- Ticket Bots: [[http://www.nytimes.com/2013/05/27/business/media/bots-that-siphon-off-tickets-frustrate-concert-promoters.html Concert Industry Struggles With 'Bots' That Siphon Off Tickets (nytimes.com)]]
**Personal Breathalyzers**
Was joking we need an app for this with talk of lowering legal BAC limit. Then it occurred to me to google it. Found:
~- [[http://www.pcmag.com/article2/0,2817,2417229,00.asp Coming Smartphone Dongle (pcmag.com)]]
~- [[http://www.wired.com/reviews/2010/04/pr_roundup_breathalyzers/ Wired Article from 2010 (wired.com)]]
**Red/Blue/Mainstream Marketing**
Listening to KUSC classical public radio fundraiser where they mentioned some dead commercial classical radio stations. Why have commercial classical radio stations died? Because, I'm guessing, blue (affluent, college-educated, progressive/liberalish) listeners won't listen to commercials. //Unless// they come in the form of discreet underwriting.
Surely upscale advertisers want to reach this blue audience as much as they ever have. It's just that blue audience will be receptive to them only under certain conditions, which exclude the sort crude advertisements listeners of mainstream and talk radio are prepared to endure.
How does underwriting revenue compare to old traditional commercial advertising revenue? Significantly less? More? Factor in difference between profit and not-for-profit station setups. Is it roughly comparable? My guess is that it is as lucrative, in terms of providing income for actual employees, as it ever was. But probably a slimmed-down operation (e.g., much smaller advertising dept that now goes under a different name) and no investors involved (so they will look elsewhere for their passive income.)
**An Introduction to the Raphael JS Library**
[[http://net.tutsplus.com/tutorials/javascript-ajax/an-introduction-to-the-raphael-js-library/ http://net.tutsplus.com/]]
http://jsfiddle.net/htH9j/6/
http://jsfiddle.net/rKMq5/1/
http://jsfiddle.net/6nxdV/1/
**Google App Engine 1.7.6**
~- "a new requirement for the new dev_appserver is [[http://pythonhosted.org/pyobjc/install.html PyObjC]]" ([[http://www.reddit.com/r/AppEngine/comments/1am9f8/app_engine_176_released/c8z06k8 reddit.com]])
~- http://code.google.com/p/appengine-devappserver2-experiment/issues/list
**(Un)Discarded Comments**
[[https://news.ycombinator.com/item?id=5456940 response]] to [[https://news.ycombinator.com/item?id=5456640 HN comment]]
The point here is that these drugs haven't been tested for their safety, much less their efficacy. They are still at an early testing stage. The researchers seem to have a reasonable theory for why they believe they will be effective. But molecular biology is complicated and the risk for harmful effects in humans is not trivial.
Ben Goldacre's book Bad Pharma details the serious personal and social costs that come with poor drug trials. Everyone urging the abandonment of caution here seems to assume this new drug already works or, at the very least, the effects of its usage could not be worse than the grim prognosis patients already confront. But that's what proper trials are meant to establish. Snake oil can come in pill form, too. And even with the current regulations, we've ended up with a number of ineffective, expensive, and sometimes deadly drugs on the market.
**Python Chess Icons**
[[http://en.wikipedia.org/wiki/Chess_symbols_in_Unicode White icons]]
%%(python)
>>> icons = ['\xe2\x99\x94', '\xe2\x99\x95', '\xe2\x99\x96', '\xe2\x99\x97', '\xe2\x99\x98', '\xe2\x99\x99']
>>> icons
['\xe2\x99\x94', '\xe2\x99\x95', '\xe2\x99\x96', '\xe2\x99\x97', '\xe2\x99\x98', '\xe2\x99\x99']
>>> print ' '.join(icons)
%%
As html: ♔ ♕ ♖ ♗ ♘ ♙
**Call For Companies that Do Developer Training**
~- [[http://www.reddit.com/r/learnprogramming/comments/1am1qi/im_trying_to_find_recommendations_for_companies/ Reddit thread]]
~- [[https://news.ycombinator.com/item?id=5408577 Hacker News thread]]
**Tar with Absolute Paths**
see http://klenwell.com/press/2013/03/tar-with-absolute-paths/
**Discarded Comments**
response to [[http://news.ycombinator.com/item?id=5280149 HN comment]]
//One solution that's been proposed is the increased use of HSAs + high deductible policies. That way people are paying their expenses out of pocket (for the day-to-day things at least), and are therefore more likely to shop around.//
This is a solution that's being implemented: the corporation I work for started pushing these a couple years ago and I signed up because they are much cheaper than the HMO alternatives (whose premiums significantly jumped that year). Corp also offered a sort of signing bonus ($500 in your HSA). Plus I'm single, in good health, and plan to do everything I can to avoid using the medical system.
You can't really comparison shop serious procedures and if I actually thought I needed real medical care, I would have signed up for one of the more expensive HMOs.
These HSA plans seem better designed to make consumers more conscious of the costs as a way to discourage gratuitous procedures (a big problem that was focus of recent Time article) and promote more preventative care.
response to [[http://news.ycombinator.com/item?id=5279584 HN comment]]
I help manage my grandmother's finances. Her health care is covered under Kaiser through the large corporation with which he retired.
I would guess over the last 5 years the amount that has been billed for her medical care has outstripped the amount of money I've made. Easily. The truth is: I have no idea. I don't think she's ever seen a medical bill in that time, apart from an incidental co-pay perhaps. Kaiser handles everything and I'm guessing pulls the money directly from Medicare.
I'm glad to see attention finally being given to the issue of transparency. There seems to be a media swell building around this recent Time article. And in my own experience, I signed up for a cheaper, high deductible plan at work that my company strongly pushed -- I suspect, in large part, because it made costs more tangible.
Like calorie counts posted on menus, it won't solve the issue, but I expect it will help nibble at the edges.
**Online Mysql Designer**
http://ondras.zarovi.cz/sql/demo/
**Group Overlapping Circles**
http://stackoverflow.com/q/14607317/1093087
%%(python)
center_pts = [(-2,2), (-2,2), (0,0), (4,1), (6,2), (7,1)]
overlapping_circle_pts = [
(center_pts[0], center_pts[1]),
(center_pts[0], center_pts[2]),
(center_pts[1], center_pts[0]),
(center_pts[1], center_pts[2]),
(center_pts[2], center_pts[0]),
(center_pts[2], center_pts[1]),
(center_pts[2], center_pts[3]),
(center_pts[3], center_pts[2]),
(center_pts[4], center_pts[5]),
(center_pts[5], center_pts[4]),
]
expected_clusters = [
((-2,2), (-2,2), (0,0), (2,1)),
((6,2), (7,1))
]
def cluster_overlaps(nodes, adjacency_list):
connections = []

while len(nodes):
node = nodes[0]
path = dfs(node, adjacency_list, nodes)

# append path to connected_nodes
connections.append(path)

# remove all nodes from
for pt in path:
nodes.remove(pt)

return connections


def dfs(start, adjacency_list, nodes):
"""ref:
http://code.activestate.com/recipes/576723-dfs-and-bfs-graph-traversal/"""
path = []
q = [start]
while q:
node = q.pop(0)

# cycle detection
if path.count(node) >= nodes.count(node):
continue

path = path + [node]

# get next nodes
next_nodes = [p2 for p1,p2 in adjacency_list if p1 == node]
q = next_nodes + q

return path

print cluster_overlaps(center_pts, overlapping_circle_pts)
%%
**Centroid**
%%(python)
def centroid(pts):
fl = lambda n: float(n)
ir = lambda n: int(round(n))

xs = [fl(x) for x,y in pts]
ys = [fl(y) for x,y in pts]

x,y = (sum(xs) / len(pts), sum(ys) / len(pts))
return (ir(x), ir(y))
%%
**Discarded Comment**
In response to [[http://news.ycombinator.com/item?id=5126731 HN comment]] on [[http://chronicle.com/article/I-Will-Ruin-Him/136693/ article]]:
I'd be cautious extending this guy too much sympathy. He makes his stalker out to be something like Sean Hannity's incarnation of evil (a foul-mouthed female radical Iranian Islamo-extremist) where the truth, as others have pointed out, is probably less salacious: she's mentally ill. Moreover, I don't know about you, but most Persians I've met haunting the MFA programs of this country aren't Muslim jihadis but more like the Kardashians.
**Discarded Comment**
In response to this [[http://news.ycombinator.com/item?id=5104331 HN comment]]:
One of the interesting things I learned taking anthropology class as an undergraduate was the difference between sharing and gift-exchange. We studied some indigenous cultures in Papua New Guinea and where before I would have looked at their cultural practices and naively classified them as some form of communal sharing, I was taught to see them as involving elaborate forms of gift exchange. Gift exchange seemed to me much more complicated and personally taxing than more commercial forms of exchange using money.
If "disruptive online services" can filter out some of the social and emotional complexity involved in exchanging services, I think they've more than earned their fee. But I don't think the transition between loaning your couch to a friend and renting it out to him is as straight forward as suggested. I suspect the difference in the way money gets distributed among the various parties is among the least important factors that enters into such a bargain.
But then I see your point. Where before you might feel obligated to help out a friend down on his luck and needing a bit of assistance, Airbnb gives you a ready pretext for doing something more impersonal and efficient.
**A Statistical Survey of Small Business Openings and Closings Correlated by Storefront Address**
**The Legal and Logical Implications of the Word Only in English Colloquial Usage**


Revision [2699]

Edited on 2013-12-05 09:21:47 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- ##mkdir -pv deployment/roles/common/{tasks,handlers,templates,files,vars}##
~- ##mkdir -pv deployment/roles/{system,webserver,rails}/{tasks,handlers,templates,files,vars}##
Deletions:
~- ##mkdir -pv deployment roles/common/{tasks,handlers,templates,files,vars}##
~- ##mkdir -pv deployment roles/{system,webserver,rails}/{tasks,handlers,templates,files,vars}##


Revision [2698]

Edited on 2013-12-05 09:20:17 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- ##mkdir -pv deployment roles/common/{tasks,handlers,templates,files,vars}##
~- ##mkdir -pv deployment roles/{system,webserver,rails}/{tasks,handlers,templates,files,vars}##
Deletions:
~- ## mkdir -pv deployment roles/{system,webserver,rails}/{tasks,handlers,templates,files,vars}##


Revision [2697]

Edited on 2013-12-04 11:09:40 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- ## mkdir -pv deployment roles/{system,webserver,rails}/{tasks,handlers,templates,files,vars}##


Revision [2696]

Edited on 2013-12-03 14:16:17 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- MySQL: [[https://github.com/fourkitchens/server-playbooks github.com]] [[http://stackoverflow.com/q/16444306/1093087 stackoverflow.com]]
Deletions:
~- MySQL: [[https://github.com/fourkitchens/server-playbooks 1]] [[http://stackoverflow.com/q/16444306/1093087 2]]


Revision [2695]

Edited on 2013-12-03 14:15:39 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Ansible Setup**
~- MySQL: [[https://github.com/fourkitchens/server-playbooks 1]] [[http://stackoverflow.com/q/16444306/1093087 2]]
~- PHP
~- phpinfo script
~- db script


Revision [2694]

Edited on 2013-10-18 09:38:15 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**++Un++published Comment**
//While the poor struggle to survive from day to day, disappointed middle-class people are much more likely to engage in political activism to get their way.
This dynamic was evident in the Arab Spring, where regime-changing uprisings were led by tens of thousands of relatively well-educated young people. Both Tunisia and Egypt had produced large numbers of college graduates over the past generation. But the authoritarian governments of Zine El Abidine Ben Ali and Hosni Mubarak were classic crony-capitalist regimes, in which economic opportunities depended heavily on political connections. Neither country, in any event, had grown fast enough economically to provide jobs for ever-larger cohorts of young people. The result was political revolution.
None of this is a new phenomenon. The French, Bolshevik and Chinese Revolutions were all led by discontented middle-class individuals, even if their ultimate course was later affected by peasants, workers and the poor.//
I think both Occupy and Tea Party movements fit this model. College kids mired in debt who can't find decent jobs. Aging white middle class conservatives watching the financial class run away with the lion's share of economic growth (while being led to believe that's it's being siphoned off by immigrants, welfare queens, and gay married couples).
Deletions:
**Unpublished Comment**
[Find NPR quote]
I think both Occupy and Tea Party movements fit this model (though some may snort in derision). College kids mired in debt who can't find debt jobs. Aging white middle class conservatives watching the financial class run away with the lion's share of economic growth (and being led to believe that's it's because of immigrants and welfare queens).


Revision [2693]

Edited on 2013-10-18 09:17:39 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Unpublished Comment**
response to https://news.ycombinator.com/item?id=6571678
Here's an interesting point made about Arab Spring:
[Find NPR quote]
I think both Occupy and Tea Party movements fit this model (though some may snort in derision). College kids mired in debt who can't find debt jobs. Aging white middle class conservatives watching the financial class run away with the lion's share of economic growth (and being led to believe that's it's because of immigrants and welfare queens).
Also brings to mind the old "Revolution to Conserve" idea I was introduced to back in AP American History:
http://en.wikipedia.org/wiki/Clinton_Rossiter


Revision [2691]

Edited on 2013-10-03 14:53:11 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- Scaling Demos
~~- http://stackoverflow.com/a/13663169/1093087
~~- http://stackoverflow.com/a/13895418/1093087


Revision [2690]

Edited on 2013-10-03 09:41:46 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- Phonegap: http://w2davids.wordpress.com/html5-mobile-web-canvas-animation-using-phonegap-kinetic-js/


Revision [2689]

Edited on 2013-10-03 09:36:31 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- For dragbounds, see https://github.com/ericdrowell/KineticJS/issues/216
~- Demo: http://www.html5canvastutorials.com/kineticjs/html5-canvas-kineticjs-scale-animation-tutorial/
Deletions:
* For dragbounds, see https://github.com/ericdrowell/KineticJS/issues/216


Revision [2688]

Edited on 2013-10-03 09:32:32 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Kinetic Scaling**
* For dragbounds, see https://github.com/ericdrowell/KineticJS/issues/216


Revision [2687]

Edited on 2013-09-27 16:08:34 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Sim</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="basic.css">
</head>

<body>
<div id="app-stage"></div>
<button id="stop-button">stop</button>

<!-- Javascript Here -->
<script src="kinetic-v4.7.1.js"></script>
<script src="fiddle.js"></script>
</body>
</html>
CSS: basic.css
div#app-stage .kineticjs-content {
margin:0 auto;
background-color:#EEEEEE;
border:1px solid #DDDDDD;
}


Revision [2686]

Edited on 2013-09-25 14:27:54 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
http://jsfiddle.net/klenwell/JvG2Z/
Deletions:
http://jsfiddle.net/klenwell/JvG2Z/n/ (where n is latest version)


Revision [2685]

Edited on 2013-09-25 11:56:09 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Parasitic Simulation with KineticJS**
http://jsfiddle.net/klenwell/JvG2Z/n/ (where n is latest version)


Revision [2684]

Edited on 2013-09-23 22:35:06 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
http://jsfiddle.net/klenwell/MsTay/


Revision [2678]

Edited on 2013-09-23 13:21:34 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
** HocObject Neo-Parasitic Inheritance**
http://jsfiddle.net/klenwell/RV4a3/


Revision [2677]

Edited on 2013-09-20 10:07:58 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- Stack Overflow: http://stackoverflow.com/q/18922197/1093087


Revision [2676]

Edited on 2013-09-19 18:44:58 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
I'm trying to develop a simple parasitic interface for my javascript classes modelled after Crockford and I'd like to implement some basic introspective methods. Given the class hierarchy below, how can I write class_name and is_a methods that correctly identify the object class? ... This question provides some additional information about my approach.
Deletions:
Given the following class hierarchy, how can I write class_name and is_a methods that correctly identify the object class?


Revision [2675]

Edited on 2013-09-19 09:58:33 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- Question: http://jsfiddle.net/xhcC2/
Deletions:
~- Question:


Revision [2674]

Edited on 2013-09-19 09:53:53 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- Solution: http://jsfiddle.net/F98Jz/1/
Deletions:
~- Solution:


Revision [2673]

Edited on 2013-09-19 09:44:15 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Javascript Parasitic Instance Inference**
Given the following class hierarchy, how can I write class_name and is_a methods that correctly identify the object class?
~- Question:
~- Solution:


Revision [2672]

Edited on 2013-09-17 08:24:31 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]

No Differences

Revision [2671]

Edited on 2013-09-17 08:23:03 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
http://jsfiddle.net/AvdK2/4/
Deletions:
http://jsfiddle.net/AvdK2/3/


Revision [2670]

Edited on 2013-09-17 07:57:36 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
http://jsfiddle.net/AvdK2/3/
Deletions:
http://jsfiddle.net/AvdK2/1/


Revision [2669]

Edited on 2013-09-16 10:46:01 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
http://jsfiddle.net/AvdK2/1/


Revision [2668]

Edited on 2013-09-13 11:27:32 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
http://jsfiddle.net/SSDgv/23/
Deletions:
http://jsfiddle.net/klenwell/8fcsX/3/
http://jsfiddle.net/SSDgv/19/


Revision [2667]

Edited on 2013-09-12 19:41:47 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
http://stackoverflow.com/questions/18776989/


Revision [2666]

Edited on 2013-09-12 19:40:49 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
http://jsfiddle.net/klenwell/8fcsX/3/


Revision [2665]

Edited on 2013-09-12 16:16:57 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- http://www.crockford.com/javascript/inheritance.html
~- https://github.com/ericdrowell/KineticJS/blob/master/src/Global.js


Revision [2664]

Edited on 2013-09-12 16:15:51 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- http://stackoverflow.com/questions/8165181/
~- http://stackoverflow.com/questions/5842654/
~- http://stackoverflow.com/questions/812961/
~- http://javascriptweblog.wordpress.com/2010/11/15/extending-objects-with-javascript-getters/
~- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty


Revision [2663]

Edited on 2013-09-12 16:06:00 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
http://jsfiddle.net/SSDgv/19/
Deletions:
http://jsfiddle.net/SSDgv/3/


Revision [2662]

Edited on 2013-09-12 07:28:56 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Javascript Inheritance**
http://jsfiddle.net/SSDgv/3/


Revision [2661]

Edited on 2013-09-09 15:22:02 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
dated = datum['date'].split('T')[0]
record = (dated, '%.1f' % (value), f)
Deletions:
ymd = (y,m,i+1)
record = (ymd, f)


Revision [2660]

Edited on 2013-09-09 13:38:58 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
"""
Get high temperatures from a given weather station
"""
from datetime import datetime
import time
import requests
from pprint import pprint
noaa_url = 'http://www.ncdc.noaa.gov/cdo-services/services'
noaa_service_f = 'datasets/GHCND/stations/%s/datatypes/TMAX/data'
token = 'YOUR TOKEN HERE'
station_id = 'GHCND:USC00047888'
api_rate_limit = 1.25 # seconds
def c10_to_f(value):
c = value / 10.0
f = c * (9.0 / 5) + 32
return '%.1f' % (f)
def get_tmax_data(station_id, start, stop=None):
records = []
start_year, start_month = start
if stop:
stop_year, stop_month = stop
else:
now = datetime.now()
stop_year, stop_month = now.year, now.month
months = range(1,13)
years = range(start_year, stop_year+1)
qstring_f = '_type=json&year=%d&month=%02d&token=%s'
noaa_service = noaa_service_f % (station_id)
base_url = '%s/%s' % (noaa_url, noaa_service)
ymd_f = '%Y-%m-%d'
min_date = datetime.strptime('%d-%02d-01' % (start_year, start_month), ymd_f)
max_date = datetime.strptime('%d-%02d-01' % (stop_year, stop_month+1), ymd_f)
for y in years:
for m in months:
# skip if date is too early
my_date = datetime.strptime('%d-%02d-15' % (y,m), '%Y-%m-%d')
if my_date < min_date:
continue
# stop if date is too late
if my_date > max_date:
break
qstring = qstring_f % (y, m, token)
request_url = '%s?%s' % (base_url, qstring)
print y, m, request_url
r = requests.get(request_url)
data = r.json()['dataCollection']['data']
for i,datum in enumerate(data):
ymd = (y,m,i+1)
value = datum['value']
f = c10_to_f(value)
record = (ymd, f)
records.append(record)
time.sleep(api_rate_limit)
return records
#
# Tests
#
pprint(get_tmax_data(station_id, (2013,8)))


Revision [2659]

Edited on 2013-09-09 11:06:41 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- Historical Daily High Temp for Month (Tenths of C): http://www.ncdc.noaa.gov/cdo-services/services/datasets/GHCND/stations/GHCND:USC00047888/datatypes/TMAX/data?_type=json&year=1972&month=05&token=Uvz...
Deletions:
~- Historial Daily High Temp (Tenths of C): http://www.ncdc.noaa.gov/cdo-services/services/datasets/GHCND/stations/GHCND:USC00047888/datatypes/TMAX/data?_type=json&year=1972&month=05&token=Uvz...


Revision [2658]

Edited on 2013-09-09 11:06:26 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- Historial Daily High Temp (Tenths of C): http://www.ncdc.noaa.gov/cdo-services/services/datasets/GHCND/stations/GHCND:USC00047888/datatypes/TMAX/data?_type=json&year=1972&month=05&token=Uvz...


Revision [2657]

Edited on 2013-09-09 11:02:56 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- Requires token for NOAA (they're free): http://www.ncdc.noaa.gov/cdo-web/token
~- Daily Historical Data by Station: http://www.ncdc.noaa.gov/cdo-services/services/datasets/GHCND/stations/GHCND:USC00047888/data?_type=json&year=1972&month=05&startday=22&endday=22&token=Uvz...
Deletions:
~- Requires token for NOAA (they're free)
~- Daily Historical Data by Station: http://www.ncdc.noaa.gov/cdo-services/services/datasets/GHCND/stations/GHCND:USC00047888/data?_type=json&year=1972&month=05&startday=22&endday=22&token=Uv...


Revision [2656]

Edited on 2013-09-09 11:01:59 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Weather Data**
~- Requires token for NOAA (they're free)
~- Data Services: http://www.ncdc.noaa.gov/cdo-services/services/datasets?token=Uvz...
~- Location Search: http://www.ncdc.noaa.gov/cdo-services/services/datasets/GHCND/locationsearch?_type=json&latitude=33.7408&longitude=-117.8814&radius=10&token=Uvz...
~- Data Types for Zip: http://www.ncdc.noaa.gov/cdo-services/services/datasets/GHCND/locations/ZIP:92701/datatypes?_type=json&token=Uvz...
~- Daily Historical Data by Zip: http://www.ncdc.noaa.gov/cdo-services/services/datasets/GHCND/locations/ZIP:92705/data?_type=json&year=1972&month=05&startday=22&endday=22&token=Uvz...
~- Daily Historical Data by Station: http://www.ncdc.noaa.gov/cdo-services/services/datasets/GHCND/stations/GHCND:USC00047888/data?_type=json&year=1972&month=05&startday=22&endday=22&token=Uv...


Revision [2655]

Edited on 2013-09-06 15:17:46 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- http://jsfiddle.net/SMrLk/1/
Deletions:
~- http://jsfiddle.net/SMrLk/


Revision [2654]

Edited on 2013-09-06 14:36:24 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Colors**
~- http://jsfiddle.net/SMrLk/


Revision [2653]

Edited on 2013-09-04 12:02:30 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Wine Recommendation**
~- http://www.chateaustjean.com/ (Sue, 2012.11.09)
~- A ##tasks.php## script to run tasks in backend.
~- A ##tasks## directory in which to place them
~- A Tasks interface, like Actions, by which to define them
Deletions:
* A ##tasks.php## script to run tasks in backend.
* A ##tasks## directory in which to place them
* A Tasks interface, like Actions, by which to define them


Revision [2652]

Edited on 2013-08-30 11:47:17 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**jTable Factory**
http://jsfiddle.net/rHmh6/1/


Revision [2651]

Edited on 2013-08-30 09:44:37 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Wikka Tasks Interface**
* A ##tasks.php## script to run tasks in backend.
* A ##tasks## directory in which to place them
* A Tasks interface, like Actions, by which to define them


Revision [2650]

Edited on 2013-08-29 11:56:19 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
http://jsfiddle.net/ZCR2H/17/


Revision [2649]

Edited on 2013-08-29 11:31:28 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**CSS Balls**


Revision [2647]

Edited on 2013-08-06 20:09:04 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
http://stackoverflow.com/a/9865124/1093087


Revision [2646]

Edited on 2013-08-06 09:30:38 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**jQuery $.when**
http://jsfiddle.net/3b2t9/4/
http://stackoverflow.com/a/755913/1093087


Revision [2645]

Edited on 2013-07-24 08:16:41 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Javascript: String Objects vs String Literals**
http://stackoverflow.com/questions/3297867/
http://jsfiddle.net/E8DAW/1/


Revision [2637]

Edited on 2013-07-06 11:05:04 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- [[http://csimms.botonomy.com/2011/05/html5-storage-wars-localstorage-vs-indexeddb-vs-web-sql.html localStorage v. IndexedDB v. Web SQL]] (csimms.botonomy.com)
Deletions:
~- [[http://csimms.botonomy.com/2011/05/html5-storage-wars-localstorage-vs-indexeddb-vs-web-sql.html HTML5 Storage Wars - localStorage vs. IndexedDB vs. Web SQL]](csimms.botonomy.com)


Revision [2636]

Edited on 2013-07-06 11:04:35 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Browser Storage Options**
~- [[http://csimms.botonomy.com/2011/05/html5-storage-wars-localstorage-vs-indexeddb-vs-web-sql.html HTML5 Storage Wars - localStorage vs. IndexedDB vs. Web SQL]](csimms.botonomy.com)
~- http://diveintohtml5.info/storage.html
~- http://stackoverflow.com/questions/5924485/


Revision [2631]

Edited on 2013-06-17 17:54:28 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Jenkins Variables**
$WORKSPACE
$VIRTUAL_ENV
[[https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables Others]]


Revision [2619]

Edited on 2013-05-31 08:55:39 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Android Browser Translation App**
I'm looking for one: http://android.stackexchange.com/q/46414/35024


Revision [2618]

Edited on 2013-05-27 19:39:43 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
//There seems to be an implicit holier-than-thou assumption among sharing economy evangelists that social sharing is primarily about virtuous behaviors like generosity, empathy, minding the planet, conserving resources, avoiding waste and so forth. Only secondarily do they see it as a zero-sum/negative-sum adaptation to recessionary conditions -- Bruce Sterling's favela chic.//
~- Wage Service Scheduling Siphon: [[http://www.nytimes.com/2012/10/28/business/a-part-time-life-as-hours-shrink-and-shift-for-american-workers.html?pagewanted=all&_r=0 A Part-Time Life, as Hours Shrink and Shift (nytimes.com)]]
~- High Frequency Trading Algorithms
~- Ticket Bots: [[http://www.nytimes.com/2013/05/27/business/media/bots-that-siphon-off-tickets-frustrate-concert-promoters.html Concert Industry Struggles With 'Bots' That Siphon Off Tickets (nytimes.com)]]
**Personal Breathalyzers**
Was joking we need an app for this with talk of lowering legal BAC limit. Then it occurred to me to google it. Found:
~- [[http://www.pcmag.com/article2/0,2817,2417229,00.asp Coming Smartphone Dongle (pcmag.com)]]
~- [[http://www.wired.com/reviews/2010/04/pr_roundup_breathalyzers/ Wired Article from 2010 (wired.com)]]
**Red/Blue/Mainstream Marketing**
Listening to KUSC classical public radio fundraiser where they mentioned some dead commercial classical radio stations. Why have commercial classical radio stations died? Because, I'm guessing, blue (affluent, college-educated, progressive/liberalish) listeners won't listen to commercials. //Unless// they come in the form of discreet underwriting.
Surely upscale advertisers want to reach this blue audience as much as they ever have. It's just that blue audience will be receptive to them only under certain conditions, which exclude the sort crude advertisements listeners of mainstream and talk radio are prepared to endure.
How does underwriting revenue compare to old traditional commercial advertising revenue? Significantly less? More? Factor in difference between profit and not-for-profit station setups. Is it roughly comparable? My guess is that it is as lucrative, in terms of providing income for actual employees, as it ever was. But probably a slimmed-down operation (e.g., much smaller advertising dept that now goes under a different name) and no investors involved (so they will look elsewhere for their passive income.)
**An Introduction to the Raphael JS Library**
[[http://net.tutsplus.com/tutorials/javascript-ajax/an-introduction-to-the-raphael-js-library/ http://net.tutsplus.com/]]
http://jsfiddle.net/htH9j/6/
http://jsfiddle.net/rKMq5/1/
http://jsfiddle.net/6nxdV/1/
**Google App Engine 1.7.6**
~- "a new requirement for the new dev_appserver is [[http://pythonhosted.org/pyobjc/install.html PyObjC]]" ([[http://www.reddit.com/r/AppEngine/comments/1am9f8/app_engine_176_released/c8z06k8 reddit.com]])
~- http://code.google.com/p/appengine-devappserver2-experiment/issues/list
**(Un)Discarded Comments**
[[https://news.ycombinator.com/item?id=5456940 response]] to [[https://news.ycombinator.com/item?id=5456640 HN comment]]
----
The point here is that these drugs haven't been tested for their safety, much less their efficacy. They are still at an early testing stage. The researchers seem to have a reasonable theory for why they believe they will be effective. But molecular biology is complicated and the risk for harmful effects in humans is not trivial.
Ben Goldacre's book Bad Pharma details the serious personal and social costs that come with poor drug trials. Everyone urging the abandonment of caution here seems to assume this new drug already works or, at the very least, the effects of its usage could not be worse than the grim prognosis patients already confront. But that's what proper trials are meant to establish. Snake oil can come in pill form, too. And even with the current regulations, we've ended up with a number of ineffective, expensive, and sometimes deadly drugs on the market.
----
**Python Chess Icons**
[[http://en.wikipedia.org/wiki/Chess_symbols_in_Unicode White icons]]
%%(python)
>>> icons = ['\xe2\x99\x94', '\xe2\x99\x95', '\xe2\x99\x96', '\xe2\x99\x97', '\xe2\x99\x98', '\xe2\x99\x99']
>>> icons
['\xe2\x99\x94', '\xe2\x99\x95', '\xe2\x99\x96', '\xe2\x99\x97', '\xe2\x99\x98', '\xe2\x99\x99']
>>> print ' '.join(icons)
%%
As html: ♔ ♕ ♖ ♗ ♘ ♙
**Call For Companies that Do Developer Training**
~- [[http://www.reddit.com/r/learnprogramming/comments/1am1qi/im_trying_to_find_recommendations_for_companies/ Reddit thread]]
~- [[https://news.ycombinator.com/item?id=5408577 Hacker News thread]]
**Tar with Absolute Paths**
see http://klenwell.com/press/2013/03/tar-with-absolute-paths/
**Discarded Comments**
response to [[http://news.ycombinator.com/item?id=5280149 HN comment]]
----
//One solution that's been proposed is the increased use of HSAs + high deductible policies. That way people are paying their expenses out of pocket (for the day-to-day things at least), and are therefore more likely to shop around.//
This is a solution that's being implemented: the corporation I work for started pushing these a couple years ago and I signed up because they are much cheaper than the HMO alternatives (whose premiums significantly jumped that year). Corp also offered a sort of signing bonus ($500 in your HSA). Plus I'm single, in good health, and plan to do everything I can to avoid using the medical system.
You can't really comparison shop serious procedures and if I actually thought I needed real medical care, I would have signed up for one of the more expensive HMOs.
These HSA plans seem better designed to make consumers more conscious of the costs as a way to discourage gratuitous procedures (a big problem that was focus of recent Time article) and promote more preventative care.
----
response to [[http://news.ycombinator.com/item?id=5279584 HN comment]]
----
I help manage my grandmother's finances. Her health care is covered under Kaiser through the large corporation with which he retired.
I would guess over the last 5 years the amount that has been billed for her medical care has outstripped the amount of money I've made. Easily. The truth is: I have no idea. I don't think she's ever seen a medical bill in that time, apart from an incidental co-pay perhaps. Kaiser handles everything and I'm guessing pulls the money directly from Medicare.
I'm glad to see attention finally being given to the issue of transparency. There seems to be a media swell building around this recent Time article. And in my own experience, I signed up for a cheaper, high deductible plan at work that my company strongly pushed -- I suspect, in large part, because it made costs more tangible.
Like calorie counts posted on menus, it won't solve the issue, but I expect it will help nibble at the edges.
----
**Online Mysql Designer**
http://ondras.zarovi.cz/sql/demo/
**Group Overlapping Circles**
http://stackoverflow.com/q/14607317/1093087
%%(python)
center_pts = [(-2,2), (-2,2), (0,0), (4,1), (6,2), (7,1)]
overlapping_circle_pts = [
(center_pts[0], center_pts[1]),
(center_pts[0], center_pts[2]),
(center_pts[1], center_pts[0]),
(center_pts[1], center_pts[2]),
(center_pts[2], center_pts[0]),
(center_pts[2], center_pts[1]),
(center_pts[2], center_pts[3]),
(center_pts[3], center_pts[2]),
(center_pts[4], center_pts[5]),
(center_pts[5], center_pts[4]),
]
expected_clusters = [
((-2,2), (-2,2), (0,0), (2,1)),
((6,2), (7,1))
]
def cluster_overlaps(nodes, adjacency_list):
connections = []

while len(nodes):
node = nodes[0]
path = dfs(node, adjacency_list, nodes)

# append path to connected_nodes
connections.append(path)

# remove all nodes from
for pt in path:
nodes.remove(pt)

return connections


def dfs(start, adjacency_list, nodes):
"""ref:
http://code.activestate.com/recipes/576723-dfs-and-bfs-graph-traversal/"""
path = []
q = [start]
while q:
node = q.pop(0)

# cycle detection
if path.count(node) >= nodes.count(node):
continue

path = path + [node]

# get next nodes
next_nodes = [p2 for p1,p2 in adjacency_list if p1 == node]
q = next_nodes + q

return path

print cluster_overlaps(center_pts, overlapping_circle_pts)
%%
**Centroid**
%%(python)
def centroid(pts):
fl = lambda n: float(n)
ir = lambda n: int(round(n))

xs = [fl(x) for x,y in pts]
ys = [fl(y) for x,y in pts]

x,y = (sum(xs) / len(pts), sum(ys) / len(pts))
return (ir(x), ir(y))
%%
**Discarded Comment**
In response to [[http://news.ycombinator.com/item?id=5126731 HN comment]] on [[http://chronicle.com/article/I-Will-Ruin-Him/136693/ article]]:
----
I'd be cautious extending this guy too much sympathy. He makes his stalker out to be something like Sean Hannity's incarnation of evil (a foul-mouthed female radical Iranian Islamo-extremist) where the truth, as others have pointed out, is probably less salacious: she's mentally ill. Moreover, I don't know about you, but most Persians I've met haunting the MFA programs of this country aren't Muslim jihadis but more like the Kardashians.
----
**Discarded Comment**
In response to this [[http://news.ycombinator.com/item?id=5104331 HN comment]]:
----
One of the interesting things I learned taking anthropology class as an undergraduate was the difference between sharing and gift-exchange. We studied some indigenous cultures in Papua New Guinea and where before I would have looked at their cultural practices and naively classified them as some form of communal sharing, I was taught to see them as involving elaborate forms of gift exchange. Gift exchange seemed to me much more complicated and personally taxing than more commercial forms of exchange using money.
If "disruptive online services" can filter out some of the social and emotional complexity involved in exchanging services, I think they've more than earned their fee. But I don't think the transition between loaning your couch to a friend and renting it out to him is as straight forward as suggested. I suspect the difference in the way money gets distributed among the various parties is among the least important factors that enters into such a bargain.
But then I see your point. Where before you might feel obligated to help out a friend down on his luck and needing a bit of assistance, Airbnb gives you a ready pretext for doing something more impersonal and efficient.
----
**A Statistical Survey of Small Business Openings and Closings Correlated by Storefront Address**
----
**The Legal and Logical Implications of the Word Only in English Colloquial Usage**
----
----
[[CategorySpecial]]
Deletions:
//There seems to be an implicit holier-than-thou assumption among sharing economy evangelists that social sharing is primarily about virtuous behaviors like generosity, empathy, minding the planet, conserving resources, avoiding waste and so forth. Only secondarily do they see it as a zero-sum/negative-sum adaptation to recessionary conditions


Revision [2617]

Edited on 2013-05-27 19:37:34 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
//There seems to be an implicit holier-than-thou assumption among sharing economy evangelists that social sharing is primarily about virtuous behaviors like generosity, empathy, minding the planet, conserving resources, avoiding waste and so forth. Only secondarily do they see it as a zero-sum/negative-sum adaptation to recessionary conditions
Deletions:
//The typical member of this [Jeffersonian middle] class does not want to either build a billion dollar company or live off a passive-income lifestyle business based on exploitative arbitrage. He or she wants to work hard at a meaningful activity and asks only to be left alone to be content with modest rewards and economic autonomy.//
~- Wage Service Scheduling Siphon: [[http://www.nytimes.com/2012/10/28/business/a-part-time-life-as-hours-shrink-and-shift-for-american-workers.html?pagewanted=all&_r=0 A Part-Time Life, as Hours Shrink and Shift (nytimes.com)]]
~- High Frequency Trading Algorithms
~- Ticket Bots: [[http://www.nytimes.com/2013/05/27/business/media/bots-that-siphon-off-tickets-frustrate-concert-promoters.html Concert Industry Struggles With 'Bots' That Siphon Off Tickets (nytimes.com)]]
**Personal Breathalyzers**
Was joking we need an app for this with talk of lowering legal BAC limit. Then it occurred to me to google it. Found:
~- [[http://www.pcmag.com/article2/0,2817,2417229,00.asp Coming Smartphone Dongle (pcmag.com)]]
~- [[http://www.wired.com/reviews/2010/04/pr_roundup_breathalyzers/ Wired Article from 2010 (wired.com)]]
**Red/Blue/Mainstream Marketing**
Listening to KUSC classical public radio fundraiser where they mentioned some dead commercial classical radio stations. Why have commercial classical radio stations died? Because, I'm guessing, blue (affluent, college-educated, progressive/liberalish) listeners won't listen to commercials. //Unless// they come in the form of discreet underwriting.
Surely upscale advertisers want to reach this blue audience as much as they ever have. It's just that blue audience will be receptive to them only under certain conditions, which exclude the sort crude advertisements listeners of mainstream and talk radio are prepared to endure.
How does underwriting revenue compare to old traditional commercial advertising revenue? Significantly less? More? Factor in difference between profit and not-for-profit station setups. Is it roughly comparable? My guess is that it is as lucrative, in terms of providing income for actual employees, as it ever was. But probably a slimmed-down operation (e.g., much smaller advertising dept that now goes under a different name) and no investors involved (so they will look elsewhere for their passive income.)
**An Introduction to the Raphael JS Library**
[[http://net.tutsplus.com/tutorials/javascript-ajax/an-introduction-to-the-raphael-js-library/ http://net.tutsplus.com/]]
http://jsfiddle.net/htH9j/6/
http://jsfiddle.net/rKMq5/1/
http://jsfiddle.net/6nxdV/1/
**Google App Engine 1.7.6**
~- "a new requirement for the new dev_appserver is [[http://pythonhosted.org/pyobjc/install.html PyObjC]]" ([[http://www.reddit.com/r/AppEngine/comments/1am9f8/app_engine_176_released/c8z06k8 reddit.com]])
~- http://code.google.com/p/appengine-devappserver2-experiment/issues/list
**(Un)Discarded Comments**
[[https://news.ycombinator.com/item?id=5456940 response]] to [[https://news.ycombinator.com/item?id=5456640 HN comment]]
----
The point here is that these drugs haven't been tested for their safety, much less their efficacy. They are still at an early testing stage. The researchers seem to have a reasonable theory for why they believe they will be effective. But molecular biology is complicated and the risk for harmful effects in humans is not trivial.
Ben Goldacre's book Bad Pharma details the serious personal and social costs that come with poor drug trials. Everyone urging the abandonment of caution here seems to assume this new drug already works or, at the very least, the effects of its usage could not be worse than the grim prognosis patients already confront. But that's what proper trials are meant to establish. Snake oil can come in pill form, too. And even with the current regulations, we've ended up with a number of ineffective, expensive, and sometimes deadly drugs on the market.
----
**Python Chess Icons**
[[http://en.wikipedia.org/wiki/Chess_symbols_in_Unicode White icons]]
%%(python)
>>> icons = ['\xe2\x99\x94', '\xe2\x99\x95', '\xe2\x99\x96', '\xe2\x99\x97', '\xe2\x99\x98', '\xe2\x99\x99']
>>> icons
['\xe2\x99\x94', '\xe2\x99\x95', '\xe2\x99\x96', '\xe2\x99\x97', '\xe2\x99\x98', '\xe2\x99\x99']
>>> print ' '.join(icons)
%%
As html: ♔ ♕ ♖ ♗ ♘ ♙
**Call For Companies that Do Developer Training**
~- [[http://www.reddit.com/r/learnprogramming/comments/1am1qi/im_trying_to_find_recommendations_for_companies/ Reddit thread]]
~- [[https://news.ycombinator.com/item?id=5408577 Hacker News thread]]
**Tar with Absolute Paths**
see http://klenwell.com/press/2013/03/tar-with-absolute-paths/
**Discarded Comments**
response to [[http://news.ycombinator.com/item?id=5280149 HN comment]]
----
//One solution that's been proposed is the increased use of HSAs + high deductible policies. That way people are paying their expenses out of pocket (for the day-to-day things at least), and are therefore more likely to shop around.//
This is a solution that's being implemented: the corporation I work for started pushing these a couple years ago and I signed up because they are much cheaper than the HMO alternatives (whose premiums significantly jumped that year). Corp also offered a sort of signing bonus ($500 in your HSA). Plus I'm single, in good health, and plan to do everything I can to avoid using the medical system.
You can't really comparison shop serious procedures and if I actually thought I needed real medical care, I would have signed up for one of the more expensive HMOs.
These HSA plans seem better designed to make consumers more conscious of the costs as a way to discourage gratuitous procedures (a big problem that was focus of recent Time article) and promote more preventative care.
----
response to [[http://news.ycombinator.com/item?id=5279584 HN comment]]
----
I help manage my grandmother's finances. Her health care is covered under Kaiser through the large corporation with which he retired.
I would guess over the last 5 years the amount that has been billed for her medical care has outstripped the amount of money I've made. Easily. The truth is: I have no idea. I don't think she's ever seen a medical bill in that time, apart from an incidental co-pay perhaps. Kaiser handles everything and I'm guessing pulls the money directly from Medicare.
I'm glad to see attention finally being given to the issue of transparency. There seems to be a media swell building around this recent Time article. And in my own experience, I signed up for a cheaper, high deductible plan at work that my company strongly pushed -- I suspect, in large part, because it made costs more tangible.
Like calorie counts posted on menus, it won't solve the issue, but I expect it will help nibble at the edges.
----
**Online Mysql Designer**
http://ondras.zarovi.cz/sql/demo/
**Group Overlapping Circles**
http://stackoverflow.com/q/14607317/1093087
%%(python)
center_pts = [(-2,2), (-2,2), (0,0), (4,1), (6,2), (7,1)]
overlapping_circle_pts = [
(center_pts[0], center_pts[1]),
(center_pts[0], center_pts[2]),
(center_pts[1], center_pts[0]),
(center_pts[1], center_pts[2]),
(center_pts[2], center_pts[0]),
(center_pts[2], center_pts[1]),
(center_pts[2], center_pts[3]),
(center_pts[3], center_pts[2]),
(center_pts[4], center_pts[5]),
(center_pts[5], center_pts[4]),
]
expected_clusters = [
((-2,2), (-2,2), (0,0), (2,1)),
((6,2), (7,1))
]
def cluster_overlaps(nodes, adjacency_list):
connections = []

while len(nodes):
node = nodes[0]
path = dfs(node, adjacency_list, nodes)

# append path to connected_nodes
connections.append(path)

# remove all nodes from
for pt in path:
nodes.remove(pt)

return connections


def dfs(start, adjacency_list, nodes):
"""ref:
http://code.activestate.com/recipes/576723-dfs-and-bfs-graph-traversal/"""
path = []
q = [start]
while q:
node = q.pop(0)

# cycle detection
if path.count(node) >= nodes.count(node):
continue

path = path + [node]

# get next nodes
next_nodes = [p2 for p1,p2 in adjacency_list if p1 == node]
q = next_nodes + q

return path

print cluster_overlaps(center_pts, overlapping_circle_pts)
%%
**Centroid**
%%(python)
def centroid(pts):
fl = lambda n: float(n)
ir = lambda n: int(round(n))

xs = [fl(x) for x,y in pts]
ys = [fl(y) for x,y in pts]

x,y = (sum(xs) / len(pts), sum(ys) / len(pts))
return (ir(x), ir(y))
%%
**Discarded Comment**
In response to [[http://news.ycombinator.com/item?id=5126731 HN comment]] on [[http://chronicle.com/article/I-Will-Ruin-Him/136693/ article]]:
----
I'd be cautious extending this guy too much sympathy. He makes his stalker out to be something like Sean Hannity's incarnation of evil (a foul-mouthed female radical Iranian Islamo-extremist) where the truth, as others have pointed out, is probably less salacious: she's mentally ill. Moreover, I don't know about you, but most Persians I've met haunting the MFA programs of this country aren't Muslim jihadis but more like the Kardashians.
----
**Discarded Comment**
In response to this [[http://news.ycombinator.com/item?id=5104331 HN comment]]:
----
One of the interesting things I learned taking anthropology class as an undergraduate was the difference between sharing and gift-exchange. We studied some indigenous cultures in Papua New Guinea and where before I would have looked at their cultural practices and naively classified them as some form of communal sharing, I was taught to see them as involving elaborate forms of gift exchange. Gift exchange seemed to me much more complicated and personally taxing than more commercial forms of exchange using money.
If "disruptive online services" can filter out some of the social and emotional complexity involved in exchanging services, I think they've more than earned their fee. But I don't think the transition between loaning your couch to a friend and renting it out to him is as straight forward as suggested. I suspect the difference in the way money gets distributed among the various parties is among the least important factors that enters into such a bargain.
But then I see your point. Where before you might feel obligated to help out a friend down on his luck and needing a bit of assistance, Airbnb gives you a ready pretext for doing something more impersonal and efficient.
----
**A Statistical Survey of Small Business Openings and Closings Correlated by Storefront Address**
----
**The Legal and Logical Implications of the Word Only in English Colloquial Usage**
----
----
[[CategorySpecial]]


Revision [2616]

Edited on 2013-05-27 19:34:04 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]

No Differences

Revision [2615]

Edited on 2013-05-27 19:33:54 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- Ticket Bots: [[http://www.nytimes.com/2013/05/27/business/media/bots-that-siphon-off-tickets-frustrate-concert-promoters.html Concert Industry Struggles With 'Bots' That Siphon Off Tickets (nytimes.com)]]
Deletions:
~- Ticket Bots: [[http://www.nytimes.com/2013/05/27/business/media/bots-that-siphon-off-tickets-frustrate-concert-promoters.html http://www.nytimes.com/2013/05/27/business/media/bots-that-siphon-off-tickets-frustrate-concert-promoters.html (nytimes.com)]]


Revision [2614]

Edited on 2013-05-27 19:33:00 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- Wage Service Scheduling Siphon: [[http://www.nytimes.com/2012/10/28/business/a-part-time-life-as-hours-shrink-and-shift-for-american-workers.html?pagewanted=all&_r=0 A Part-Time Life, as Hours Shrink and Shift (nytimes.com)]]
~- Ticket Bots: [[http://www.nytimes.com/2013/05/27/business/media/bots-that-siphon-off-tickets-frustrate-concert-promoters.html http://www.nytimes.com/2013/05/27/business/media/bots-that-siphon-off-tickets-frustrate-concert-promoters.html (nytimes.com)]]
Deletions:
~- Wage Service Scheduling Siphon: [[http://www.nytimes.com/2012/10/28/business/a-part-time-life-as-hours-shrink-and-shift-for-american-workers.html?pagewanted=all&_r=0 A Part-Time Life, as Hours Shrink and Shift]] (nytimes.com)
~- Ticket Bots: [[http://www.nytimes.com/2013/05/27/business/media/bots-that-siphon-off-tickets-frustrate-concert-promoters.html nytimes.com]]


Revision [2613]

Edited on 2013-05-27 19:32:30 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**The Locust Economy**
~- http://www.ribbonfarm.com/2013/04/03/the-locust-economy/
//The typical member of this [Jeffersonian middle] class does not want to either build a billion dollar company or live off a passive-income lifestyle business based on exploitative arbitrage. He or she wants to work hard at a meaningful activity and asks only to be left alone to be content with modest rewards and economic autonomy.//
~- Wage Service Scheduling Siphon: [[http://www.nytimes.com/2012/10/28/business/a-part-time-life-as-hours-shrink-and-shift-for-american-workers.html?pagewanted=all&_r=0 A Part-Time Life, as Hours Shrink and Shift]] (nytimes.com)
~- High Frequency Trading Algorithms
~- Ticket Bots: [[http://www.nytimes.com/2013/05/27/business/media/bots-that-siphon-off-tickets-frustrate-concert-promoters.html nytimes.com]]


Revision [2612]

Edited on 2013-05-17 18:26:15 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Personal Breathalyzers**
Was joking we need an app for this with talk of lowering legal BAC limit. Then it occurred to me to google it. Found:
~- [[http://www.pcmag.com/article2/0,2817,2417229,00.asp Coming Smartphone Dongle (pcmag.com)]]
~- [[http://www.wired.com/reviews/2010/04/pr_roundup_breathalyzers/ Wired Article from 2010 (wired.com)]]


Revision [2602]

Edited on 2013-05-10 15:00:56 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Red/Blue/Mainstream Marketing**
Listening to KUSC classical public radio fundraiser where they mentioned some dead commercial classical radio stations. Why have commercial classical radio stations died? Because, I'm guessing, blue (affluent, college-educated, progressive/liberalish) listeners won't listen to commercials. //Unless// they come in the form of discreet underwriting.
Surely upscale advertisers want to reach this blue audience as much as they ever have. It's just that blue audience will be receptive to them only under certain conditions, which exclude the sort crude advertisements listeners of mainstream and talk radio are prepared to endure.
How does underwriting revenue compare to old traditional commercial advertising revenue? Significantly less? More? Factor in difference between profit and not-for-profit station setups. Is it roughly comparable? My guess is that it is as lucrative, in terms of providing income for actual employees, as it ever was. But probably a slimmed-down operation (e.g., much smaller advertising dept that now goes under a different name) and no investors involved (so they will look elsewhere for their passive income.)


Revision [2594]

Edited on 2013-04-22 12:08:29 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
http://jsfiddle.net/6nxdV/1/


Revision [2593]

Edited on 2013-04-22 10:38:52 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
http://jsfiddle.net/rKMq5/1/


Revision [2592]

Edited on 2013-04-22 10:26:43 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
[[http://net.tutsplus.com/tutorials/javascript-ajax/an-introduction-to-the-raphael-js-library/ http://net.tutsplus.com/]]
http://jsfiddle.net/htH9j/6/
Deletions:
http://net.tutsplus.com/tutorials/javascript-ajax/an-introduction-to-the-raphael-js-library/
http://jsfiddle.net/htH9j/


Revision [2591]

Edited on 2013-04-22 10:03:29 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**An Introduction to the Raphael JS Library**
http://net.tutsplus.com/tutorials/javascript-ajax/an-introduction-to-the-raphael-js-library/
http://jsfiddle.net/htH9j/


Revision [2586]

Edited on 2013-04-08 14:47:08 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- "a new requirement for the new dev_appserver is [[http://pythonhosted.org/pyobjc/install.html PyObjC]]" ([[http://www.reddit.com/r/AppEngine/comments/1am9f8/app_engine_176_released/c8z06k8 reddit.com]])
~- http://code.google.com/p/appengine-devappserver2-experiment/issues/list
Deletions:
"a new requirement for the new dev_appserver is [[http://pythonhosted.org/pyobjc/install.html PyObjC]]" ([[http://www.reddit.com/r/AppEngine/comments/1am9f8/app_engine_176_released/c8z06k8 reddit.com]])


Revision [2585]

Edited on 2013-04-08 14:43:59 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
"a new requirement for the new dev_appserver is [[http://pythonhosted.org/pyobjc/install.html PyObjC]]" ([[http://www.reddit.com/r/AppEngine/comments/1am9f8/app_engine_176_released/c8z06k8 reddit.com]])
Deletions:
"a new requirement for the new dev_appserver is PyObjC" ([[http://www.reddit.com/r/AppEngine/comments/1am9f8/app_engine_176_released/c8z06k8 reddit.com]](
http://pythonhosted.org/pyobjc/install.html


Revision [2584]

Edited on 2013-04-08 14:43:09 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Google App Engine 1.7.6**
"a new requirement for the new dev_appserver is PyObjC" ([[http://www.reddit.com/r/AppEngine/comments/1am9f8/app_engine_176_released/c8z06k8 reddit.com]](
http://pythonhosted.org/pyobjc/install.html


Revision [2502]

Edited on 2013-03-28 12:01:37 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**(Un)Discarded Comments**
[[https://news.ycombinator.com/item?id=5456940 response]] to [[https://news.ycombinator.com/item?id=5456640 HN comment]]
The point here is that these drugs haven't been tested for their safety, much less their efficacy. They are still at an early testing stage. The researchers seem to have a reasonable theory for why they believe they will be effective. But molecular biology is complicated and the risk for harmful effects in humans is not trivial.
Ben Goldacre's book Bad Pharma details the serious personal and social costs that come with poor drug trials. Everyone urging the abandonment of caution here seems to assume this new drug already works or, at the very least, the effects of its usage could not be worse than the grim prognosis patients already confront. But that's what proper trials are meant to establish. Snake oil can come in pill form, too. And even with the current regulations, we've ended up with a number of ineffective, expensive, and sometimes deadly drugs on the market.
Deletions:
response to [[https://news.ycombinator.com/item?id=5456640 HN comment]]
The point here is that these drugs haven't been tested for their safety, much less their efficacy. They are still at an early testing stage. The researchers seem to have a reasonable theory for why they believe they will be effective. But molecular biology is complicated and the risk for side effects in humans is not trivial.
Ben Goldacre's book Bad Pharma details the serious personal and social costs that come with poor drug trials. Everyone urging the abandonment of caution here seems to assume this new drug already works or, at the very least, the effects of its usage could not be worse than the grim prognosis patients already confront. But that's what proper trials are meant to establish. And even with the current regulations, we've ended up with a number of ineffective, expensive, and sometimes deadly drugs on the market.


Revision [2501]

Edited on 2013-03-28 11:56:23 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
response to [[https://news.ycombinator.com/item?id=5456640 HN comment]]
The point here is that these drugs haven't been tested for their safety, much less their efficacy. They are still at an early testing stage. The researchers seem to have a reasonable theory for why they believe they will be effective. But molecular biology is complicated and the risk for side effects in humans is not trivial.
Ben Goldacre's book Bad Pharma details the serious personal and social costs that come with poor drug trials. Everyone urging the abandonment of caution here seems to assume this new drug already works or, at the very least, the effects of its usage could not be worse than the grim prognosis patients already confront. But that's what proper trials are meant to establish. And even with the current regulations, we've ended up with a number of ineffective, expensive, and sometimes deadly drugs on the market.


Revision [2466]

Edited on 2013-03-24 15:39:11 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
[[http://en.wikipedia.org/wiki/Chess_symbols_in_Unicode White icons]]
Deletions:
White icons


Revision [2465]

Edited on 2013-03-24 15:38:31 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
>>> icons = ['\xe2\x99\x94', '\xe2\x99\x95', '\xe2\x99\x96', '\xe2\x99\x97', '\xe2\x99\x98', '\xe2\x99\x99']
As html: ♔ ♕ ♖ ♗ ♘ ♙
Deletions:
>>> icons = ['♔', '♕', '♖', '♗', '♘', '♙']
♔ ♕ ♖ ♗ ♘ ♙


Revision [2464]

Edited on 2013-03-24 15:36:49 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Python Chess Icons**
White icons
>>> icons = ['♔', '♕', '♖', '♗', '♘', '♙']
>>> icons
['\xe2\x99\x94', '\xe2\x99\x95', '\xe2\x99\x96', '\xe2\x99\x97', '\xe2\x99\x98', '\xe2\x99\x99']
>>> print ' '.join(icons)
♔ ♕ ♖ ♗ ♘ ♙


Revision [2461]

Edited on 2013-03-20 10:09:03 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- [[http://www.reddit.com/r/learnprogramming/comments/1am1qi/im_trying_to_find_recommendations_for_companies/ Reddit thread]]
~- [[https://news.ycombinator.com/item?id=5408577 Hacker News thread]]
Deletions:
see [[http://www.reddit.com/r/learnprogramming/comments/1am1qi/im_trying_to_find_recommendations_for_companies/ this reddit thread]]


Revision [2457]

Edited on 2013-03-19 12:38:37 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
see [[http://www.reddit.com/r/learnprogramming/comments/1am1qi/im_trying_to_find_recommendations_for_companies/ this reddit thread]]
Deletions:
see this [[http://www.reddit.com/r/learnprogramming/comments/1am1qi/im_trying_to_find_recommendations_for_companies/ reddit thread]]


Revision [2456]

Edited on 2013-03-19 12:38:24 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Call For Companies that Do Developer Training**
see this [[http://www.reddit.com/r/learnprogramming/comments/1am1qi/im_trying_to_find_recommendations_for_companies/ reddit thread]]


Revision [2455]

Edited on 2013-03-17 12:58:13 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
see http://klenwell.com/press/2013/03/tar-with-absolute-paths/
Deletions:
I recognize the tar interface is not really designed with absolute paths in mind, but I find absolute paths generally easier to work with when scripting.
So here's a simple example of using absolute paths with tar:
%%(bash)
# set up dir to tar and zip
mkdir -p ~/tar_me/subdir
touch ~/tar_me/{file1.txt,file2.txt}
touch ~/tar_me/subdir/{file1.txt,file2.txt}
# test input/output directories
mkdir /tmp/tar_in
mkdir /tmp/tar_out
# create zipped tar using absolute paths
tar -vczf /tmp/tar_in/tar_me.tgz -C /home/me/ tar_me
# unzip tar using absolute paths
tar -xvf /tmp/tar_in/tar_me.tgz -C /tmp/tar_out/
Before: ##tree /home/me/tar_me##
/home/me/tar_me/
|-- file1.txt
|-- file2.txt
+-- subdir
|-- file1.txt
+-- file2.txt
After: ##tree /tmp/tar_out/tar_me##
/tmp/tar_out/tar_me
|-- file1.txt
|-- file2.txt
+-- subdir
|-- file1.txt
+-- file2.txt
References:
http://serverfault.com/a/86483
http://askubuntu.com/a/45354


Revision [2431]

Edited on 2013-03-07 10:00:23 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
I recognize the tar interface is not really designed with absolute paths in mind, but I find absolute paths generally easier to work with when scripting.
So here's a simple example of using absolute paths with tar:
Deletions:
I recognize the tar interface is not really designed with absolute paths in mind, but I find absolute paths generally easier to work with when scripting. So here's a simple example of using absolute paths with tar:


Revision [2430]

Edited on 2013-03-07 09:59:17 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
# create zipped tar using absolute paths
# unzip tar using absolute paths
Deletions:
# create zipped tar
# unzip tar


Revision [2429]

Edited on 2013-03-07 09:58:29 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
# set up dir to tar and zip
mkdir -p ~/tar_me/subdir
touch ~/tar_me/{file1.txt,file2.txt}
touch ~/tar_me/subdir/{file1.txt,file2.txt}
# test input/output directories
mkdir /tmp/tar_in
mkdir /tmp/tar_out
# create zipped tar
tar -vczf /tmp/tar_in/tar_me.tgz -C /home/me/ tar_me
# unzip tar
tar -xvf /tmp/tar_in/tar_me.tgz -C /tmp/tar_out/
Before: ##tree /home/me/tar_me##
/home/me/tar_me/
|-- file1.txt
|-- file2.txt
+-- subdir
|-- file1.txt
+-- file2.txt
After: ##tree /tmp/tar_out/tar_me##
/tmp/tar_out/tar_me
|-- file1.txt
|-- file2.txt
+-- subdir
|-- file1.txt
+-- file2.txt
References:
http://serverfault.com/a/86483
http://askubuntu.com/a/45354


Revision [2428]

Edited on 2013-03-07 09:37:31 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Tar with Absolute Paths**
I recognize the tar interface is not really designed with absolute paths in mind, but I find absolute paths generally easier to work with when scripting. So here's a simple example of using absolute paths with tar:
%%(bash)


Revision [2414]

Edited on 2013-02-25 10:57:43 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Discarded Comments**
response to [[http://news.ycombinator.com/item?id=5280149 HN comment]]
//One solution that's been proposed is the increased use of HSAs + high deductible policies. That way people are paying their expenses out of pocket (for the day-to-day things at least), and are therefore more likely to shop around.//
This is a solution that's being implemented: the corporation I work for started pushing these a couple years ago and I signed up because they are much cheaper than the HMO alternatives (whose premiums significantly jumped that year). Corp also offered a sort of signing bonus ($500 in your HSA). Plus I'm single, in good health, and plan to do everything I can to avoid using the medical system.
You can't really comparison shop serious procedures and if I actually thought I needed real medical care, I would have signed up for one of the more expensive HMOs.
These HSA plans seem better designed to make consumers more conscious of the costs as a way to discourage gratuitous procedures (a big problem that was focus of recent Time article) and promote more preventative care.


Revision [2413]

Edited on 2013-02-25 08:39:23 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
response to [[http://news.ycombinator.com/item?id=5279584 HN comment]]
I help manage my grandmother's finances. Her health care is covered under Kaiser through the large corporation with which he retired.
I would guess over the last 5 years the amount that has been billed for her medical care has outstripped the amount of money I've made. Easily. The truth is: I have no idea. I don't think she's ever seen a medical bill in that time, apart from an incidental co-pay perhaps. Kaiser handles everything and I'm guessing pulls the money directly from Medicare.
I'm glad to see attention finally being given to the issue of transparency. There seems to be a media swell building around this recent Time article. And in my own experience, I signed up for a cheaper, high deductible plan at work that my company strongly pushed -- I suspect, in large part, because it made costs more tangible.
Like calorie counts posted on menus, it won't solve the issue, but I expect it will help nibble at the edges.


Revision [2410]

Edited on 2013-02-01 10:22:20 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Online Mysql Designer**
http://ondras.zarovi.cz/sql/demo/


Revision [2409]

Edited on 2013-01-30 12:40:48 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
print cluster_overlaps(center_pts, overlapping_circle_pts)
I'd be cautious extending this guy too much sympathy. He makes his stalker out to be something like Sean Hannity's incarnation of evil (a foul-mouthed female radical Iranian Islamo-extremist) where the truth, as others have pointed out, is probably less salacious: she's mentally ill. Moreover, I don't know about you, but most Persians I've met haunting the MFA programs of this country aren't Muslim jihadis but more like the Kardashians.
Deletions:
I'd be cautious extending this guy too much sympathy. He makes his stalker out to be something like Sean Hannity's incarnation of evil (a foul-mouthed female radical Iranian Islamo-extremist) where the truth, as others have pointed out, is probably less salacious: she's mentally ill. Moreover, I don't know about you, but most Persians I've met haunting the MFA programs of this country aren't Muslim jihadis but more like the spoiled descendants of cronies of the Shah.


Revision [2408]

Edited on 2013-01-30 12:39:13 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
http://stackoverflow.com/q/14607317/1093087
center_pts = [(-2,2), (-2,2), (0,0), (4,1), (6,2), (7,1)]
overlapping_circle_pts = [
(center_pts[0], center_pts[1]),
(center_pts[0], center_pts[2]),
(center_pts[1], center_pts[0]),
(center_pts[1], center_pts[2]),
(center_pts[2], center_pts[0]),
(center_pts[2], center_pts[1]),
(center_pts[2], center_pts[3]),
(center_pts[3], center_pts[2]),
(center_pts[4], center_pts[5]),
(center_pts[5], center_pts[4]),
expected_clusters = [
((-2,2), (-2,2), (0,0), (2,1)),
((6,2), (7,1))
def cluster_overlaps(nodes, adjacency_list):
connections = []
while len(nodes):
node = nodes[0]
path = dfs(node, adjacency_list, nodes)

# append path to connected_nodes
connections.append(path)

# remove all nodes from
for pt in path:
nodes.remove(pt)

return connections


def dfs(start, adjacency_list, nodes):
"""ref:
http://code.activestate.com/recipes/576723-dfs-and-bfs-graph-traversal/"""
path = []
q = [start]
while q:
node = q.pop(0)

# cycle detection
if path.count(node) >= nodes.count(node):
continue

path = path + [node]

# get next nodes
next_nodes = [p2 for p1,p2 in adjacency_list if p1 == node]
q = next_nodes + q

return path
Deletions:
pts = [(-2,2), (-2,2), (0,0), (4,1), (6,2), (7,1)]
overlaps = [
(pts[0], pts[1]),
(pts[0], pts[2]),
(pts[1], pts[0]),
(pts[1], pts[2]),
(pts[2], pts[0]),
(pts[2], pts[1]),
(pts[2], pts[3]),
(pts[3], pts[2]),
(pts[4], pts[5]),
(pts[5], pts[4]),
def cluster_pairs(pairs):
q = list(pairs)
clusters = list(pairs)
while len(q) > 0:
head, q = q[0], q[1:]
for clust in q:
if linked(head, clust):
new_clust = cluster(head, clust)
clusters.append(new_clust )
q.append(new_clust)

return clusters

def linked(c1, c2):
pass
def cluster(c1, c2):
c = c1 + c2[1:]
assert c == list(set(c))
return c
Or:
get [[http://stackoverflow.com/questions/1482308 powerset]] of all combos
filter those that don't link
filter redundancies


Revision [2407]

Edited on 2013-01-29 16:12:38 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
get [[http://stackoverflow.com/questions/1482308 powerset]] of all combos
Deletions:
get superset of all combos


Revision [2406]

Edited on 2013-01-29 16:08:17 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
overlaps = [
Deletions:
pairs = [


Revision [2405]

Edited on 2013-01-29 16:07:50 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Group Overlapping Circles**
pts = [(-2,2), (-2,2), (0,0), (4,1), (6,2), (7,1)]
pairs = [
(pts[0], pts[1]),
(pts[0], pts[2]),
(pts[1], pts[0]),
(pts[1], pts[2]),
(pts[2], pts[0]),
(pts[2], pts[1]),
(pts[2], pts[3]),
(pts[3], pts[2]),
(pts[4], pts[5]),
(pts[5], pts[4]),
]
def cluster_pairs(pairs):
q = list(pairs)
clusters = list(pairs)
while len(q) > 0:
head, q = q[0], q[1:]
for clust in q:
if linked(head, clust):
new_clust = cluster(head, clust)
clusters.append(new_clust )
q.append(new_clust)

return clusters

def linked(c1, c2):
pass
def cluster(c1, c2):
c = c1 + c2[1:]
assert c == list(set(c))
return c
Or:
get superset of all combos
filter those that don't link
filter redundancies


Revision [2404]

Edited on 2013-01-29 08:53:57 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
I'd be cautious extending this guy too much sympathy. He makes his stalker out to be something like Sean Hannity's incarnation of evil (a foul-mouthed female radical Iranian Islamo-extremist) where the truth, as others have pointed out, is probably less salacious: she's mentally ill. Moreover, I don't know about you, but most Persians I've met haunting the MFA programs of this country aren't Muslim jihadis but more like the spoiled descendants of cronies of the Shah.
Deletions:
I'd be cautious extending this guy too much sympathy. He makes his stalker out to be something like Sean Hannity's incarnation of evil (a foul-mouthed female radical Iranian Islamo-extremist) where the truth, as others have pointed out, is probably less salacious: she's mentally ill. Moreover, I don't know about you, but most Persians I've met haunting the MFA programs of this country aren't Muslim radicals but more like the spoiled descendants of cronies of the Shah.


Revision [2403]

Edited on 2013-01-29 08:52:47 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
%%(python)
def centroid(pts):
fl = lambda n: float(n)
ir = lambda n: int(round(n))

xs = [fl(x) for x,y in pts]
ys = [fl(y) for x,y in pts]

x,y = (sum(xs) / len(pts), sum(ys) / len(pts))
return (ir(x), ir(y))
%%


Revision [2402]

Edited on 2013-01-29 08:52:17 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
I'd be cautious extending this guy too much sympathy. He makes his stalker out to be something like Sean Hannity's incarnation of evil (a foul-mouthed female radical Iranian Islamo-extremist) where the truth, as others have pointed out, is probably less salacious: she's mentally ill. Moreover, I don't know about you, but most Persians I've met haunting the MFA programs of this country aren't Muslim radicals but more like the spoiled descendants of cronies of the Shah.
Deletions:
I'd be cautious extending this guy too much sympathy. He makes his stalker out to be something like Sean Hannity's incarnation of evil (a foul-mouthed female radical Iranian Islamo-extremist) where the truth, as others have pointed out, is probably less salacious: she's mentally ill. Moreover, I don't know about you, but most Persians I've met haunting the MFA programs of this country aren't Muslim radicals but the privileged descendants of cronies of the Shah.


Revision [2401]

Edited on 2013-01-29 08:51:21 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
In response to [[http://news.ycombinator.com/item?id=5126731 HN comment]] on [[http://chronicle.com/article/I-Will-Ruin-Him/136693/ article]]:
Deletions:
In response to [[http://news.ycombinator.com/item?id=5126731 HN comment]]:


Revision [2400]

Edited on 2013-01-29 08:50:27 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Centroid**
In response to [[http://news.ycombinator.com/item?id=5126731 HN comment]]:
I'd be cautious extending this guy too much sympathy. He makes his stalker out to be something like Sean Hannity's incarnation of evil (a foul-mouthed female radical Iranian Islamo-extremist) where the truth, as others have pointed out, is probably less salacious: she's mentally ill. Moreover, I don't know about you, but most Persians I've met haunting the MFA programs of this country aren't Muslim radicals but the privileged descendants of cronies of the Shah.
In response to this [[http://news.ycombinator.com/item?id=5104331 HN comment]]:
Deletions:
In response to this [[http://news.ycombinator.com/item?id=5104331 HN Comment]]:


Revision [2398]

Edited on 2013-01-23 12:23:54 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Discarded Comment**
In response to this [[http://news.ycombinator.com/item?id=5104331 HN Comment]]:
Deletions:
**Discard Comment**
In response to this [[http://news.ycombinator.com/item?id=5104331 HN Comment]]


Revision [2397]

Edited on 2013-01-23 12:23:33 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Discard Comment**
In response to this [[http://news.ycombinator.com/item?id=5104331 HN Comment]]
One of the interesting things I learned taking anthropology class as an undergraduate was the difference between sharing and gift-exchange. We studied some indigenous cultures in Papua New Guinea and where before I would have looked at their cultural practices and naively classified them as some form of communal sharing, I was taught to see them as involving elaborate forms of gift exchange. Gift exchange seemed to me much more complicated and personally taxing than more commercial forms of exchange using money.
If "disruptive online services" can filter out some of the social and emotional complexity involved in exchanging services, I think they've more than earned their fee. But I don't think the transition between loaning your couch to a friend and renting it out to him is as straight forward as suggested. I suspect the difference in the way money gets distributed among the various parties is among the least important factors that enters into such a bargain.
But then I see your point. Where before you might feel obligated to help out a friend down on his luck and needing a bit of assistance, Airbnb gives you a ready pretext for doing something more impersonal and efficient.


Revision [2391]

Edited on 2013-01-17 20:18:05 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
[[CocktailNapkin2007 2007 Napkin]]>>
Deletions:
[[CocktailNapkin2007 2007 Napkin]]
SpecialReading
WordsIReallyLike
ThumbDrive
[[CocktailQuestions Questions for Strangers]]>>


Revision [2387]

Edited on 2013-01-17 20:15:24 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**A Statistical Survey of Small Business Openings and Closings Correlated by Storefront Address**
Deletions:
**A Statistical Survey of Small Business Openings and Closing Correlated by Storefront Address**


Revision [2381]

Edited on 2013-01-12 11:32:43 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**A Statistical Survey of Small Business Openings and Closing Correlated by Storefront Address**


Revision [2379]

Edited on 2013-01-12 11:26:59 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
""<small>links and notes for later organization</small>"">>[[CocktailNapkin2012 2012 Napkin]]
[[CocktailNapkin2011 2011 Napkin]]
**The Legal and Logical Implications of the Word Only in English Colloquial Usage**
Deletions:
""<small>links and notes for later organization</small>"">>[[CocktailNapkin2011 2011 Napkin]]
**PyWell: A Python Tutorial**
PywellInterpreter
**jQuery Cookie Plugin with Internet Explorer 6**
It appears that including the path parameter when setting a cookie with the jQuery cookie plugin in IE6 does not work:
%%(javascript)
var cookie_name = "foo";
var cookie_value = "bar";
var cookie_path = "/some/valid/path";
// does not work in IE6
$.cookie(cookie_name, cookie_value, {path: cookie_path});
// works in IE6
$.cookie(cookie_name, cookie_value);
%%
Was not tested with any other version of IE. Worked as expected in later versions of Firefox and Chrome that I had installed.
Wasn't sure if this warranted a bug report (yes, I have to target IE6) so I figured I just drop it here. Maybe move it to my blog at some point.
**Euler #9 in Ruby**
http://projecteuler.net/problem=9
%%(ruby)
=begin
http://projecteuler.net/problem=9

A Pythagorean triplet is a set of three natural numbers, a < b < c,
for which,
a2 + b2 = c2
For example, 32 + 42 = 9 + 16 = 25 = 52.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
=end
#
# Test Case / Solution
#
def test_case
sum = 3 + 4 + 5
expected = 3 * 4 * 5

a, b, c = find_first_triplet(sum)
product = a * b * c

raise "%s != expected %s" % [product , expected] unless product == expected
puts "test case successful"
end
def solution
sum = 1000
a, b, c = find_first_triplet(sum)
puts "a, b, c: %d, %d, %d" % [a,b,c]
a * b * c
end
#
# Support Code
#
def find_first_triplet(sum)
a = get_max_a(sum)
b, c = 0, 0

while a > 0
b = a + 1
c = sum - (a + b)
while b < c:
c = sum - (a + b)
if is_pythagorean(a, b, c)
return a, b, c
end
b += 1
end
a -=1
end
end
def is_pythagorean(a, b, c)
a**2 + b**2 == c**2
end
def get_max_a(abc_sum)
mean = abc_sum / 3
c = mean
b = c - 1
a = c - 2
deque = [c, b, a]

while deque.inject{|sum,x| sum + x } < abc_sum
n = deque.shift
n += 1
deque.push(n)
end

deque.min
end
#
# Test Code
#
def test_get_max_a
cases = [
[1000, 332],
[12, 3]
]

cases.each do |abc_sum, expected|
a_max = get_max_a(abc_sum)
raise "%s != expected %s" % [a_max , expected] unless a_max == expected
puts "test_get_max_a successful"
end
end
#
# Main
#
test_get_max_a
test_case
puts solution
%%
**Euler #7 in Ruby**
http://projecteuler.net/problem=7
%%(ruby)
=begin
http://projecteuler.net/problem=7

By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see
that the 6th prime is 13.
What is the 10 001st prime number?
=end
#
# Test Case / Solution
#
def test_case
index = 6
expected = 13

prime = get_prime_number(index)

raise "%s != expected %s" % [prime, expected] unless prime == expected
puts "test case successful"
end
def solution
index = 10001
get_prime_number(index)
end
#
# Support Code
#
def get_prime_number(index)
at = 0
last_prime = 1


while at < index:
last_prime = get_next_prime(last_prime)
at += 1
#puts at
end

return last_prime
end
def get_next_prime(last_prime)
found = false
n = last_prime

while ! found
n += 1
if is_prime(n)
found = true
end
end

return n
end
def is_prime(number)
limit = number / 2

2.upto(limit) do |n|
if number % n == 0
return false
end
end

true
end
def erosthanes_incremental_sieve(limit)
# http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#Incremental_sieve
lower = 2
batch_size = 1000
primes = []

while primes.length < limit
upper = lower + batch_size
sieved = erosthanes_sieve(lower, upper, primes)
primes += sieved
lower = upper
end

primes[limit]
end
def erosthanes_sieve(lower, upper, primes)
# an exercise for the reader
end
#
# Main
#
test_case
puts solution
%%
**Python Sorting Problem**
see Pastebin20120829
**Google APIs Client Library for Python**
~- http://code.google.com/p/google-api-python-client/
~- http://stackoverflow.com/questions/5056719/
~- http://stackoverflow.com/questions/6011272/
~- The Issue
~~- [[https://groups.google.com/forum/?fromgroups=#!topic/google-analytics-data-export-api/lNsR-pA76xc https://groups.google.com]]
**Fabric DB Backup**
%%(python)
from fabric.api import env, settings, run, local, get, put, lcd
from fabric.contrib.files import exists as remote_file_exists
from os.path import exists as local_file_exists, join as pathjoin
#
# Globals
#
DB_NAME = "klenwell"
DUMP_FILE = "%s-db.bz2" % (DB_NAME)
DUMP_PATH = pathjoin("/tmp", DUMP_FILE)
LOCAL_DEST = "/home/klenwell/hg/klenwell/data"
env.roledefs = {
'local': ['localhost'],
'remote': ['root@dbserver']
}


#
# Commands
#
def backup():
mysql_dump_db()
transfer_backup_file()
save_to_repository()
cleanup()
def test_host():
echo("running `hostname -f` on host %s" % (env.host), 3)
run("hostname -f")

#
# Tasks
#
def mysql_dump_db():
cmd_f = "mysqldump %(db_name)s | bzip2 > %(dump_path)s"
run(cmd_f % dict(db_name=DB_NAME, dump_path=DUMP_PATH))
assert remote_file_exists(DUMP_PATH), "dumped sql file not found"

def transfer_backup_file():
get(DUMP_PATH, LOCAL_DEST)
assert local_file_exists(pathjoin(LOCAL_DEST, DUMP_FILE))
def save_to_repository():
with lcd(LOCAL_DEST):
local("hg commit -m 'backing up wiki db'")
local("hg push")

def cleanup():
pass
%%
**Wikka Upgrade**
WikkaUpgradeCore
**WorkFlowy**
https://workflowy.com/shared/82012321-4ce7-c039-6593-b0c5abf976f4/
**WikkaRegistrationRecaptcha**
Replaces UserSettingsRecaptcha
**Font Ready (JS / PlayN)**
[[http://stackoverflow.com/questions/11602718/in-the-html-version-of-my-playn-game-how-can-i-reliably-load-fonts-so-text-disp The Problem]]
Solutions?
http://stackoverflow.com/a/6678869/1093087
https://developers.google.com/webfonts/docs/webfont_loader
%%(html)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>webfont example</title>

<!-- Google AJAX Libraries API -->
<script src="http://www.google.com/jsapi"></script>
<script>
google.load("jquery", "1.4.2");
google.load("webfont", "1");

WebFontConfig = {
google: {
families: [ 'Droid+Sans::latin' ]
},
loading: function() {
$("#status").text("loading fonts");
},
fontloading: function(DroidSans, n) {
$("#status").text("loading Droid Sans font");
$("#target").text("sans-serif");
},
fontactive: function(DroidSans, n) {
$("#status").text("Droid Sans is active");
$("#target").text("Droid Sans");
},
fontinactive: function(DroidSans, n) {
$("#status").text("Droid Sans is inactive");
}
};

google.setOnLoadCallback(function() {
WebFont.load(WebFontConfig);
});
</script>

<style type="text/css">
.wf-loading h1 {
font-family: sans-serif;
font-style:italic;
color: #999;
font-size: 16px;
}
.wf-inactive h1 {
font-family: sans-serif;
color:red;
font-size: 20px;
}
.wf-active h1 {
font-family: 'Droid Sans', sans-serif;
color:green;
font-size: 24px;
}
</style>
</head>
<body>
<h1 id="target">a web-load font</h1>
<pre>status: <span id="status">init</span></pre>
</body>
</html>
%%
**New Yorker Digital**
To switch from print to digital version of New Yorker, call 800-873-8201
**Vision Radius**
%%(python)
visionRadius = r.radius + (court.radius * r.vision / 100.0)
focusPt = r.pt
maxScore = 0
for pt in visionRadiusPts:
if not pt in court:
continue
score = getScore(pt)
if score > maxScore:
maxScore = score
focusPt = pt

return focusPt
%%
**Lazy Sampling**
%%(python)
import random, time, math
def get_options(num):
return list(range(num))

def sort_options(options):
return sorted(options, reverse=True)

def select_opt(options, skill):
prob = skill / 100.0
sampled_opts = []
for o in options:
if random.random() < prob:
sampled_opts.append(o)
if len(sampled_opts) > 10:
break
return random.choice(sampled_opts[:10])
def select_old(options, skill):
size = int(round(1.0 * (len(options) * skill / 100.0)))
opts = random.sample(options, size)
opts = sorted(opts, reverse=True)
return random.choice(opts[:10])

def selecti(options, skill):
limit = (100 - skill) * 10
sp = skill / 100.0
prob = sp

sampled_opts = []
for o in options:
if random.random() < prob:
sampled_opts.append(o)
if len(sampled_opts) > limit:
break
return random.choice(sampled_opts)

def sim(f, skill=50):
runs = 1000
options = sort_options(get_options(1000))

selections = []
for n in range(runs):
selected = f(options, skill)
selections.append(selected)

avg_selection = 1.0 * sum(selections) / len(selections)
print """
skill: %d
avg: %.2f
max: %d
min: %d""" % (skill, avg_selection, max(selections), min(selections))


if __name__ == "__main__":
sim(selecti,99)
sim(selecti,66)
sim(selecti,33)

skill = 75
s0 = time.time()
sim(select_old,skill)
s1 = time.time() - s0
print "old complete: %0.5fs" % (s1)

s0 = time.time()
sim(select_opt,skill)
s2 = time.time() - s0
opt = s1 / s2
print "opt complete: %0.5fs (%.1fx as fast)" % (s2, opt)

s0 = time.time()
sim(selecti,skill)
s3 = time.time() - s0
opt = s1 / s3
print "i complete: %0.5fs (%.1fx as fast)" % (s3, opt)
%%
**String Data Structures (for when your JSON lib is a PITA)**
%%
)( - 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d
][ - 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d ][ 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d ][ 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d
}{ - 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d ][ 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d ][ 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d }{ 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d ][ 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d ][ 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d
%%
**init not found try passing init=bootargs**
~- On Asus EEE Netbook
~- To Fix
~~- Insert Ubuntu thumbdrive (on keychain)
~~- Reboot > Press ESC until you get Boot Menu
~~- Run without Installing
~~- See this post: http://askubuntu.com/a/73983/46766
**atta dict!**
%%(python)
"""
ref: http://news.ycombinator.com/item?id=3881341
"""
from collections import defaultdict
from pprint import pprint
import pdb
class attrdict(defaultdict):
def __getattr__(self, key): return self[key]
def __setattr__(self, key, val): self[key]=val
def tree(): return attrdict(tree)
ca = tree()
ca.orange.santa_ana = 92704
ca.orange.anaheim = 92807
pprint(ca)
pdb.set_trace()
%%
**matplotlib custom color sequence**
%%(python)
"""
A series of circle with custom colormap (red to green)

USAGE
python .dev/colormap.py

REFERENCES:
http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.patches.Circle
http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps
http://stackoverflow.com/questions/9215658/plot-a-circle-with-pyplot
http://stackoverflow.com/a/9544600/1093087
"""
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from matplotlib import cm
from numpy import arange
import math
SOLID = 'solid'
GREY = (.75,.75,.75)
clamp = lambda v: min(max(0, v), 1)
def main():
# simulate a smartphone
h, w = 15.0/8.0, 51.0/16.0
hpx, wpx = 480.0, 800.0
dpi = math.sqrt(hpx*wpx) / math.sqrt(h*w)

# or my laptop
lhpx, lwpx = 1600.0, 900.0
lhw = 17.3
ldpi = math.sqrt(lhpx*lwpx) / math.sqrt(lhw)

# set up color map
colors = cm.gist_rainbow(arange(200))
rg_map = ListedColormap(colors[:100], 'red-green')
colors = rg_map.colors

# circle params
minR, maxR = 4,8
x,y = 2,0

# build image
fig = plt.Figure(figsize=(w,h), dpi=dpi)
for n in range(0,100,3):
radius = minR + ((maxR-minR) * (n/100.0))
x += maxR
pt = (x,y)
x += maxR + 4

r = clamp(1 - (.66*n / 100.0))
g = clamp(0 + (1.0*n / 100.0))
b = 0
# alternately, using a colormap
#ci = math.floor((n/100.0)*len(colors))
#rgba = colors[ci]
#r,g,b = map(lambda n: int(round(n*255)), [v for v in rgba[:3]])
# circle and edge
c = plt.Circle(pt, radius, color=(r,g,b))
o = plt.Circle(pt, maxR, fill=False, lw=1, ls=SOLID, edgecolor=GREY)
plt.axes().add_artist(c)
plt.axes().add_artist(o)
print (pt, radius), (r,g,b)

# label a few
if (n/3) % 11 == 0:
rv,gv,bv = map(lambda n: int(round(n*255)), [v for v in (r,g,b)])
label = 'RGB: (%d,%d,%d)' % (rv,gv,bv)
plt.axes().annotate(label, (x-radius, n+minR+12), size=12)

plt.axes().set_xlim((0,wpx), auto=False)
plt.axes().set_ylim((-hpx/2,hpx/2), auto=False)
plt.axes().set_aspect('equal')
plt.show()

def example():
"""source: http://stackoverflow.com/a/9216646/1093087"""
circle1=plt.Circle((0,0),.2,color='r')
circle2=plt.Circle((.5,.5),.2,color='b')
circle3=plt.Circle((1,1),.2,color='g',clip_on=False)
fig = plt.gcf()
fig.gca().add_artist(circle1)
fig.gca().add_artist(circle2)
fig.gca().add_artist(circle3)
plt.show()
main()
%%
**Soup Request Test**
%%(python)
#!/usr/bin/python
"""
proto.py
PURPOSE
Prototyping gyro (requests experiment).


USAGE
$ venv/bin/python dev/gyro/tests/dev/proto.py

NOTES
Uses requests, beautifulsoup
REFERENCES
http://docs.python-requests.org/en/latest/user/quickstart/#make-a-get-request
http://www.crummy.com/software/BeautifulSoup/bs3/documentation.html#Quick%20Start
"""
#
# IMPORTS
#
# Python Imports
import unittest, sys, os, time
from os.path import (abspath, dirname, join as pathjoin, exists)
from datetime import(datetime, date, timedelta)
from random import (choice, sample)
import pdb
import re
# External Imports
import requests
from BeautifulSoup import BeautifulSoup as soup, Tag, NavigableString
# Extend sys.path
PROJECT_PATH = abspath(pathjoin(dirname(__file__), '../..'))
# Project Imports
#
# MODULE PARAMETERS
#
# Exception Classes
class NullException(Exception): pass
#
# Test Class
#
class PrototypeTest(unittest.TestCase):

data_dir = pathjoin(PROJECT_PATH, 'test/data')

#
# Harness
#
def setUp(self):
pass

def tearDown(self):
pass

#
# New Methods
#



#
# Unit Tests
#



#
# Dev Tests
#
def testLastPageGoogleNoOmissions(self):
url = "http://www.google.com/search"
query = "hello world"
start_at = 990

#
# REQUESTS
#
# prepare
payload = dict(
q = query,
hl = "en",
start = start_at,
filter = 0
)

# get
site = requests.get(url, params=payload)
raw = site.content

# test
needle = "to show you the most relevant results"
self.assertFalse(needle in raw)
self.assertTrue("Page 100" in raw)

#
# SOUP
#
# parser
html = soup(site.content)
results_block = html.findAll("li", { "class" : "g" })
last_result = results_block[-1]

# parse last result
links = last_result.findAll("a")
result_link = links[0].get("href")
result_url = result_link.split('/url?q=')[1].split('&')[0]
print result_url

# test request
self.assertTrue(results_block)

# interact
time.sleep(2)

def testLastPageGoogleOmitted(self):
url = "http://www.google.com/search"
query = "python language"
start_at = 990

#
# REQUESTS
#
# prepare
payload = dict(
q = query,
hl = "en",
start = start_at
)

# get
site = requests.get(url, params=payload)
raw = site.content

# test
needle = "to show you the most relevant results"
self.assertTrue(needle in raw)

#
# SOUP
#
# parser
html = soup(site.content)
results_block = html.findAll("li", { "class" : "g" })
last_result = results_block[-1]

# parse last result
links = last_result.findAll("a")
result_link = links[0].get("href")
result_url = result_link.split('/url?q=')[1].split('&')[0]
print result_url

# test request
self.assertTrue(results_block)

# interact
#import pdb; pdb.set_trace()

# don't arouse suspicion
time.sleep(2)


def testBeautifulSoup(self):
"""parse my special wiki page"""
url = "http://localhost/wikka/Gyro"
site = requests.get(url)
html = soup(site.content)

# these work
haystack = html.find("h3", { "id" : "hn_Haystack" })
needle = html.find(text=re.compile('a beautiful needle'))

# these don't work
nostack = html.find("h4", { "id" : "hn_Haystack" }) # wrong tag
noneedle = html.findAll(text="a beautiful needle")

self.assertEqual(type(haystack), Tag)
self.assertEqual(type(needle), NavigableString)
self.assertFalse(nostack)
self.assertFalse(noneedle)
self.assertTrue("a beautiful needle" in str(html))
self.assertTrue("a beautiful needle" in str(needle))


def testRequests(self):
"""pull my wiki"""
url = "http://localhost/wikka/Gyro"
site = requests.get(url)
self.assertTrue(site.ok)
self.assertTrue("a beautiful needle" in site.content)


#
# Smoke Tests
#
def testInstance(self):
self.assertTrue(isinstance(self, unittest.TestCase))
#
# Main
#
if __name__ == "__main__":
mod = sys.modules[globals()['__name__']]
suite = unittest.TestLoader().loadTestsFromModule(mod)
unittest.TextTestRunner(verbosity=2).run(suite)
%%
**Programming Collective Intelligence**
Source code: http://blog.kiwitobes.com/?p=44
**Install gevent to virtualenv Directory**
[[http://mirnazim.org/writings/python-ecosystem-introduction/ mirnazim.org]]
[[http://stackoverflow.com/questions/6431096/gevent-does-not-install-properly-on-ubuntu stackoverflow.com]]
[[https://groups.google.com/d/msg/gevent/GsRmocqmgN8/XUtWnIKJVHIJ groups.google.com]]
%%
# set up virtual env
source bin/activate
# install gevent
sudo apt-get install libevent-dev
export C_INCLUDE_PATH=/usr/include:/usr/local/include:/opt/local/include
pip install greenlet
pip install gevent
%%
**Python Temp Files**
Simple case:
%%(python)
import tempfile
...
temp_file_name = tempfile.NamedTemporaryFile().name
f = open(temp_file_name)
%%
Write to temp file:
%%(python)
file_contents = """hello world"""
temp_file = tempfile.NamedTemporaryFile()
temp_file.write(file_contents)
temp_file.seek(0)
f = open(temp_file.name)
%%
**Getting Setup with Virtualenv**
http://mirnazim.org/writings/python-ecosystem-introduction/
%%
# Install pip and virtualenv
sudo apt-get install python-pip python-dev build-essential
sudo pip install pip --upgrade
sudo pip install virtualenv
# Setup a virtualenv
mkdir venv
virtualenv --distribute --no-site-packages venv
# Run from virtualenv
venv/bin/python
venv/bin/python myscript.py
# To activate/deactivate env
source bin/activate
(venv)$ deactivate
%%
**Draw Circle to Canvas in PlayN**
Stack Overflow Question: http://stackoverflow.com/questions/9478065/
**GWT Plugin for Eclipse**
Problem: http://stackoverflow.com/questions/8363560
Solution: http://askubuntu.com/questions/49557#94341
**Install Eclipse with ADT Plugin on Ubuntu 11.10**
[[http://askubuntu.com/questions/107192/how-can-i-install-eclipse-with-the-adt-android-development-tool-on-ubuntu-11-1 Ask Ubuntu]]
Pastebin20120223
http://stackoverflow.com/questions/9426715
[[http://code.google.com/p/google-web-toolkit/issues/detail?id=6887 related?]]
[[http://stackoverflow.com/questions/6482268/eclipse-indigo-cannot-install-android-adt-plugin possible solution?]]
**Color Maps**
http://matplotlib.sourceforge.net/examples/api/colorbar_only.html
http://matplotlib.sourceforge.net/examples/pylab_examples/show_colormaps.html
**""RdYlGn""**
**Installing Ubuntu 11.10 on [[http://www.google.com/products/catalog?hl=en&safe=off&q=HP+g7-1310us&gs_sm=12&gs_upl=1557545l1557545l6l1558924l1l1l0l0l0l0l146l146l0.1l2l0&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&biw=1168&bih=593&um=1&ie=UTF-8&tbm=shop&cid=16780769756561576303&sa=X&ei=g0Q7T9maHcmr2AWbm9m0Cg&ved=0CF0Q8wIwAg HP G71310US]]**
HP Pavilion g7-1310us Intel Core i3-2350M Notebook
Chose [[http://www.ubuntu.com/download/ubuntu/download Ubuntu 11.10 64-Bit]]
Needed to deal with black screen issue detailed [[http://ubuntuforums.org/showthread.php?t=1613132 here]]
~- See **How to enable kernel options on the livecd (before install)**
~- Choose nomodeset (x will appear next to it)
~- Then select Install Ubuntu
~- After installation, need to follow direction for temporarily and then permanently modifying grub config with nomodeset flag. Hold down shift on boot to get to grub config.
~- On IRC chat, ludwin01 suggested 10.04 lts version did not have this problem. I'm working around it for now with grub flag.
~- My Ubuntu Forum post on issue: [[http://ubuntuforums.org/showthread.php?p=11695329#post11695329 http://ubuntuforums.org/showthread.php?p=11695329#post11695329]]
~- ""AskUbuntu"" Post: http://askubuntu.com/questions/105651/
~~- [[Pastebin20120219 Draft of Response]]
**Python Inheritance**
%%(python)
class Reveal(object):
def __repr__(self):
return "<%s %s>" % (self.__class__.__name__, self.__dict__)
class Yin(Reveal):
def __init__(self, yin=100):
self.yin = yin
self.lightness = True
self.darkness = False
self.balance = False
class Yan(Reveal):
def __init__(self, yan=100):
self.yan = yan
self.lightness = False
self.darkness = True
self.balance = False
class YinYan(Yin, Yan):
def __init__(self, yin, yan):
Yin.__init__(self, yin)
Yan.__init__(self, yan)
self.balance = True
yin = Yin(50)
yan = Yan(50)
yinyan = YinYan(50, 50)
print yin
print yan
print yinyan
# Prints
<Yin {'balance': False, 'yin': 50, 'lightness': True, 'darkness': False}>
<Yan {'balance': False, 'yan': 50, 'lightness': False, 'darkness': True}>
<YinYan {'balance': True, 'yin': 50, 'lightness': False, 'darkness': True, 'yan': 50}>
%%
**Send Email through Gmail with Python**
%%(python)
"""
Send an email programmatically through Gmail.
REFERENCES
http://snippets.dzone.com/posts/show/757
http://www.nixtutor.com/linux/send-mail-through-gmail-with-python/
http://stackoverflow.com/questions/399129/#comment8985407_399240
"""
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import COMMASPACE, formatdate
from email import Encoders
import os
from os.path import abspath, dirname, join
SMTP_SERVER = 'smtp.gmail.com:587'
SMTP_USER = 'USER@gmail.com'
SMTP_PASS = 'PASS'
EMAIL_FROM = 'USER <%s>' % (SMTP_USER)
def send_gmail(to, subject, text, files=[]):
assert type(to) == list
assert type(files) == list
from_ = EMAIL_FROM
msg = MIMEMultipart()
msg['From'] = EMAIL_FROM
msg['To'] = COMMASPACE.join(to)
msg['Date'] = formatdate(localtime=True)
msg['Subject'] = subject
msg.attach( MIMEText(text) )
for file in files:
part = MIMEBase('application', "octet-stream")
part.set_payload( open(file,"rb").read() )
Encoders.encode_base64(part)
part.add_header('Content-Disposition', 'attachment; filename="%s"'
% os.path.basename(file))
msg.attach(part)
smtp = smtplib.SMTP(SMTP_SERVER)
#smtp.set_debuglevel(1)
smtp.ehlo() # apparently this is required in python 2.5
smtp.starttls()
smtp.login(SMTP_USER, SMTP_PASS)
smtp.sendmail(from_, to, msg.as_string() )
smtp.close()
def test_email():
to = 'YOUR_RECEPIENT@some_domain.com'
subject = "Python Gmail Test"
text = 'This is simply a test.'
send_gmail([to], subject, text)
print 'simple test complete'
%%
**Method Decorator**
%%(python)
def check_some_flag(method):
def wrapper(self, *args, **kwargs):
if not self.some_flag:
raise Exception("some_flag not set")
else:
result = method(self, *args, **kwargs)
return result
return wrapper
%%
**Find Equation for Set of Points**
[[https://www.google.com/search?hl=en&output=search&sclient=psy-ab&q=python+find+equation&btnK= python find roots of equation]]
%%(python)
>>> import numpy
>>> x = [1,50,99]
>>> y = [2,1,0.5]
>>> a,b,c = numpy.polyfit(x,y,2)
>>> f = lambda x: a*x**2 + b*x + c
>>> f(1)
2.0
>>> f(20)
1.5528946272386506
>>> f(50)
1.0000000000000002
>>> f(90)
0.55435235318617249
>>> f(100)
0.49500208246563937
>>> f(99)
0.5
%%
Verizon Opt-Out Site: http://www.vzw.com/myprivacy
**Somewhat Improved Wikka Installer Routine**
Diff for wikka.php:
%%
diff -r c8f8537f5e21 -r 4e091af5eacf php/wikka/wikka.php
--- a/php/wikka/wikka.php Tue Jan 17 10:01:24 2012 -0800
+++ b/php/wikka/wikka.php Tue Jan 17 11:43:38 2012 -0800
@@ -509,11 +509,15 @@

/**
* Compare versions, start installer if necessary.
+ * Wait to start installer below if this is an upgrade so we can limit access
+ * to admin users.
*/
-if (!isset($wakkaConfig['wakka_version'])) $wakkaConfig['wakka_version'] = 0;
-if ($wakkaConfig['wakka_version'] !== WAKKA_VERSION)
-{
- /**
+$is_new_install = ! isset($wakkaConfig['wakka_version']);
+$is_upgrade = $wakkaConfig['wakka_version'] !== WAKKA_VERSION;
+
+if ( $is_new_install ) {
+ $wakkaConfig['wakka_version'] = 0;
+ /**
* Start installer.
*
* Data entered by the user is submitted in $_POST, next action for the
@@ -590,6 +594,7 @@
exit;
}

+
/**
* Save session ID
*/
@@ -611,6 +616,39 @@
}

/**
+ * Check for upgrade. If so an user is admin, show setup page, else show
+ * a maintenance message to all other visitors.
+ */
+$is_admin = $wakka->IsAdmin($user);
+$at_install_step = ($_GET['installAction'] == 'writeconfig') && (isset($_POST['config']));
+$upgrade_allowed = $is_admin || $at_install_step;
+
+if ( $is_upgrade && $upgrade_allowed ) {
+ $installAction = 'default';
+ if (isset($_GET['installAction'])) $installAction = trim($_GET['installAction']); #312
+ if (file_exists('setup'.DIRECTORY_SEPARATOR.'header.php'))
+ include('setup'.DIRECTORY_SEPARATOR.'header.php'); else print '<em class="error">'.ERROR_SETUP_HEADER_MISSING.'</em>'; #89
+ if
+ (file_exists('setup'.DIRECTORY_SEPARATOR.$installAction.'.php'))
+ include('setup'.DIRECTORY_SEPARATOR.$installAction.'.php'); else print '<em class="error">'.ERROR_SETUP_FILE_MISSING.'</em>'; #89
+ if (file_exists('setup'.DIRECTORY_SEPARATOR.'footer.php'))
+ include('setup'.DIRECTORY_SEPARATOR.'footer.php'); else print '<em class="error">'.ERROR_SETUP_FOOTER_MISSING.'</em>'; #89
+ exit;
+}
+elseif ( $is_upgrade && $_GET['install_help'] ) {
+ print "<h2> POST,GET, SESSION variables</h2>";
+ print '<pre>';
+ var_dump($_POST);
+ var_dump($_GET);
+ var_dump($_SESSION);
+ print '</pre>';
+}
+elseif ( $is_upgrade ) {
+ die('<h2>Site Undergoing Temporary Maintenance</h2><h4>Please check back shortly.</h4>');
+}
+
+
+/**
* Run the engine.
*/
if (!isset($handler)) $handler='';
%%
**IKEA Stand-Up Desks**
http://news.ycombinator.com/item?id=3442809
http://www.ikea.com/us/en/catalog/products/00115992/
http://www.ikea.com/us/en/catalog/products/60111123/


Revision [2336]

Edited on 2012-12-11 14:43:16 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**PyWell: A Python Tutorial**
Deletions:
**Pywell: A Python Tutorial**


Revision [2325]

Edited on 2012-12-11 11:03:23 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Pywell: A Python Tutorial**
PywellInterpreter


Revision [2313]

Edited on 2012-10-05 11:17:27 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**jQuery Cookie Plugin with Internet Explorer 6**
It appears that including the path parameter when setting a cookie with the jQuery cookie plugin in IE6 does not work:
%%(javascript)
var cookie_name = "foo";
var cookie_value = "bar";
var cookie_path = "/some/valid/path";
// does not work in IE6
$.cookie(cookie_name, cookie_value, {path: cookie_path});
// works in IE6
$.cookie(cookie_name, cookie_value);
Was not tested with any other version of IE. Worked as expected in later versions of Firefox and Chrome that I had installed.
Wasn't sure if this warranted a bug report (yes, I have to target IE6) so I figured I just drop it here. Maybe move it to my blog at some point.


Revision [2293]

Edited on 2012-09-07 16:19:13 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Euler #9 in Ruby**
http://projecteuler.net/problem=9
http://projecteuler.net/problem=9
A Pythagorean triplet is a set of three natural numbers, a < b < c,
for which,
a2 + b2 = c2
For example, 32 + 42 = 9 + 16 = 25 = 52.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
sum = 3 + 4 + 5
expected = 3 * 4 * 5
a, b, c = find_first_triplet(sum)
product = a * b * c
raise "%s != expected %s" % [product , expected] unless product == expected
sum = 1000
a, b, c = find_first_triplet(sum)
puts "a, b, c: %d, %d, %d" % [a,b,c]
a * b * c
def find_first_triplet(sum)
a = get_max_a(sum)
b, c = 0, 0
while a > 0
b = a + 1
c = sum - (a + b)
while b < c:
c = sum - (a + b)
if is_pythagorean(a, b, c)
return a, b, c
end
b += 1
a -=1
def is_pythagorean(a, b, c)
a**2 + b**2 == c**2
def get_max_a(abc_sum)
mean = abc_sum / 3
c = mean
b = c - 1
a = c - 2
deque = [c, b, a]
while deque.inject{|sum,x| sum + x } < abc_sum
n = deque.shift
deque.push(n)
deque.min
# Test Code
def test_get_max_a
cases = [
[1000, 332],
[12, 3]
]
cases.each do |abc_sum, expected|
a_max = get_max_a(abc_sum)
raise "%s != expected %s" % [a_max , expected] unless a_max == expected
puts "test_get_max_a successful"
test_get_max_a


Revision [2290]

Edited on 2012-09-06 12:36:02 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Euler #7 in Ruby**
http://projecteuler.net/problem=7
%%(ruby)
=begin
http://projecteuler.net/problem=7
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see
that the 6th prime is 13.
What is the 10 001st prime number?
=end
# Test Case / Solution
def test_case
index = 6
expected = 13
prime = get_prime_number(index)
raise "%s != expected %s" % [prime, expected] unless prime == expected
puts "test case successful"
end
def solution
index = 10001
get_prime_number(index)
end
# Support Code
#
def get_prime_number(index)
at = 0
last_prime = 1
while at < index:
last_prime = get_next_prime(last_prime)
at += 1
#puts at
end
return last_prime
end
def get_next_prime(last_prime)
found = false
n = last_prime
while ! found
n += 1
if is_prime(n)
found = true
end
end
return n
end
def is_prime(number)
limit = number / 2
2.upto(limit) do |n|
if number % n == 0
return false
end
end
true
end
def erosthanes_incremental_sieve(limit)
# http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#Incremental_sieve
lower = 2
batch_size = 1000
primes = []
while primes.length < limit
upper = lower + batch_size
sieved = erosthanes_sieve(lower, upper, primes)
primes += sieved
lower = upper
end
primes[limit]
end
def erosthanes_sieve(lower, upper, primes)
# an exercise for the reader
end
test_case
puts solution


Revision [2275]

Edited on 2012-08-29 11:14:18 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Python Sorting Problem**
see Pastebin20120829


Revision [2269]

Edited on 2012-08-23 20:37:21 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- The Issue
~~- [[https://groups.google.com/forum/?fromgroups=#!topic/google-analytics-data-export-api/lNsR-pA76xc https://groups.google.com]]


Revision [2268]

Edited on 2012-08-23 08:31:24 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Google APIs Client Library for Python**
~- http://code.google.com/p/google-api-python-client/
~- http://stackoverflow.com/questions/5056719/
~- http://stackoverflow.com/questions/6011272/


Revision [2258]

Edited on 2012-08-21 10:55:44 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Fabric DB Backup**
from fabric.api import env, settings, run, local, get, put, lcd
from fabric.contrib.files import exists as remote_file_exists
from os.path import exists as local_file_exists, join as pathjoin
# Globals
DB_NAME = "klenwell"
DUMP_FILE = "%s-db.bz2" % (DB_NAME)
DUMP_PATH = pathjoin("/tmp", DUMP_FILE)
LOCAL_DEST = "/home/klenwell/hg/klenwell/data"
env.roledefs = {
'local': ['localhost'],
'remote': ['root@dbserver']
}

# Commands
def backup():
mysql_dump_db()
transfer_backup_file()
save_to_repository()
cleanup()
def test_host():
echo("running `hostname -f` on host %s" % (env.host), 3)
run("hostname -f")
# Tasks
def mysql_dump_db():
cmd_f = "mysqldump %(db_name)s | bzip2 > %(dump_path)s"
run(cmd_f % dict(db_name=DB_NAME, dump_path=DUMP_PATH))
assert remote_file_exists(DUMP_PATH), "dumped sql file not found"
def transfer_backup_file():
get(DUMP_PATH, LOCAL_DEST)
assert local_file_exists(pathjoin(LOCAL_DEST, DUMP_FILE))
def save_to_repository():
with lcd(LOCAL_DEST):
local("hg commit -m 'backing up wiki db'")
local("hg push")
def cleanup():
pass


Revision [2256]

Edited on 2012-08-21 08:27:59 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
WikkaUpgradeCore
Deletions:
How do I securely upgrade a live Wikka Wiki site?
Wikka wiki include a web-based upgrade script. However, this script exposes the upgrade form to any visitor while the site is upgrading. How can I upgrade my live public wiki site as an admin without exposing the upgrade form to other non-admin visitors?
Steps:
1. Backup database and current wiki directory.
2. Add plain text file name locked to your wiki directory with a temporary (plaintext) password on first line.
3. Download latest version of Wikka Wiki source and copy into wiki directory.
3a. Search/Replace TYPE with ENGINE in setup/install.php to avoid this bug
4. Proceed with upgrade by visiting site in browser. You'll be prompted with a basic auth login prompt. Enter admin for user name and password in locked file.
5. Removed locked file


Revision [2253]

Edited on 2012-08-20 15:46:19 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
How do I securely upgrade a live Wikka Wiki site?
Steps:
Deletions:
~- How do I securely upgrade a live Wikka Wiki site?
~- Steps


Revision [2252]

Edited on 2012-08-20 15:46:01 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- How do I securely upgrade a live Wikka Wiki site?
~- Steps
Deletions:
**How do I securely upgrade a live Wikka Wiki site?**


Revision [2251]

Edited on 2012-08-20 15:45:14 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Wikka Upgrade**
**How do I securely upgrade a live Wikka Wiki site?**
Wikka wiki include a web-based upgrade script. However, this script exposes the upgrade form to any visitor while the site is upgrading. How can I upgrade my live public wiki site as an admin without exposing the upgrade form to other non-admin visitors?
1. Backup database and current wiki directory.
2. Add plain text file name locked to your wiki directory with a temporary (plaintext) password on first line.
3. Download latest version of Wikka Wiki source and copy into wiki directory.
3a. Search/Replace TYPE with ENGINE in setup/install.php to avoid this bug
4. Proceed with upgrade by visiting site in browser. You'll be prompted with a basic auth login prompt. Enter admin for user name and password in locked file.
5. Removed locked file


Revision [2240]

Edited on 2012-08-03 20:36:08 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**WorkFlowy**
https://workflowy.com/shared/82012321-4ce7-c039-6593-b0c5abf976f4/


Revision [2239]

Edited on 2012-08-01 12:12:33 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
Replaces UserSettingsRecaptcha
Deletions:
~- Replaces UserSettingsRecaptcha


Revision [2238]

Edited on 2012-08-01 12:12:21 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- Replaces UserSettingsRecaptcha
Deletions:
~- Add following to UserSettings page:
{{RegistrationRecaptcha}}
{{UserSettings}}
{{nocomments}}
~- Save [[http://code.google.com/p/recaptcha/source/browse/trunk/recaptcha-plugins/php/recaptchalib.php recaptchalib.php]] to: ""<tt>3rdparty/plugins/recaptcha/registrationrecaptcha.php</tt>""
~- Save this file to: ""<tt>plugins/actions/registrationrecaptcha/registrationrecaptcha.php</tt>""
%%(php)
<?php
/**
* registrationrecaptcha.php
* Test extension of user settings action
*
* References
* http://klenwell.com/is/WikkaBaseActionClass
*
* @package Action
* @author Tom Atwell <klenwell@gmail.com>
* @copyright Copyright 2012, Tom Atwell <klenwell@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
*/
require_once 'libs/action.class.php';
require_once 'libs/userregistration.class.php';
class RegistrationRecaptchaAction extends WikkaAction {
var $version = '0.1.20120731';
# parameter defaults
var $password_min_length = 5;
var $valid_email_pattern = '/^.+?\@.+?\..+$/';
# requests
var $new_user_is_registering = FALSE;
var $user_has_confirmed = FALSE;
# user interface
var $button_recaptcha = 'Submit ReCAPTCHA';
# other
var $UserAuth = NULL;
function main()
{
$this->action_set_up();
# request tree
if ( $this->new_user_is_registering ) {
return $this->challenge_with_recaptcha();
elseif ( $this->has_submitted_recaptcha ) {
$RecaptchaResponse = $this->validate_recaptcha();

if ( $RecaptchaResponse->is_valid ) {
return $this->complete_registration();
}
else {
return $this->show_recaptcha_form($RecaptchaResponse->error);
}
else {
return $this->html_comment("skipping");
}
function action_set_up()
{
$this->UserAuth = new URAuth($this->Wikka);
# these values are set in usersettings -- not sure if they're
# available here, but let's try
if ( defined('PASSWORD_MIN_LENGTH') ) {
$this->password_min_length = PASSWORD_MIN_LENGTH;
if ( defined('VALID_EMAIL_PATTERN') ) {
$this->valid_email_pattern = VALID_EMAIL_PATTERN;
# request tree
$this->new_user_is_registering =
($this->Wikka->GetSafeVar('submit', 'post') == T_("Register"))
&& $this->get_config('allow_user_registration');

$this->has_submitted_recaptcha =
$this->Wikka->GetSafeVar('recaptcha_submit', 'post') == $this->button_recaptcha
&& $this->get_config('allow_user_registration');
}
function challenge_with_recaptcha() {
# if registration is not valid, let post pass so that
# usersettings plugin will display proper warning
if ( !$this->is_valid_registration() ) {
return $this->html_comment("invalid registration form");
else {
$this->intercept_registration();
return $this->show_recaptcha_form();
}
function is_valid_registration() {
# this is effectively lifted from usersettings.php. Very un-DRY.
$name = trim($this->Wikka->GetSafeVar('name', 'post'));
$email = trim($this->Wikka->GetSafeVar('email', 'post'));
$password = $this->Wikka->GetSafeVar('password', 'post');
$confpassword = $this->Wikka->GetSafeVar('confpassword', 'post');
// validate input
switch(TRUE) {
case (FALSE===$this->UserAuth->URAuthVerify()):
case (isset($_POST['name']) && TRUE === $this->Wikka->existsUser(
$this->Wikka->GetSafeVar('name', 'post'))):
case (strlen($name) == 0):
case (!$this->Wikka->IsWikiName($name)):
case ($this->Wikka->ExistsPage($name)):
case (strlen($password) == 0):
case (preg_match("/ /", $password)):
case (strlen($password) < $this->password_min_length):
case (strlen($confpassword) == 0):
case ($confpassword != $password):
case (strlen($email) == 0):
case (!preg_match($this->valid_email_pattern, $email)):
return FALSE;
default:
return TRUE;
}
function validate_recaptcha() {
require_once('3rdparty/plugins/recaptcha/recaptchalib.php');
$RecaptchaResponse = recaptcha_check_answer(
$this->Wikka->GetConfigValue('rc_private_key'),
$_SERVER['REMOTE_ADDR'],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]
);
return $RecaptchaResponse;
}
function complete_registration() {
$this->unintercept_registration();
return $this->html_comment("completing registration");
}
function intercept_registration() {
$_SESSION['reg_intercept'] = $_POST;
$_POST['submit'] = NULL;
}
function unintercept_registration() {
$_POST = $_SESSION['reg_intercept'];
$_SESSION['reg_intercept'] = NULL;
}
function show_recaptcha_form($error=NULL) {
require_once('3rdparty/plugins/recaptcha/recaptchalib.php');
$public_key = $this->Wikka->GetConfigValue('rc_public_key');
$htmlf = <<<XHTML
<h5>To deter bots and spammers, please complete this ReCAPTCHA challenge</h5>
<div class="recaptcha">
%s
%s
<input name="recaptcha_submit" type="submit" value="{$this->button_recaptcha}" />
%s
</div>
XHTML;
$recaptcha_form = sprintf( $htmlf,
$this->Wikka->FormOpen(),
recaptcha_get_html($public_key, $error),
$this->Wikka->FormClose()
);
return $recaptcha_form;
}
function output($content) {
print $content;
}
function html_comment($comment) {
return sprintf("\n\n<!-- RegistrationRecaptcha: %s -->\n\n", $comment);
}
}
# Main Routine
try {
$Action = new RegistrationRecaptchaAction($this, $vars);
$content = $Action->main();
$Action->output($content);
}
catch(Exception $e) {
printf('<em class="error">%s</em>', $e->getMessage());
}


Revision [2226]

Edited on 2012-07-31 18:52:13 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- Save [[http://code.google.com/p/recaptcha/source/browse/trunk/recaptcha-plugins/php/recaptchalib.php recaptchalib.php]] to: ""<tt>3rdparty/plugins/recaptcha/registrationrecaptcha.php</tt>""
Deletions:
~- Save [[[[http://code.google.com/p/recaptcha/source/browse/trunk/recaptcha-plugins/php/recaptchalib.php recaptchalib.php]] to: ""<tt>3rdparty/plugins/recaptcha/registrationrecaptcha.php</tt>""


Revision [2225]

Edited on 2012-07-31 18:51:59 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**WikkaRegistrationRecaptcha**
Deletions:
**RegistrationRecaptcha**


Revision [2223]

Edited on 2012-07-31 16:07:44 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- Save this file to: ""<tt>plugins/actions/registrationrecaptcha/registrationrecaptcha.php</tt>""
Deletions:
Save this file to: ""<tt>plugins/actions/registrationrecaptcha/registrationrecaptcha.php</tt>""


Revision [2222]

Edited on 2012-07-31 16:00:49 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
~- Add following to UserSettings page:
~- Save [[[[http://code.google.com/p/recaptcha/source/browse/trunk/recaptcha-plugins/php/recaptchalib.php recaptchalib.php]] to: ""<tt>3rdparty/plugins/recaptcha/registrationrecaptcha.php</tt>""
Deletions:
Add following to UserSettings page:


Revision [2220]

Edited on 2012-07-31 15:55:49 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**RegistrationRecaptcha**
{{RegistrationRecaptcha}}
Save this file to: ""<tt>plugins/actions/registrationrecaptcha/registrationrecaptcha.php</tt>""
* registrationrecaptcha.php
class RegistrationRecaptchaAction extends WikkaAction {
return sprintf("\n\n<!-- RegistrationRecaptcha: %s -->\n\n", $comment);
$Action = new RegistrationRecaptchaAction($this, $vars);
Deletions:
**RegistrationCaptcha**
{{RegistrationCaptcha}}
Save this file to: ""<tt>plugins/actions/registrationcaptcha/registrationcaptcha.php</tt>""
* registrationcaptcha.php
class RegistrationCaptchaAction extends WikkaAction {
return sprintf("\n\n<!-- RegistrationCaptcha: %s -->\n\n", $comment);
$Action = new RegistrationCaptchaAction($this, $vars);


Revision [2219]

Edited on 2012-07-31 15:47:34 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**RegistrationCaptcha**
Add following to UserSettings page:
{{RegistrationCaptcha}}
{{UserSettings}}
{{nocomments}}
Save this file to: ""<tt>plugins/actions/registrationcaptcha/registrationcaptcha.php</tt>""
%%(php)
<?php
/**
* registrationcaptcha.php
* Test extension of user settings action
*
* References
* http://klenwell.com/is/WikkaBaseActionClass
*
* @package Action
* @author Tom Atwell <klenwell@gmail.com>
* @copyright Copyright 2012, Tom Atwell <klenwell@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
*/
require_once 'libs/action.class.php';
require_once 'libs/userregistration.class.php';
class RegistrationCaptchaAction extends WikkaAction {
var $version = '0.1.20120731';
# parameter defaults
var $password_min_length = 5;
var $valid_email_pattern = '/^.+?\@.+?\..+$/';
# requests
var $new_user_is_registering = FALSE;
var $user_has_confirmed = FALSE;
# user interface
var $button_recaptcha = 'Submit ReCAPTCHA';
# other
var $UserAuth = NULL;
function main()
{
$this->action_set_up();
# request tree
if ( $this->new_user_is_registering ) {
return $this->challenge_with_recaptcha();
elseif ( $this->has_submitted_recaptcha ) {
$RecaptchaResponse = $this->validate_recaptcha();

if ( $RecaptchaResponse->is_valid ) {
return $this->complete_registration();
}
else {
return $this->show_recaptcha_form($RecaptchaResponse->error);
}
else {
return $this->html_comment("skipping");
}
function action_set_up()
{
$this->UserAuth = new URAuth($this->Wikka);
# these values are set in usersettings -- not sure if they're
# available here, but let's try
if ( defined('PASSWORD_MIN_LENGTH') ) {
$this->password_min_length = PASSWORD_MIN_LENGTH;
if ( defined('VALID_EMAIL_PATTERN') ) {
$this->valid_email_pattern = VALID_EMAIL_PATTERN;
# request tree
$this->new_user_is_registering =
($this->Wikka->GetSafeVar('submit', 'post') == T_("Register"))
&& $this->get_config('allow_user_registration');

$this->has_submitted_recaptcha =
$this->Wikka->GetSafeVar('recaptcha_submit', 'post') == $this->button_recaptcha
&& $this->get_config('allow_user_registration');
}
function challenge_with_recaptcha() {
# if registration is not valid, let post pass so that
# usersettings plugin will display proper warning
if ( !$this->is_valid_registration() ) {
return $this->html_comment("invalid registration form");
else {
$this->intercept_registration();
return $this->show_recaptcha_form();
}
function is_valid_registration() {
# this is effectively lifted from usersettings.php. Very un-DRY.
$name = trim($this->Wikka->GetSafeVar('name', 'post'));
$email = trim($this->Wikka->GetSafeVar('email', 'post'));
$password = $this->Wikka->GetSafeVar('password', 'post');
$confpassword = $this->Wikka->GetSafeVar('confpassword', 'post');
// validate input
switch(TRUE) {
case (FALSE===$this->UserAuth->URAuthVerify()):
case (isset($_POST['name']) && TRUE === $this->Wikka->existsUser(
$this->Wikka->GetSafeVar('name', 'post'))):
case (strlen($name) == 0):
case (!$this->Wikka->IsWikiName($name)):
case ($this->Wikka->ExistsPage($name)):
case (strlen($password) == 0):
case (preg_match("/ /", $password)):
case (strlen($password) < $this->password_min_length):
case (strlen($confpassword) == 0):
case ($confpassword != $password):
case (strlen($email) == 0):
case (!preg_match($this->valid_email_pattern, $email)):
return FALSE;
default:
return TRUE;
}
function validate_recaptcha() {
require_once('3rdparty/plugins/recaptcha/recaptchalib.php');
$RecaptchaResponse = recaptcha_check_answer(
$this->Wikka->GetConfigValue('rc_private_key'),
$_SERVER['REMOTE_ADDR'],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]
);
return $RecaptchaResponse;
}
function complete_registration() {
$this->unintercept_registration();
return $this->html_comment("completing registration");
}
function intercept_registration() {
$_SESSION['reg_intercept'] = $_POST;
$_POST['submit'] = NULL;
}
function unintercept_registration() {
$_POST = $_SESSION['reg_intercept'];
$_SESSION['reg_intercept'] = NULL;
}
function show_recaptcha_form($error=NULL) {
require_once('3rdparty/plugins/recaptcha/recaptchalib.php');
$public_key = $this->Wikka->GetConfigValue('rc_public_key');
$htmlf = <<<XHTML
<h5>To deter bots and spammers, please complete this ReCAPTCHA challenge</h5>
<div class="recaptcha">
%s
%s
<input name="recaptcha_submit" type="submit" value="{$this->button_recaptcha}" />
%s
</div>
XHTML;
$recaptcha_form = sprintf( $htmlf,
$this->Wikka->FormOpen(),
recaptcha_get_html($public_key, $error),
$this->Wikka->FormClose()
);
return $recaptcha_form;
}
function output($content) {
print $content;
}
function html_comment($comment) {
return sprintf("\n\n<!-- RegistrationCaptcha: %s -->\n\n", $comment);
}
}
# Main Routine
try {
$Action = new RegistrationCaptchaAction($this, $vars);
$content = $Action->main();
$Action->output($content);
}
catch(Exception $e) {
printf('<em class="error">%s</em>', $e->getMessage());
}


Revision [2215]

Edited on 2012-07-24 12:36:55 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
%%(html)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>webfont example</title>
<!-- Google AJAX Libraries API -->
<script src="http://www.google.com/jsapi"></script>
<script>
google.load("jquery", "1.4.2");
google.load("webfont", "1");

WebFontConfig = {
google: {
families: [ 'Droid+Sans::latin' ]
},
loading: function() {
$("#status").text("loading fonts");
},
fontloading: function(DroidSans, n) {
$("#status").text("loading Droid Sans font");
$("#target").text("sans-serif");
},
fontactive: function(DroidSans, n) {
$("#status").text("Droid Sans is active");
$("#target").text("Droid Sans");
},
fontinactive: function(DroidSans, n) {
$("#status").text("Droid Sans is inactive");
}
};
google.setOnLoadCallback(function() {
WebFont.load(WebFontConfig);
});
</script>
<style type="text/css">
.wf-loading h1 {
font-family: sans-serif;
font-style:italic;
color: #999;
font-size: 16px;
}
.wf-inactive h1 {
font-family: sans-serif;
color:red;
font-size: 20px;
}
.wf-active h1 {
font-family: 'Droid Sans', sans-serif;
color:green;
font-size: 24px;
}
</style>
</head>
<body>
<h1 id="target">a web-load font</h1>
<pre>status: <span id="status">init</span></pre>
</body>
</html>


Revision [2214]

Edited on 2012-07-24 09:29:42 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]

No Differences

Revision [2213]

Edited on 2012-07-24 09:29:24 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**Font Ready (JS / PlayN)**
[[http://stackoverflow.com/questions/11602718/in-the-html-version-of-my-playn-game-how-can-i-reliably-load-fonts-so-text-disp The Problem]]
Solutions?
http://stackoverflow.com/a/6678869/1093087
https://developers.google.com/webfonts/docs/webfont_loader
Deletions:
FetchTest


Revision [2202]

Edited on 2012-07-08 19:18:28 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
FetchTest


Revision [2194]

Edited on 2012-07-06 10:38:41 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]
Additions:
**New Yorker Digital**
To switch from print to digital version of New Yorker, call 800-873-8201


Revision [2189]

Edited on 2012-06-20 08:25:45 by KlenwellAdmin [Replaces old-style internal links with new pipe-split links.]

No Differences

Revision [2188]

Edited on 2012-06-20 08:25:16 by KlenwellAdmin [adds vision radius example]
Additions:
**Vision Radius**
visionRadius = r.radius + (court.radius * r.vision / 100.0)
focusPt = r.pt
maxScore = 0
for pt in visionRadiusPts:
if not pt in court:
continue
score = getScore(pt)
if score > maxScore:
maxScore = score
focusPt = pt
return focusPt


Revision [2183]

Edited on 2012-06-19 12:38:58 by KlenwellAdmin [adds lazy sampling]
Additions:
**Lazy Sampling**
import random, time, math
def get_options(num):
return list(range(num))
def sort_options(options):
return sorted(options, reverse=True)

def select_opt(options, skill):
prob = skill / 100.0
sampled_opts = []
for o in options:
if random.random() < prob:
sampled_opts.append(o)
if len(sampled_opts) > 10:
break
return random.choice(sampled_opts[:10])
def select_old(options, skill):
size = int(round(1.0 * (len(options) * skill / 100.0)))
opts = random.sample(options, size)
opts = sorted(opts, reverse=True)
return random.choice(opts[:10])
def selecti(options, skill):
limit = (100 - skill) * 10
sp = skill / 100.0
prob = sp
sampled_opts = []
for o in options:
if random.random() < prob:
sampled_opts.append(o)
if len(sampled_opts) > limit:
break
return random.choice(sampled_opts)

def sim(f, skill=50):
runs = 1000
options = sort_options(get_options(1000))
selections = []
for n in range(runs):
selected = f(options, skill)
selections.append(selected)
avg_selection = 1.0 * sum(selections) / len(selections)
print """
skill: %d
avg: %.2f
max: %d
min: %d""" % (skill, avg_selection, max(selections), min(selections))
if __name__ == "__main__":
sim(selecti,99)
sim(selecti,66)
sim(selecti,33)
skill = 75
s0 = time.time()
sim(select_old,skill)
s1 = time.time() - s0
print "old complete: %0.5fs" % (s1)
s0 = time.time()
sim(select_opt,skill)
s2 = time.time() - s0
opt = s1 / s2
print "opt complete: %0.5fs (%.1fx as fast)" % (s2, opt)
s0 = time.time()
sim(selecti,skill)
s3 = time.time() - s0
opt = s1 / s3
print "i complete: %0.5fs (%.1fx as fast)" % (s3, opt)


Revision [2162]

Edited on 2012-05-11 11:21:16 by KlenwellAdmin [adds lazy sampling]
Additions:
**String Data Structures (for when your JSON lib is a PITA)**
)( - 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d
][ - 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d ][ 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d ][ 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d
}{ - 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d ][ 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d ][ 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d }{ 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d ][ 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d ][ 1:a,b,c,d )( 2:a,b,c,d )( 3:a-b-c-d


Revision [2161]

Edited on 2012-05-06 16:43:36 by KlenwellAdmin [adds lazy sampling]
Additions:
**init not found try passing init=bootargs**
~- On Asus EEE Netbook
~- To Fix
~~- Insert Ubuntu thumbdrive (on keychain)
~~- Reboot > Press ESC until you get Boot Menu
~~- Run without Installing
~~- See this post: http://askubuntu.com/a/73983/46766


Revision [2160]

Edited on 2012-04-24 11:27:40 by KlenwellAdmin [adds lazy sampling]
Additions:
**atta dict!**
ref: http://news.ycombinator.com/item?id=3881341
from collections import defaultdict
from pprint import pprint
class attrdict(defaultdict):
def __getattr__(self, key): return self[key]
def __setattr__(self, key, val): self[key]=val
def tree(): return attrdict(tree)
ca = tree()
ca.orange.santa_ana = 92704
ca.orange.anaheim = 92807
pprint(ca)
pdb.set_trace()


Revision [2159]

Edited on 2012-04-22 23:30:44 by KlenwellAdmin [adds lazy sampling]
Additions:
**matplotlib custom color sequence**
A series of circle with custom colormap (red to green)
python .dev/colormap.py
REFERENCES:
http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.patches.Circle
http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps
http://stackoverflow.com/questions/9215658/plot-a-circle-with-pyplot
http://stackoverflow.com/a/9544600/1093087
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from matplotlib import cm
from numpy import arange
import math
SOLID = 'solid'
GREY = (.75,.75,.75)
clamp = lambda v: min(max(0, v), 1)
def main():
# simulate a smartphone
h, w = 15.0/8.0, 51.0/16.0
hpx, wpx = 480.0, 800.0
dpi = math.sqrt(hpx*wpx) / math.sqrt(h*w)
# or my laptop
lhpx, lwpx = 1600.0, 900.0
lhw = 17.3
ldpi = math.sqrt(lhpx*lwpx) / math.sqrt(lhw)
# set up color map
colors = cm.gist_rainbow(arange(200))
rg_map = ListedColormap(colors[:100], 'red-green')
colors = rg_map.colors
# circle params
minR, maxR = 4,8
x,y = 2,0
# build image
fig = plt.Figure(figsize=(w,h), dpi=dpi)
for n in range(0,100,3):
radius = minR + ((maxR-minR) * (n/100.0))
x += maxR
pt = (x,y)
x += maxR + 4
r = clamp(1 - (.66*n / 100.0))
g = clamp(0 + (1.0*n / 100.0))
b = 0
# alternately, using a colormap
#ci = math.floor((n/100.0)*len(colors))
#rgba = colors[ci]
#r,g,b = map(lambda n: int(round(n*255)), [v for v in rgba[:3]])
# circle and edge
c = plt.Circle(pt, radius, color=(r,g,b))
o = plt.Circle(pt, maxR, fill=False, lw=1, ls=SOLID, edgecolor=GREY)
plt.axes().add_artist(c)
plt.axes().add_artist(o)
print (pt, radius), (r,g,b)
# label a few
if (n/3) % 11 == 0:
rv,gv,bv = map(lambda n: int(round(n*255)), [v for v in (r,g,b)])
label = 'RGB: (%d,%d,%d)' % (rv,gv,bv)
plt.axes().annotate(label, (x-radius, n+minR+12), size=12)
plt.axes().set_xlim((0,wpx), auto=False)
plt.axes().set_ylim((-hpx/2,hpx/2), auto=False)
plt.axes().set_aspect('equal')
plt.show()
def example():
"""source: http://stackoverflow.com/a/9216646/1093087"""
circle1=plt.Circle((0,0),.2,color='r')
circle2=plt.Circle((.5,.5),.2,color='b')
circle3=plt.Circle((1,1),.2,color='g',clip_on=False)
fig = plt.gcf()
fig.gca().add_artist(circle1)
fig.gca().add_artist(circle2)
fig.gca().add_artist(circle3)
plt.show()
main()


Revision [2153]

Edited on 2012-04-11 12:17:30 by KlenwellAdmin [adds lazy sampling]
Additions:
USAGE
$ venv/bin/python dev/gyro/tests/dev/proto.py
http://docs.python-requests.org/en/latest/user/quickstart/#make-a-get-request
import unittest, sys, os, time
def testLastPageGoogleNoOmissions(self):
url = "http://www.google.com/search"
query = "hello world"
start_at = 990
#
# REQUESTS
#
# prepare
payload = dict(
q = query,
hl = "en",
start = start_at,
filter = 0
)
# get
site = requests.get(url, params=payload)
raw = site.content
# test
needle = "to show you the most relevant results"
self.assertFalse(needle in raw)
self.assertTrue("Page 100" in raw)
#
# SOUP
#
# parser
results_block = html.findAll("li", { "class" : "g" })
last_result = results_block[-1]
# parse last result
links = last_result.findAll("a")
result_link = links[0].get("href")
result_url = result_link.split('/url?q=')[1].split('&')[0]
print result_url
# test request
self.assertTrue(results_block)
# interact
time.sleep(2)
def testLastPageGoogleOmitted(self):
url = "http://www.google.com/search"
query = "python language"
start_at = 990
#
# REQUESTS
#
# prepare
payload = dict(
q = query,
hl = "en",
start = start_at
)
# get
site = requests.get(url, params=payload)
raw = site.content
# test
needle = "to show you the most relevant results"
self.assertTrue(needle in raw)
#
# SOUP
#
# parser
results_block = html.findAll("li", { "class" : "g" })
last_result = results_block[-1]
# parse last result
links = last_result.findAll("a")
result_link = links[0].get("href")
result_url = result_link.split('/url?q=')[1].split('&')[0]
print result_url
# test request
self.assertTrue(results_block)
# interact
#import pdb; pdb.set_trace()
# don't arouse suspicion
time.sleep(2)
url = "http://localhost/wikka/Gyro"
url = "http://localhost/wikka/Gyro"
Deletions:
import unittest, sys, os
url = "http://mywiki/wikka/Gyro"
url = "http://mywiki/wikka/Gyro"


Revision [2151]

Edited on 2012-04-06 12:33:30 by KlenwellAdmin [adds lazy sampling]
Additions:
**Soup Request Test**
#!/usr/bin/python
proto.py
PURPOSE
Prototyping gyro (requests experiment).

NOTES
Uses requests, beautifulsoup
http://www.crummy.com/software/BeautifulSoup/bs3/documentation.html#Quick%20Start
#
# IMPORTS
#
# Python Imports
import unittest, sys, os
from os.path import (abspath, dirname, join as pathjoin, exists)
from datetime import(datetime, date, timedelta)
from random import (choice, sample)
import pdb
import re
# External Imports
import requests
from BeautifulSoup import BeautifulSoup as soup, Tag, NavigableString
# Extend sys.path
PROJECT_PATH = abspath(pathjoin(dirname(__file__), '../..'))
# Project Imports
#
# MODULE PARAMETERS
#
# Exception Classes
class NullException(Exception): pass
#
# Test Class
#
class PrototypeTest(unittest.TestCase):

data_dir = pathjoin(PROJECT_PATH, 'test/data')

#
# Harness
#
def setUp(self):
pass

def tearDown(self):
pass

#
# New Methods
#



#
# Unit Tests
#



#
# Dev Tests
#
def testBeautifulSoup(self):
"""parse my special wiki page"""
url = "http://mywiki/wikka/Gyro"
site = requests.get(url)
html = soup(site.content)

# these work
haystack = html.find("h3", { "id" : "hn_Haystack" })
needle = html.find(text=re.compile('a beautiful needle'))

# these don't work
nostack = html.find("h4", { "id" : "hn_Haystack" }) # wrong tag
noneedle = html.findAll(text="a beautiful needle")

self.assertEqual(type(haystack), Tag)
self.assertEqual(type(needle), NavigableString)
self.assertFalse(nostack)
self.assertFalse(noneedle)
self.assertTrue("a beautiful needle" in str(html))
self.assertTrue("a beautiful needle" in str(needle))


def testRequests(self):
"""pull my wiki"""
url = "http://mywiki/wikka/Gyro"
site = requests.get(url)
self.assertTrue(site.ok)
self.assertTrue("a beautiful needle" in site.content)


#
# Smoke Tests
#
def testInstance(self):
self.assertTrue(isinstance(self, unittest.TestCase))
#
# Main
#
if __name__ == "__main__":
mod = sys.modules[globals()['__name__']]
suite = unittest.TestLoader().loadTestsFromModule(mod)
unittest.TextTestRunner(verbosity=2).run(suite)


Revision [2150]

Edited on 2012-03-29 11:44:38 by KlenwellAdmin [adds lazy sampling]
Additions:
**Programming Collective Intelligence**
Source code: http://blog.kiwitobes.com/?p=44


Revision [2149]

Edited on 2012-03-28 12:24:19 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://mirnazim.org/writings/python-ecosystem-introduction/ mirnazim.org]]
[[http://stackoverflow.com/questions/6431096/gevent-does-not-install-properly-on-ubuntu stackoverflow.com]]
[[https://groups.google.com/d/msg/gevent/GsRmocqmgN8/XUtWnIKJVHIJ groups.google.com]]
Deletions:
[[mirnazim.org http://mirnazim.org/writings/python-ecosystem-introduction/]]
[[stackoverflow.com http://stackoverflow.com/questions/6431096/gevent-does-not-install-properly-on-ubuntu]]
[[groups.google.com https://groups.google.com/d/msg/gevent/GsRmocqmgN8/XUtWnIKJVHIJ]]


Revision [2148]

Edited on 2012-03-28 12:23:50 by KlenwellAdmin [adds lazy sampling]
Additions:
[[mirnazim.org http://mirnazim.org/writings/python-ecosystem-introduction/]]
[[stackoverflow.com http://stackoverflow.com/questions/6431096/gevent-does-not-install-properly-on-ubuntu]]
[[groups.google.com https://groups.google.com/d/msg/gevent/GsRmocqmgN8/XUtWnIKJVHIJ]]
Deletions:
http://stackoverflow.com/questions/6431096/gevent-does-not-install-properly-on-ubuntu
https://groups.google.com/d/msg/gevent/GsRmocqmgN8/XUtWnIKJVHIJ


Revision [2147]

Edited on 2012-03-28 12:23:06 by KlenwellAdmin [adds lazy sampling]
Additions:
**Install gevent to virtualenv Directory**
http://stackoverflow.com/questions/6431096/gevent-does-not-install-properly-on-ubuntu
https://groups.google.com/d/msg/gevent/GsRmocqmgN8/XUtWnIKJVHIJ
# set up virtual env
# install gevent
sudo apt-get install libevent-dev
export C_INCLUDE_PATH=/usr/include:/usr/local/include:/opt/local/include
pip install greenlet
pip install gevent


Revision [2146]

Edited on 2012-03-21 11:46:49 by KlenwellAdmin [adds lazy sampling]

No Differences

Revision [2145]

Edited on 2012-03-21 11:46:36 by KlenwellAdmin [adds lazy sampling]
Additions:
**Python Temp Files**
Simple case:
import tempfile
...
temp_file_name = tempfile.NamedTemporaryFile().name
f = open(temp_file_name)
Write to temp file:
file_contents = """hello world"""
temp_file = tempfile.NamedTemporaryFile()
temp_file.write(file_contents)
temp_file.seek(0)
f = open(temp_file.name)


Revision [2140]

Edited on 2012-03-13 10:41:35 by KlenwellAdmin [adds lazy sampling]
Additions:
**Getting Setup with Virtualenv**
http://mirnazim.org/writings/python-ecosystem-introduction/
# Install pip and virtualenv
sudo apt-get install python-pip python-dev build-essential
sudo pip install pip --upgrade
sudo pip install virtualenv
# Setup a virtualenv
mkdir venv
virtualenv --distribute --no-site-packages venv
# Run from virtualenv
venv/bin/python
venv/bin/python myscript.py
# To activate/deactivate env
source bin/activate
(venv)$ deactivate


Revision [2130]

Edited on 2012-02-27 23:38:41 by KlenwellAdmin [adds lazy sampling]
Additions:
**Draw Circle to Canvas in PlayN**
Stack Overflow Question: http://stackoverflow.com/questions/9478065/


Revision [2124]

Edited on 2012-02-24 23:23:18 by KlenwellAdmin [adds lazy sampling]
Additions:
Solution: http://askubuntu.com/questions/49557#94341
Deletions:
Solution: http://askubuntu.com/questions/49557/94341


Revision [2123]

Edited on 2012-02-24 23:22:59 by KlenwellAdmin [adds lazy sampling]
Additions:
Solution: http://askubuntu.com/questions/49557/94341
Deletions:
Solution: http://askubuntu.com/questions/49557/how-do-i-install-maven-3/94341#94341


Revision [2122]

Edited on 2012-02-24 23:22:22 by KlenwellAdmin [adds lazy sampling]
Additions:
**GWT Plugin for Eclipse**
Problem: http://stackoverflow.com/questions/8363560
Solution: http://askubuntu.com/questions/49557/how-do-i-install-maven-3/94341#94341


Revision [2121]

Edited on 2012-02-24 09:54:20 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://stackoverflow.com/questions/6482268/eclipse-indigo-cannot-install-android-adt-plugin possible solution?]]


Revision [2120]

Edited on 2012-02-24 09:52:31 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://code.google.com/p/google-web-toolkit/issues/detail?id=6887 related?]]


Revision [2119]

Edited on 2012-02-23 23:03:22 by KlenwellAdmin [adds lazy sampling]
Additions:
http://stackoverflow.com/questions/9426715


Revision [2118]

Edited on 2012-02-23 21:44:43 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://askubuntu.com/questions/107192/how-can-i-install-eclipse-with-the-adt-android-development-tool-on-ubuntu-11-1 Ask Ubuntu]]


Revision [2116]

Edited on 2012-02-23 21:42:44 by KlenwellAdmin [adds lazy sampling]
Additions:
**Install Eclipse with ADT Plugin on Ubuntu 11.10**
Pastebin20120223


Revision [2115]

Edited on 2012-02-23 10:22:49 by KlenwellAdmin [adds lazy sampling]
Additions:
**""RdYlGn""**
Deletions:
RdYlGn


Revision [2114]

Edited on 2012-02-23 10:22:15 by KlenwellAdmin [adds lazy sampling]
Additions:
**Color Maps**
http://matplotlib.sourceforge.net/examples/api/colorbar_only.html
http://matplotlib.sourceforge.net/examples/pylab_examples/show_colormaps.html
RdYlGn


Revision [2099]

Edited on 2012-02-19 10:06:11 by KlenwellAdmin [adds lazy sampling]
Additions:
~- My Ubuntu Forum post on issue: [[http://ubuntuforums.org/showthread.php?p=11695329#post11695329 http://ubuntuforums.org/showthread.php?p=11695329#post11695329]]
~- ""AskUbuntu"" Post: http://askubuntu.com/questions/105651/
~~- [[Pastebin20120219 Draft of Response]]
Deletions:
My Ubuntu Forum post on issue: [[http://ubuntuforums.org/showthread.php?p=11695329#post11695329 http://ubuntuforums.org/showthread.php?p=11695329#post11695329]]
AskUbuntu Post: http://askubuntu.com/questions/105651/ [[Pastebin20120219 Draft Response]]


Revision [2098]

Edited on 2012-02-19 10:05:06 by KlenwellAdmin [adds lazy sampling]
Additions:
AskUbuntu Post: http://askubuntu.com/questions/105651/ [[Pastebin20120219 Draft Response]]


Revision [2097]

Edited on 2012-02-16 22:47:36 by KlenwellAdmin [adds lazy sampling]
Additions:
My Ubuntu Forum post on issue: [[http://ubuntuforums.org/showthread.php?p=11695329#post11695329 http://ubuntuforums.org/showthread.php?p=11695329#post11695329]]
Deletions:
My Ubuntu Forum post on issue: http://ubuntuforums.org/showthread.php?p=11695329#post11695329


Revision [2096]

Edited on 2012-02-16 22:47:15 by KlenwellAdmin [adds lazy sampling]
Additions:
My Ubuntu Forum post on issue: http://ubuntuforums.org/showthread.php?p=11695329#post11695329


Revision [2095]

Edited on 2012-02-16 22:24:26 by KlenwellAdmin [adds lazy sampling]
Additions:
~- On IRC chat, ludwin01 suggested 10.04 lts version did not have this problem. I'm working around it for now with grub flag.


Revision [2094]

Edited on 2012-02-16 22:23:16 by KlenwellAdmin [adds lazy sampling]
Additions:
~- After installation, need to follow direction for temporarily and then permanently modifying grub config with nomodeset flag. Hold down shift on boot to get to grub config.


Revision [2093]

Edited on 2012-02-16 21:10:46 by KlenwellAdmin [adds lazy sampling]
Additions:
**Installing Ubuntu 11.10 on [[http://www.google.com/products/catalog?hl=en&safe=off&q=HP+g7-1310us&gs_sm=12&gs_upl=1557545l1557545l6l1558924l1l1l0l0l0l0l146l146l0.1l2l0&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&biw=1168&bih=593&um=1&ie=UTF-8&tbm=shop&cid=16780769756561576303&sa=X&ei=g0Q7T9maHcmr2AWbm9m0Cg&ved=0CF0Q8wIwAg HP G71310US]]**
HP Pavilion g7-1310us Intel Core i3-2350M Notebook
Deletions:
**Installing Ubuntu 11.10 on [[http://www.google.com/products/catalog?hl=en&safe=off&q=HP+g7-1310us&gs_sm=12&gs_upl=1557545l1557545l6l1558924l1l1l0l0l0l0l146l146l0.1l2l0&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&biw=1168&bih=593&um=1&ie=UTF-8&tbm=shop&cid=16780769756561576303&sa=X&ei=g0Q7T9maHcmr2AWbm9m0Cg&ved=0CF0Q8wIwAg HP G71310US Intel Core i3-2350M Notebook]]**


Revision [2092]

Edited on 2012-02-16 20:55:12 by KlenwellAdmin [adds lazy sampling]
Additions:
**Installing Ubuntu 11.10 on [[http://www.google.com/products/catalog?hl=en&safe=off&q=HP+g7-1310us&gs_sm=12&gs_upl=1557545l1557545l6l1558924l1l1l0l0l0l0l146l146l0.1l2l0&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&biw=1168&bih=593&um=1&ie=UTF-8&tbm=shop&cid=16780769756561576303&sa=X&ei=g0Q7T9maHcmr2AWbm9m0Cg&ved=0CF0Q8wIwAg HP G71310US Intel Core i3-2350M Notebook]]**
Chose [[http://www.ubuntu.com/download/ubuntu/download Ubuntu 11.10 64-Bit]]
Needed to deal with black screen issue detailed [[http://ubuntuforums.org/showthread.php?t=1613132 here]]
~- See **How to enable kernel options on the livecd (before install)**
~- Choose nomodeset (x will appear next to it)
~- Then select Install Ubuntu


Revision [2090]

Edited on 2012-02-03 21:23:16 by KlenwellAdmin [adds lazy sampling]
Additions:
**Python Inheritance**
class Reveal(object):
def __repr__(self):
return "<%s %s>" % (self.__class__.__name__, self.__dict__)
class Yin(Reveal):
def __init__(self, yin=100):
self.yin = yin
self.lightness = True
self.darkness = False
self.balance = False
class Yan(Reveal):
def __init__(self, yan=100):
self.yan = yan
self.lightness = False
self.darkness = True
self.balance = False
class YinYan(Yin, Yan):
def __init__(self, yin, yan):
Yin.__init__(self, yin)
Yan.__init__(self, yan)
self.balance = True
yin = Yin(50)
yan = Yan(50)
yinyan = YinYan(50, 50)
print yin
print yan
print yinyan
# Prints
<Yin {'balance': False, 'yin': 50, 'lightness': True, 'darkness': False}>
<Yan {'balance': False, 'yan': 50, 'lightness': False, 'darkness': True}>
<YinYan {'balance': True, 'yin': 50, 'lightness': False, 'darkness': True, 'yan': 50}>


Revision [2085]

Edited on 2012-02-01 08:32:49 by KlenwellAdmin [adds lazy sampling]
Additions:
to = 'YOUR_RECEPIENT@some_domain.com'
Deletions:
to = 'klenwell@gmail.com'


Revision [2084]

Edited on 2012-01-31 21:47:47 by KlenwellAdmin [adds lazy sampling]
Additions:
**Send Email through Gmail with Python**
"""
Send an email programmatically through Gmail.
REFERENCES
http://snippets.dzone.com/posts/show/757
http://www.nixtutor.com/linux/send-mail-through-gmail-with-python/
http://stackoverflow.com/questions/399129/#comment8985407_399240
"""
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import COMMASPACE, formatdate
from email import Encoders
import os
from os.path import abspath, dirname, join
SMTP_SERVER = 'smtp.gmail.com:587'
SMTP_USER = 'USER@gmail.com'
SMTP_PASS = 'PASS'
EMAIL_FROM = 'USER <%s>' % (SMTP_USER)
def send_gmail(to, subject, text, files=[]):
assert type(to) == list
assert type(files) == list
from_ = EMAIL_FROM
msg = MIMEMultipart()
msg['From'] = EMAIL_FROM
msg['To'] = COMMASPACE.join(to)
msg['Date'] = formatdate(localtime=True)
msg['Subject'] = subject
msg.attach( MIMEText(text) )
for file in files:
part = MIMEBase('application', "octet-stream")
part.set_payload( open(file,"rb").read() )
Encoders.encode_base64(part)
part.add_header('Content-Disposition', 'attachment; filename="%s"'
% os.path.basename(file))
msg.attach(part)
smtp = smtplib.SMTP(SMTP_SERVER)
#smtp.set_debuglevel(1)
smtp.ehlo() # apparently this is required in python 2.5
smtp.starttls()
smtp.login(SMTP_USER, SMTP_PASS)
smtp.sendmail(from_, to, msg.as_string() )
smtp.close()
def test_email():
to = 'klenwell@gmail.com'
subject = "Python Gmail Test"
text = 'This is simply a test.'
send_gmail([to], subject, text)
print 'simple test complete'


Revision [2081]

Edited on 2012-01-28 09:45:03 by KlenwellAdmin [adds lazy sampling]

No Differences

Revision [2080]

Edited on 2012-01-28 09:44:32 by KlenwellAdmin [adds lazy sampling]
Additions:
**Method Decorator**
def check_some_flag(method):
def wrapper(self, *args, **kwargs):
if not self.some_flag:
raise Exception("some_flag not set")
else:
result = method(self, *args, **kwargs)
return result
return wrapper


Revision [2071]

Edited on 2012-01-24 08:36:20 by KlenwellAdmin [adds lazy sampling]
Additions:
%%(python)
>>> import numpy
>>> x = [1,50,99]
>>> y = [2,1,0.5]
>>> a,b,c = numpy.polyfit(x,y,2)
>>> f = lambda x: a*x**2 + b*x + c
>>> f(1)
2.0
>>> f(20)
1.5528946272386506
>>> f(50)
1.0000000000000002
>>> f(90)
0.55435235318617249
>>> f(100)
0.49500208246563937
>>> f(99)
0.5


Revision [2070]

Edited on 2012-01-24 08:03:21 by KlenwellAdmin [adds lazy sampling]
Additions:
[[https://www.google.com/search?hl=en&output=search&sclient=psy-ab&q=python+find+equation&btnK= python find roots of equation]]
Deletions:
[[https://www.google.com/?hl=en&q=python+find+equation python find roots of equation]]


Revision [2069]

Edited on 2012-01-24 07:28:08 by KlenwellAdmin [adds lazy sampling]
Additions:
**Find Equation for Set of Points**
[[https://www.google.com/?hl=en&q=python+find+equation python find roots of equation]]


Revision [2065]

Edited on 2012-01-17 14:14:53 by KlenwellAdmin [adds lazy sampling]
Additions:
Verizon Opt-Out Site: http://www.vzw.com/myprivacy


Revision [2064]

Edited on 2012-01-17 11:42:30 by KlenwellAdmin [adds lazy sampling]
Additions:
**Somewhat Improved Wikka Installer Routine**
Deletions:
**Somewhat Improved Wikka Installed Routined**


Revision [2063]

Edited on 2012-01-17 11:42:02 by KlenwellAdmin [adds lazy sampling]
Additions:
**Somewhat Improved Wikka Installed Routined**
**IKEA Stand-Up Desks**
Deletions:
++Somewhat Improved Wikka Installed Routined++
++IKEA Stand-Up Desks++


Revision [2062]

Edited on 2012-01-17 11:41:35 by KlenwellAdmin [adds lazy sampling]
Additions:
++Somewhat Improved Wikka Installed Routined++
Diff for wikka.php:
%%
diff -r c8f8537f5e21 -r 4e091af5eacf php/wikka/wikka.php
--- a/php/wikka/wikka.php Tue Jan 17 10:01:24 2012 -0800
+++ b/php/wikka/wikka.php Tue Jan 17 11:43:38 2012 -0800
@@ -509,11 +509,15 @@

/**
* Compare versions, start installer if necessary.
+ * Wait to start installer below if this is an upgrade so we can limit access
+ * to admin users.
*/
-if (!isset($wakkaConfig['wakka_version'])) $wakkaConfig['wakka_version'] = 0;
-if ($wakkaConfig['wakka_version'] !== WAKKA_VERSION)
-{
- /**
+$is_new_install = ! isset($wakkaConfig['wakka_version']);
+$is_upgrade = $wakkaConfig['wakka_version'] !== WAKKA_VERSION;
+
+if ( $is_new_install ) {
+ $wakkaConfig['wakka_version'] = 0;
+ /**
* Start installer.
*
* Data entered by the user is submitted in $_POST, next action for the
@@ -590,6 +594,7 @@
exit;
}

+
/**
* Save session ID
*/
@@ -611,6 +616,39 @@
}

/**
+ * Check for upgrade. If so an user is admin, show setup page, else show
+ * a maintenance message to all other visitors.
+ */
+$is_admin = $wakka->IsAdmin($user);
+$at_install_step = ($_GET['installAction'] == 'writeconfig') && (isset($_POST['config']));
+$upgrade_allowed = $is_admin || $at_install_step;
+
+if ( $is_upgrade && $upgrade_allowed ) {
+ $installAction = 'default';
+ if (isset($_GET['installAction'])) $installAction = trim($_GET['installAction']); #312
+ if (file_exists('setup'.DIRECTORY_SEPARATOR.'header.php'))
+ include('setup'.DIRECTORY_SEPARATOR.'header.php'); else print '<em class="error">'.ERROR_SETUP_HEADER_MISSING.'</em>'; #89
+ if
+ (file_exists('setup'.DIRECTORY_SEPARATOR.$installAction.'.php'))
+ include('setup'.DIRECTORY_SEPARATOR.$installAction.'.php'); else print '<em class="error">'.ERROR_SETUP_FILE_MISSING.'</em>'; #89
+ if (file_exists('setup'.DIRECTORY_SEPARATOR.'footer.php'))
+ include('setup'.DIRECTORY_SEPARATOR.'footer.php'); else print '<em class="error">'.ERROR_SETUP_FOOTER_MISSING.'</em>'; #89
+ exit;
+}
+elseif ( $is_upgrade && $_GET['install_help'] ) {
+ print "<h2> POST,GET, SESSION variables</h2>";
+ print '<pre>';
+ var_dump($_POST);
+ var_dump($_GET);
+ var_dump($_SESSION);
+ print '</pre>';
+}
+elseif ( $is_upgrade ) {
+ die('<h2>Site Undergoing Temporary Maintenance</h2><h4>Please check back shortly.</h4>');
+}
+
+
+/**
* Run the engine.
*/
if (!isset($handler)) $handler='';
%%
++IKEA Stand-Up Desks++
Deletions:
IKEA Stand-Up Desks


Revision [2025]

Edited on 2012-01-09 10:48:44 by KlenwellAdmin [adds lazy sampling]
Additions:
IKEA Stand-Up Desks
http://news.ycombinator.com/item?id=3442809
http://www.ikea.com/us/en/catalog/products/00115992/
http://www.ikea.com/us/en/catalog/products/60111123/


Revision [2023]

Edited on 2012-01-08 22:31:34 by KlenwellAdmin [adds lazy sampling]
Additions:
""<small>links and notes for later organization</small>"">>[[CocktailNapkin2011 2011 Napkin]]
[[CocktailNapkin2010 2010 Napkin]]
Deletions:
""<small>links and notes for later organization</small>"">>[[CocktailNapkin2010 2010 Napkin]]
%%(python)
import math, random

def roll_for(prob):
return random.random() < prob

def roll_for_100(prob):
roll = random.random() * 100
return roll < prob
print '%.2f' % (len(list(n for n in range(1000) if roll_for(.5))) / 10.0)
print '%.2f' % (len(list(n for n in range(1000) if roll_for_100(50))) / 10.0)
%%
http://stackoverflow.com/a/2774284
%%
import math

def circpts((x,y), r):
for xn in xrange(x-r, x+r+1):
ri = math.sqrt(r**2 - (xn-x)**2)
for yn in xrange(y-ri, y+ri+1):
yield xn,yn
pts = list(circpts((0,0), 3))
print pts
print [(x,y) for x,y in pts if x == 1]
# test a larger off-center circle
pts = list(circpts((2,5), 10))
area = math.pi * (10**2)
print len(pts), area
%%
http://paulbourke.net/geometry/circlearea/
%%
/*
Return TRUE if the point (x,y) is inside the circle.
Note that the edge is considered inside, see change below.
*/
int InsideCircle(double x,double y,CIRCLE c)
{
double dy,dx;
dx = c.cx - x;
dy = c.cy - y;
if (dx*dx + dy*dy <= c.r*c.r) /* Change to < to not include the edge */
return(TRUE);
else
return(FALSE);
}
%%
Webhosting.com 1and1.com URL Forwarding Thread: http://www.webhostingtalk.com/showthread.php?t=1106898
Mise:
['HHVVVH', 'HVHVVH', 'HVVHVH', 'HVVVHH', 'VHHVVH', 'VHVHVH', 'VHVVHH', 'VVHHVH', 'VVHVHH']
%%(python)
v = 'V'
h = 'H'

def order_markers():
order = {}
pos = range(6)

for p in pos:
marker = (p % 2 == 1) and h or v

if p < 2:
options = list(set(range(3)) - set(order.keys()))

else:
options = list(set(range(6)) - set(order.keys()))

place = random.choice(options)

order[place] = marker

sorder = sorted(order.items(), key=lambda t: t[0])

return [m for p,m in sorder]



orderings = []
for trial in range(100):
order = ''.join(order_markers())
orderings.append(order)
mise = list(set(orderings))

# H-last orderings
h_last = [o for o in mise if o[-1] == 'H']
%%
App Engine Pagination (with cursors):
http://www.learningtechnicalstuff.com/2010/04/pagedquery-easy-paging-using-cursors-on.html
http://stackoverflow.com/questions/3347700/datastore-cursor-paging-in-reverse-supported
http://www.gregtracy.com/revisiting-google-app-engines-pricing-changes
[[http://oscarbonilla.com/2009/05/visualizing-bayes-theorem/ Bayes Theorem]]
%%
P(A|B) = (P(B|A) * P(A)) / P(B)
P(A) -> Prob of A
P(A|B) -> Prob of A given B
%%
What this assumes: we know prob of A, B, and B given A. We want to know A given B. Applied: http://allendowney.blogspot.com/2011/10/all-your-bayes-are-belong-to-us.html
http://steshaw.org/economics-in-one-lesson/chap03p1.html
//"It was merely our old friend, the broken-window fallacy, in new clothing, and grown fat beyond recognition. This time it was supported by a whole bundle of related fallacies. It confused need with demand."//
//"To most people this seemed like an increase in total demand, as it partly was in terms of dollars of lower purchasing power. But what mainly took place was a diversion of demand to these particular products from others"//
**without diversion/need**: wealthy -> finance -> bonds (government/corp) -> demand (not need) -> GOP blockage/Corporate anxiety
**with diversion/need**: wealthy -> finance -> bonds -> need (war or commitment to social infrastructure) -> Government spending
> Some demands are more urgent than others. A marginal dollar is discretionary for the wealthy. The wealthy have the luxury of discretion, of demand. The poor have needs.
System Status in Fabric [[http://www.slideshare.net/ffunction/fabric-cuisine-and-watchdog-for-server-administration-in-python source]]
%%(python)
def sys_status():
disk_usage = run('df -kP')
mem_usage = run('cat /proc/meminfo')
cpu_usage = run('cat /proc/stat')

print 'Disk Usage, Mem Usage, CPU Usage:', disk_usage, mem_usage, cpu_usage
%%
[http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard Filesystem Hierarchy Standard (FHS)] -> HUFHS (Home User FHS)
Load All Tests in Module
%%(python)
if __name__ == "__main__":
mod = sys.modules[globals()['__name__']]
suite = unittest.TestLoader().loadTestsFromModule(mod)
unittest.TextTestRunner(verbosity=2).run(suite)
%%
Polygon Points
%%(python)
>>> xs = [('x0','x1','x2','x3'), ('x4','x5','x6','x7')]
>>> ys = [('y0','y1','y2','y3'), ('y4','y5','y6','y7')]
>>> zip(xs,ys)
[(('x0', 'x1', 'x2', 'x3'), ('y0', 'y1', 'y2', 'y3')), (('x4', 'x5', 'x6', 'x7'), ('y4', 'y5', 'y6', 'y7'))]
%%
[[http://stackoverflow.com/questions/3593578/ matplotlib colormaps]]
dict obj
ref: http://stackoverflow.com/questions/1305532/
%%(python)
#
# Module Globals and Constants
#
data = {'a': 1, 'b': {'c': 2}, 'd': ["hi", {'foo': "bar"}]}
def p(k,v): print 'setting', k, v, type(v)
nest = {
'y1' : {
't1' : {
'c1': 1,
'c2': [1,2,3]
},
't2' : {}
},
'y2' : {

}
}
#
# Data Structure
#
class ObjectDict(dict):
'''The recursive class for building and representing objects with.'''
seqs = tuple, list, set, frozenset

def __init__(self, obj):
for k, v in obj.iteritems():
if isinstance(v, dict):
setattr(self, k, ObjectDict(v))
elif isinstance(v, self.seqs):
vseq = []
for item in v:
if isinstance(item, dict):
vseq.append(ObjectDict(item))
else:
vseq.append(item)
setattr(self, k, vseq)
else:
setattr(self, k, v)
def __getitem__(self, val):
return self.__dict__[val]
def __repr__(self):
return '{%s}' % str(', '.join('%s : %s' % (k, repr(v)) for
(k, v) in self.__dict__.iteritems()))
#
# Test
#
d = ObjectDict(data)
print d
assert d.a == 1
assert d.b.c == 2
assert d.d[1].foo == 'bar'
n = ObjectDict(nest)
print n
assert n.y1.t1.c1 == 1
assert n.y1.t1.c2 == [1,2,3]
assert n.y1.t2 == {}
%%
logarithms
~- ""logX = Y ---> e<sup>Y</sup> = X""
~- ""log<sub>X</sub>Y = Z ---> X<sup>Z</sup> = Y""
~- ""log<sub>2</sub>1024 = 10 ---> 2<sup>10</sup> = 1024""
~- http://repl.it/B4e
%%
Python 2.7.2 (default, Jul 20 2011, 02:32:18)
[GCC 4.2.1 (LLVM, Emscripten 1.5, Empythoned)] on linux2
import math
math.log.__doc__
=> 'log(x[, base])\n\nReturn the logarithm of x to the given base.\nIf the base not specified, returns the natural logarithm (base e) of x.'
math.pow(2, 10)
=> 1024.0
math.log(1024, 2)
=> 10.0
math.e
=> 2.7182818284590451
math.log(1, math.e)
=> 0.0
%%
Cron RPM
%%(python)
from random import randint
def cron_rpm(run_rate, job_rate):
"""runs per m (1000)"""
hr = 60
day = 24 * hr

tmap = {'hr': hr, 'day': day}

run_num, run_den = run_rate
job_num, job_den = job_rate

if run_den in tmap:
run_den = tmap[run_den]

if job_den in tmap:
job_den = tmap[job_den]

job_factor = float(job_den) / job_num

run_now = randint(1, int(run_den)) <= run_num * job_factor

return run_now



def test():
test_cases = [
# run_rate, job_rate, job_runs, expect
((5, 100), (1,1), 100, 5),
((1, 60), (1,3), 60, 3),
((3, 'day'), (30, 'hr'), 30*24, 3),
]

def run_test(run_rate, job_rate, runs, expect):
total = 0
for n in range(runs):
if cron_rpm(run_rate, job_rate):
total += 1
return total
for run_rate, job_rate, runs, expect in test_cases:
trials = 100
total_sum = 0
for n in range(trials):
total = run_test(run_rate, job_rate, runs, expect)
total_sum += total

avg = total_sum / float(trials)
print 'avg, expect (%s trials)' % (trials), '%.1f' % (avg), expect


test()
%%
Pyplot Example
%%(python)
# plot
import matplotlib.pyplot as pyplot
title = 'Conditional Probabilities'
xlabel = 'weeks'
ylabel = 'cond prob'
x1 = [x for x,y in first_probs]
y1 = [y for x,y in first_probs]
x2 = [x for x,y in other_probs]
y2 = [y for x,y in other_probs]
pyplot.plot(x1, y1, 'm-', label='first births')
pyplot.plot(x2, y2, 'b-', label='other births')
pyplot.title(title)
pyplot.xlabel(xlabel)
pyplot.ylabel(ylabel)
pyplot.xlim([25,50])
pyplot.legend(loc=2)
pyplot.show()
%%
[[https://www.google.com/adplanner/planning/site_profile?hl=en#siteDetails?identifier=reddit.com&lp=true www.google.com/adplanner]] disturbingly detailed informaton
python reconstructing a traceback:
%%(python)
import traceback, sys
trace_str = ''.join(traceback.format_tb(sys.exc_info()[2]))
%%
Pastebin20110628 - appswell min-tree.txt
State Machines
~- Difference between state machine and program?
Information / Entropy
~- Difference between energy, heat, radiation?
http://en.wikipedia.org/wiki/Deletionpedia
~- Only active February to September 2008
http://pastebin.com/CyxzKLSP
%%(python)
for i in range(8):
print 'left 1 << %s:' % (i), 1<<i
print 'right 2**8 >> %s:' % (i), 2**8>>i

OUTPUT:
left 1 << 0: 1
right 2**8 >> 0: 256
left 1 << 1: 2
right 2**8 >> 1: 128
left 1 << 2: 4
right 2**8 >> 2: 64
left 1 << 3: 8
right 2**8 >> 3: 32
left 1 << 4: 16
right 2**8 >> 4: 16
left 1 << 5: 32
right 2**8 >> 5: 8
left 1 << 6: 64
right 2**8 >> 6: 4
left 1 << 7: 128
right 2**8 >> 7: 2
%%
Python Decorators
%%(python)
"""
A simple demo of decorators
"""
from random import (randint, choice)
def cache_service(f):
"""simulates a cache that randomly finds data in it and then acts
accordingly"""
def wrapper():
cache = choice([True, False])
if cache:
print "cache found: will return that"
else:
print "cache not found: will call %s" % (f)
f()
return wrapper
def cache_resource(key, duration=60):
def inner_cache_data(fn):
def cacher(*args, **kwargs):
cache = choice(['cached data', False])
if cache:
print "cache found: will return that"
return cache
else:
print "cache not found: will call %s" % (fn)
data = fn(*args, **kwargs)
print "will now cache data with key %s for %ss" % (key, duration)
return data
return cacher
return inner_cache_data

@cache_service
def get_data_from_service():
print "getting data from service"
return 'data from service'
@cache_resource('resource-cache-key')
def get_data_from_resource():
print "getting data from resource"
return 'data from resource'
#
# Tests
#
for i in range(3):
print '\nrun get_data_from_service test %s' % (i)
print get_data_from_service()

for i in range(5):
print '\nrun get_data_from_resource test %s' % (i)
print 'returns: %s' % (get_data_from_resource())
%%
Arestin:
~- http://www.drugs.com/pro/arestin.html
~- http://www.arestin.com/
~- Sections
~~- Intro: not this, not that, just someone who's looked at trial results. No rec.
~~- Background: Why I Took It
~~~- Relationship with hygienist and office
~~~- History of bleeding gums: not terrible and better with improved dental hygiene
~~~- No choice
~~~- Then she presented the brochure: knew I'd been had.
~~- The Brochure
~~~- What it shows: the simple mental model: Wouldn't be surprised if Hyg believes it works.
~~~- What it hides, literally: Trial Data
~~~- What does the data show? stats (% effectiveness), real-world impact
~~- What If It Works? The Bigger Problem
~~~- 6 mos. Pocket reduced 1mm. What would it mean?
~~~- Reflexive dependency on drugs to handle problems
~~~- No discussion of alternatives: wait-and-see, increased cleaning, periodontal referral
~~- The Interface Problem: How to Reform Drug Usage in America
~~~- Trial Data
~~~- Probable Results
~~~- Cost to Consumer, Insurance, Government
~~~- Questions To Ask
~~~~- Can you explain trial results to me?
~~~~- Why do you think this will help me?
~~~~- Chance of Side effects: what does the data here mean?
~~~~- Would you take this drug if you were in my position? Would you prescribe it to your own child/partner?
~~~~- Do you receive any financial incentives that you think you should disclose?

Kindle:
~- https://kindle.amazon.com/your_highlights
ConnectBot Without Password: http://goo.gl/Mvx2F
Press: APC white screen issue
Julian Date in Python (2011.05.11)
%%
from datetime import datetime
juliandate = '%s%s' % (datetime.now().timetuple().tm_year, datetime.now().timetuple().tm_yday)
%%
More Encoding Issues (fixing encoding issue with hmac):
%%
input = unicode(special_chars).encode('utf-8')
%%
%%(python)
import hmac, sha, random
pound_sign = u'\u00A3'
cent_sign = u'\u00A2'
null_sign = u'\u0000'
random_sign = unichr(random.randint(1000,10000))
special_chars = 'derp... %s%s%s%s' % (pound_sign, cent_sign, null_sign,
random_sign)

# reproduces problem
try:
hmac_digest = hmac.new('key', special_chars, sha).hexdigest()
fail('expected exception')
except TypeError, e:
assert(str(e).find("can't encode characters") != -1)
# test unicode (ref: http://goo.gl/vJKlo)
input = unicode(special_chars).encode('utf-8')
assert(type(input) == str)
hmac_digest = hmac.new('key', input, sha).hexdigest()
print hmac_digest
%%
A test:
%%(python)
def test_encoding_normalization(self):
pound_sign = u'\u00A3'
cent_sign = u'\u00A2'
nonascii = 'derp... %s%s' % (pound_sign, cent_sign)
self.assertEqual(type(nonascii), unicode)

nonascii_str = nonascii.encode('utf-8')
nonascii_uni = nonascii_str.decode('utf-8')
ascii_str = nonascii_uni.encode('ascii', 'replace')
self.assertEqual(type(nonascii_str), str)
self.assertEqual(type(nonascii_uni), unicode)

# if default encoding is ascii, this fails
self.assertRaises(UnicodeDecodeError, unicode, nonascii_str)
self.assertRaises(UnicodeEncodeError, str, nonascii_uni)

# so to normalize either str or unicode, first decode, then encode
def normalize_utf8(input):
if type(input) == unicode:
input = input.encode('utf-8')
return input

for test_input in (nonascii_str, nonascii_uni, ascii_str):
normalized_input = normalize_utf8(test_input)
self.assertEqual(type(normalized_input), str)

# make sure no issues with string formatting
print 'string formatting: %s' % (normalized_input)

# convert utf8 str to ascii str
ascii_str = nonascii_str.decode('utf-8').encode('ascii', 'replace')
self.assertTrue(ascii_str.find('??') != -1)
%%
MYSQL: convert a squiggly (encoded) password to hex and back
%%
mysql> SELECT HEX('abc');
+------------+
| HEX('abc') |
+------------+
| 616263 |
+------------+
1 row in set (0.06 sec)
mysql> SELECT X'616263';
+-----------+
| X'616263' |
+-----------+
| abc |
+-----------+
1 row in set (0.00 sec)
%%
*[[http://news.ycombinator.com/item?id=2364369 Idle Thoughts on the Next Market Bubble]] (Hacker News comment)
*[[http://preposthumously.blogspot.com/2011/03/cocktail-purple-cloud.html Purple Cloud]]
*[[http://pongsocket.com/forum/post/376/#p376 TweetNest Forum Post]] (Fix for date offset)
[[http://www.facebook.com/album.php?aid=221580&id=575476957&l=c6b5ca1e54 A Day at the Zoo]]
*[[http://news.ycombinator.com/item?id=2090678 Why Chinese Mothers are Not Superior (from a female Chinese engineer)]] (news.ycombinator.com)
*[[http://krugman.blogs.nytimes.com/2011/01/06/the-repeal-the-senior-murdering-secret-muslim-president-act/ HR 2 (Krugman)]]
NYR: CE Francis


Revision [2007]

Edited on 2011-12-23 11:18:19 by KlenwellAdmin [adds lazy sampling]
Additions:
print '%.2f' % (len(list(n for n in range(1000) if roll_for(.5))) / 10.0)
print '%.2f' % (len(list(n for n in range(1000) if roll_for_100(50))) / 10.0)
Deletions:
print '%.2f%%' % (len(list(n for n in range(1000) if roll_for(.5))) / 10.0)
print '%.2f%%' % (len(list(n for n in range(1000) if roll_for_100(50))) / 10.0)


Revision [2006]

Edited on 2011-12-23 11:17:50 by KlenwellAdmin [adds lazy sampling]
Additions:
import math, random
def roll_for(prob):
return random.random() < prob
def roll_for_100(prob):
roll = random.random() * 100
return roll < prob
print '%.2f%%' % (len(list(n for n in range(1000) if roll_for(.5))) / 10.0)
print '%.2f%%' % (len(list(n for n in range(1000) if roll_for_100(50))) / 10.0)


Revision [2005]

Edited on 2011-12-23 09:11:13 by KlenwellAdmin [adds lazy sampling]
Additions:
# test a larger off-center circle
pts = list(circpts((2,5), 10))
area = math.pi * (10**2)
print len(pts), area


Revision [2004]

Edited on 2011-12-22 16:20:51 by KlenwellAdmin [adds lazy sampling]
Additions:
http://stackoverflow.com/a/2774284
import math
def circpts((x,y), r):
for xn in xrange(x-r, x+r+1):
ri = math.sqrt(r**2 - (xn-x)**2)
for yn in xrange(y-ri, y+ri+1):
yield xn,yn
pts = list(circpts((0,0), 3))
print pts
print [(x,y) for x,y in pts if x == 1]


Revision [2003]

Edited on 2011-12-16 14:26:47 by KlenwellAdmin [adds lazy sampling]
Additions:
http://paulbourke.net/geometry/circlearea/
/*
Return TRUE if the point (x,y) is inside the circle.
Note that the edge is considered inside, see change below.
*/
int InsideCircle(double x,double y,CIRCLE c)
{
double dy,dx;
dx = c.cx - x;
dy = c.cy - y;
if (dx*dx + dy*dy <= c.r*c.r) /* Change to < to not include the edge */
return(TRUE);
else
return(FALSE);


Revision [1992]

Edited on 2011-12-11 20:19:07 by KlenwellAdmin [adds lazy sampling]
Additions:
Webhosting.com 1and1.com URL Forwarding Thread: http://www.webhostingtalk.com/showthread.php?t=1106898


Revision [1991]

Edited on 2011-12-09 09:08:45 by KlenwellAdmin [adds lazy sampling]
Additions:
Mise:
['HHVVVH', 'HVHVVH', 'HVVHVH', 'HVVVHH', 'VHHVVH', 'VHVHVH', 'VHVVHH', 'VVHHVH', 'VVHVHH']
v = 'V'
h = 'H'
def order_markers():
order = {}
pos = range(6)
for p in pos:
marker = (p % 2 == 1) and h or v
if p < 2:
options = list(set(range(3)) - set(order.keys()))
options = list(set(range(6)) - set(order.keys()))
place = random.choice(options)
order[place] = marker
sorder = sorted(order.items(), key=lambda t: t[0])
return [m for p,m in sorder]
orderings = []
for trial in range(100):
order = ''.join(order_markers())
orderings.append(order)
mise = list(set(orderings))
# H-last orderings
h_last = [o for o in mise if o[-1] == 'H']


Revision [1963]

Edited on 2011-11-13 11:00:51 by KlenwellAdmin [adds lazy sampling]
Additions:
App Engine Pagination (with cursors):
http://www.learningtechnicalstuff.com/2010/04/pagedquery-easy-paging-using-cursors-on.html
http://stackoverflow.com/questions/3347700/datastore-cursor-paging-in-reverse-supported
http://www.gregtracy.com/revisiting-google-app-engines-pricing-changes


Revision [1956]

Edited on 2011-10-27 09:46:50 by KlenwellAdmin [adds lazy sampling]
Additions:
What this assumes: we know prob of A, B, and B given A. We want to know A given B. Applied: http://allendowney.blogspot.com/2011/10/all-your-bayes-are-belong-to-us.html


Revision [1955]

Edited on 2011-10-27 09:43:31 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://oscarbonilla.com/2009/05/visualizing-bayes-theorem/ Bayes Theorem]]
P(A|B) = (P(B|A) * P(A)) / P(B)
P(A) -> Prob of A
P(A|B) -> Prob of A given B


Revision [1954]

Edited on 2011-10-26 11:01:34 by KlenwellAdmin [adds lazy sampling]
Additions:
**with diversion/need**: wealthy -> finance -> bonds -> need (war or commitment to social infrastructure) -> Government spending
Deletions:
**with diversion/need**: wealthy -> finance -> bonds -> need (war or skilled workforce) -> Government spending


Revision [1953]

Edited on 2011-10-24 10:34:21 by KlenwellAdmin [adds lazy sampling]
Additions:
> Some demands are more urgent than others. A marginal dollar is discretionary for the wealthy. The wealthy have the luxury of discretion, of demand. The poor have needs.


Revision [1952]

Edited on 2011-10-24 10:30:45 by KlenwellAdmin [adds lazy sampling]
Additions:
**with diversion/need**: wealthy -> finance -> bonds -> need (war or skilled workforce) -> Government spending
Deletions:
**with diversion/need**: wealthy -> finance -> bonds -> need (war) -> Government spending


Revision [1951]

Edited on 2011-10-24 10:29:39 by KlenwellAdmin [adds lazy sampling]
Additions:
//"It was merely our old friend, the broken-window fallacy, in new clothing, and grown fat beyond recognition. This time it was supported by a whole bundle of related fallacies. It confused need with demand."//
//"To most people this seemed like an increase in total demand, as it partly was in terms of dollars of lower purchasing power. But what mainly took place was a diversion of demand to these particular products from others"//
**without diversion/need**: wealthy -> finance -> bonds (government/corp) -> demand (not need) -> GOP blockage/Corporate anxiety
**with diversion/need**: wealthy -> finance -> bonds -> need (war) -> Government spending
Deletions:
"It was merely our old friend, the broken-window fallacy, in new clothing, and grown fat beyond recognition. This time it was supported by a whole bundle of related fallacies. It confused need with demand."
"To most people this seemed like an increase in total demand, as it partly was in terms of dollars of lower purchasing power. But what mainly took place was a diversion of demand to these particular products from others"
**without diversion/need: wealthy -> finance -> bonds (government/corp) -> demand (not need) -> GOP blockage/Corporate anxiety**
**with diversion/need: wealthy -> finance -> bonds -> need (war) -> Government spending**


Revision [1950]

Edited on 2011-10-24 10:28:56 by KlenwellAdmin [adds lazy sampling]
Additions:
http://steshaw.org/economics-in-one-lesson/chap03p1.html
"It was merely our old friend, the broken-window fallacy, in new clothing, and grown fat beyond recognition. This time it was supported by a whole bundle of related fallacies. It confused need with demand."
"To most people this seemed like an increase in total demand, as it partly was in terms of dollars of lower purchasing power. But what mainly took place was a diversion of demand to these particular products from others"
**without diversion/need: wealthy -> finance -> bonds (government/corp) -> demand (not need) -> GOP blockage/Corporate anxiety**
**with diversion/need: wealthy -> finance -> bonds -> need (war) -> Government spending**


Revision [1949]

Edited on 2011-10-24 09:16:04 by KlenwellAdmin [adds lazy sampling]
Additions:
System Status in Fabric [[http://www.slideshare.net/ffunction/fabric-cuisine-and-watchdog-for-server-administration-in-python source]]
def sys_status():
disk_usage = run('df -kP')
mem_usage = run('cat /proc/meminfo')
cpu_usage = run('cat /proc/stat')
print 'Disk Usage, Mem Usage, CPU Usage:', disk_usage, mem_usage, cpu_usage


Revision [1948]

Edited on 2011-10-21 11:07:54 by KlenwellAdmin [adds lazy sampling]
Additions:
[http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard Filesystem Hierarchy Standard (FHS)] -> HUFHS (Home User FHS)


Revision [1943]

Edited on 2011-10-17 19:19:42 by KlenwellAdmin [adds lazy sampling]
Additions:
Load All Tests in Module
if __name__ == "__main__":
mod = sys.modules[globals()['__name__']]
suite = unittest.TestLoader().loadTestsFromModule(mod)
unittest.TextTestRunner(verbosity=2).run(suite)


Revision [1940]

Edited on 2011-10-12 10:23:27 by KlenwellAdmin [adds lazy sampling]
Additions:
Polygon Points
>>> xs = [('x0','x1','x2','x3'), ('x4','x5','x6','x7')]
>>> ys = [('y0','y1','y2','y3'), ('y4','y5','y6','y7')]
>>> zip(xs,ys)
[(('x0', 'x1', 'x2', 'x3'), ('y0', 'y1', 'y2', 'y3')), (('x4', 'x5', 'x6', 'x7'), ('y4', 'y5', 'y6', 'y7'))]


Revision [1939]

Edited on 2011-10-11 11:26:41 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://stackoverflow.com/questions/3593578/ matplotlib colormaps]]


Revision [1938]

Edited on 2011-10-03 11:49:59 by KlenwellAdmin [adds lazy sampling]
Additions:
dict obj
ref: http://stackoverflow.com/questions/1305532/
# Module Globals and Constants
data = {'a': 1, 'b': {'c': 2}, 'd': ["hi", {'foo': "bar"}]}
def p(k,v): print 'setting', k, v, type(v)
nest = {
'y1' : {
't1' : {
'c1': 1,
'c2': [1,2,3]
},
't2' : {}
},
'y2' : {
}
}
# Data Structure
class ObjectDict(dict):
'''The recursive class for building and representing objects with.'''
seqs = tuple, list, set, frozenset
def __init__(self, obj):
for k, v in obj.iteritems():
if isinstance(v, dict):
setattr(self, k, ObjectDict(v))
elif isinstance(v, self.seqs):
vseq = []
for item in v:
if isinstance(item, dict):
vseq.append(ObjectDict(item))
else:
vseq.append(item)
setattr(self, k, vseq)
setattr(self, k, v)
def __getitem__(self, val):
return self.__dict__[val]
def __repr__(self):
return '{%s}' % str(', '.join('%s : %s' % (k, repr(v)) for
(k, v) in self.__dict__.iteritems()))
# Test
d = ObjectDict(data)
print d
assert d.a == 1
assert d.b.c == 2
assert d.d[1].foo == 'bar'
n = ObjectDict(nest)
print n
assert n.y1.t1.c1 == 1
assert n.y1.t1.c2 == [1,2,3]
assert n.y1.t2 == {}


Revision [1937]

Edited on 2011-09-30 22:15:19 by KlenwellAdmin [adds lazy sampling]
Additions:
~- ""logX = Y ---> e<sup>Y</sup> = X""
Deletions:
~- ""logX = Y ---> e<sup>Z</sup> = Y""


Revision [1936]

Edited on 2011-09-30 21:32:06 by KlenwellAdmin [adds lazy sampling]
Additions:
~- ""logX = Y ---> e<sup>Z</sup> = Y""
~- ""log<sub>2</sub>1024 = 10 ---> 2<sup>10</sup> = 1024""
Deletions:
~- ""log<sub>2</sub>1024 = 10""


Revision [1935]

Edited on 2011-09-30 21:21:04 by KlenwellAdmin [adds lazy sampling]
Additions:
~- ""log<sub>X</sub>Y = Z ---> X<sup>Z</sup> = Y""
Deletions:
~- ""log<sub>X</sub>Y = Z"" ---> ""X<sup>Z</sup> = Y""


Revision [1934]

Edited on 2011-09-30 21:20:50 by KlenwellAdmin [adds lazy sampling]
Additions:
~- ""log<sub>X</sub>Y = Z"" ---> ""X<sup>Z</sup> = Y""
Deletions:
~- ""log<sub>X</sub>Y = Z"" -> ""X<sup>Z</sup> = Y""


Revision [1933]

Edited on 2011-09-30 21:20:07 by KlenwellAdmin [adds lazy sampling]
Additions:
~- ""log<sub>X</sub>Y = Z"" -> ""X<sup>Z</sup> = Y""


Revision [1932]

Edited on 2011-09-30 21:17:38 by KlenwellAdmin [adds lazy sampling]
Additions:
~- ""log<sub>2</sub>1024 = 10""
Deletions:
~- ""log<sub>2</sub>1024 = 10


Revision [1931]

Edited on 2011-09-30 21:17:29 by KlenwellAdmin [adds lazy sampling]
Additions:
~- ""log<sub>2</sub>1024 = 10


Revision [1930]

Edited on 2011-09-30 21:14:55 by KlenwellAdmin [adds lazy sampling]
Additions:
logarithms
~- http://repl.it/B4e
Python 2.7.2 (default, Jul 20 2011, 02:32:18)
[GCC 4.2.1 (LLVM, Emscripten 1.5, Empythoned)] on linux2
import math
math.log.__doc__
=> 'log(x[, base])\n\nReturn the logarithm of x to the given base.\nIf the base not specified, returns the natural logarithm (base e) of x.'
math.pow(2, 10)
=> 1024.0
math.log(1024, 2)
=> 10.0
math.e
=> 2.7182818284590451
math.log(1, math.e)
=> 0.0


Revision [1927]

Edited on 2011-09-23 14:39:48 by KlenwellAdmin [adds lazy sampling]
Additions:
Cron RPM
def cron_rpm(run_rate, job_rate):
if cron_rpm(run_rate, job_rate):
Deletions:
Cron RMP
def _rpm(run_rate, job_rate):
if _rpm(run_rate, job_rate):


Revision [1926]

Edited on 2011-09-23 14:38:55 by KlenwellAdmin [adds lazy sampling]
Additions:
Cron RMP
from random import randint
def _rpm(run_rate, job_rate):
"""runs per m (1000)"""
hr = 60
day = 24 * hr
tmap = {'hr': hr, 'day': day}
run_num, run_den = run_rate
job_num, job_den = job_rate
if run_den in tmap:
run_den = tmap[run_den]
if job_den in tmap:
job_den = tmap[job_den]
job_factor = float(job_den) / job_num
run_now = randint(1, int(run_den)) <= run_num * job_factor
return run_now
def test():
test_cases = [
# run_rate, job_rate, job_runs, expect
((5, 100), (1,1), 100, 5),
((1, 60), (1,3), 60, 3),
((3, 'day'), (30, 'hr'), 30*24, 3),
]
def run_test(run_rate, job_rate, runs, expect):
total = 0
for n in range(runs):
if _rpm(run_rate, job_rate):
total += 1
return total
for run_rate, job_rate, runs, expect in test_cases:
trials = 100
total_sum = 0
for n in range(trials):
total = run_test(run_rate, job_rate, runs, expect)
total_sum += total
avg = total_sum / float(trials)
print 'avg, expect (%s trials)' % (trials), '%.1f' % (avg), expect
test()


Revision [1924]

Edited on 2011-09-16 21:58:56 by KlenwellAdmin [adds lazy sampling]
Additions:
Pyplot Example
# plot
import matplotlib.pyplot as pyplot
title = 'Conditional Probabilities'
xlabel = 'weeks'
ylabel = 'cond prob'
x1 = [x for x,y in first_probs]
y1 = [y for x,y in first_probs]
x2 = [x for x,y in other_probs]
y2 = [y for x,y in other_probs]
pyplot.plot(x1, y1, 'm-', label='first births')
pyplot.plot(x2, y2, 'b-', label='other births')
pyplot.title(title)
pyplot.xlabel(xlabel)
pyplot.ylabel(ylabel)
pyplot.xlim([25,50])
pyplot.legend(loc=2)
pyplot.show()


Revision [1919]

Edited on 2011-08-26 13:17:10 by KlenwellAdmin [adds lazy sampling]
Additions:
python reconstructing a traceback:


Revision [1918]

Edited on 2011-08-26 13:16:35 by KlenwellAdmin [adds lazy sampling]
Additions:
[[https://www.google.com/adplanner/planning/site_profile?hl=en#siteDetails?identifier=reddit.com&lp=true www.google.com/adplanner]] disturbingly detailed informaton


Revision [1917]

Edited on 2011-08-26 08:34:25 by KlenwellAdmin [adds lazy sampling]
Additions:
import traceback, sys
trace_str = ''.join(traceback.format_tb(sys.exc_info()[2]))


Revision [1909]

Edited on 2011-08-09 20:48:33 by KlenwellAdmin [adds lazy sampling]
Additions:
State Machines
~- Difference between state machine and program?
Information / Entropy
~- Difference between energy, heat, radiation?
http://en.wikipedia.org/wiki/Deletionpedia
~- Only active February to September 2008
Deletions:
[[w20110626 w20110626]]


Revision [1894]

Edited on 2011-06-28 20:40:36 by KlenwellAdmin [adds lazy sampling]
Additions:
Pastebin20110628 - appswell min-tree.txt


Revision [1891]

Edited on 2011-06-27 19:11:59 by KlenwellAdmin [adds lazy sampling]
Additions:
[[w20110626 w20110626]]
Deletions:
w20110626


Revision [1890]

Edited on 2011-06-27 19:11:48 by KlenwellAdmin [adds lazy sampling]
Additions:
w20110626


Revision [1875]

Edited on 2011-06-19 20:55:04 by KlenwellAdmin [adds lazy sampling]
Additions:
http://pastebin.com/CyxzKLSP


Revision [1873]

Edited on 2011-06-13 08:31:09 by KlenwellAdmin [adds lazy sampling]
Additions:
for i in range(8):
print 'left 1 << %s:' % (i), 1<<i
print 'right 2**8 >> %s:' % (i), 2**8>>i
OUTPUT:
left 1 << 0: 1
right 2**8 >> 0: 256
left 1 << 1: 2
right 2**8 >> 1: 128
left 1 << 2: 4
right 2**8 >> 2: 64
left 1 << 3: 8
right 2**8 >> 3: 32
left 1 << 4: 16
right 2**8 >> 4: 16
left 1 << 5: 32
right 2**8 >> 5: 8
left 1 << 6: 64
right 2**8 >> 6: 4
left 1 << 7: 128
right 2**8 >> 7: 2


Revision [1872]

Edited on 2011-06-10 15:30:27 by KlenwellAdmin [adds lazy sampling]
Additions:
Python Decorators
"""
A simple demo of decorators
"""
from random import (randint, choice)
def cache_service(f):
"""simulates a cache that randomly finds data in it and then acts
accordingly"""
def wrapper():
cache = choice([True, False])
if cache:
print "cache found: will return that"
else:
print "cache not found: will call %s" % (f)
f()
return wrapper
def cache_resource(key, duration=60):
def inner_cache_data(fn):
def cacher(*args, **kwargs):
cache = choice(['cached data', False])
if cache:
print "cache found: will return that"
return cache
else:
print "cache not found: will call %s" % (fn)
data = fn(*args, **kwargs)
print "will now cache data with key %s for %ss" % (key, duration)
return data
return cacher
return inner_cache_data

@cache_service
def get_data_from_service():
print "getting data from service"
return 'data from service'
@cache_resource('resource-cache-key')
def get_data_from_resource():
print "getting data from resource"
return 'data from resource'
#
# Tests
#
for i in range(3):
print '\nrun get_data_from_service test %s' % (i)
print get_data_from_service()

for i in range(5):
print '\nrun get_data_from_resource test %s' % (i)
print 'returns: %s' % (get_data_from_resource())


Revision [1869]

Edited on 2011-06-08 08:26:01 by KlenwellAdmin [adds lazy sampling]
Additions:
~~~- Relationship with hygienist and office
~~~- History of bleeding gums: not terrible and better with improved dental hygiene
~~~- No choice
~~~- Then she presented the brochure: knew I'd been had.
~~~- What it shows: the simple mental model: Wouldn't be surprised if Hyg believes it works.
~~~- What it hides, literally: Trial Data
~~~- What does the data show? stats (% effectiveness), real-world impact
~~- What If It Works? The Bigger Problem
~~~- 6 mos. Pocket reduced 1mm. What would it mean?
~~~- Reflexive dependency on drugs to handle problems
~~~- No discussion of alternatives: wait-and-see, increased cleaning, periodontal referral
~~~~- Chance of Side effects: what does the data here mean?
Deletions:
~~- Trial Data


Revision [1868]

Edited on 2011-06-08 08:12:04 by KlenwellAdmin [adds lazy sampling]
Additions:
Arestin:
~- http://www.drugs.com/pro/arestin.html
~- http://www.arestin.com/
~- Sections
~~- Intro: not this, not that, just someone who's looked at trial results. No rec.
~~- Background: Why I Took It
~~- The Brochure
~~- Trial Data
~~- The Interface Problem: How to Reform Drug Usage in America
~~~- Trial Data
~~~- Probable Results
~~~- Cost to Consumer, Insurance, Government
~~~- Questions To Ask
~~~~- Can you explain trial results to me?
~~~~- Why do you think this will help me?
~~~~- Would you take this drug if you were in my position? Would you prescribe it to your own child/partner?
~~~~- Do you receive any financial incentives that you think you should disclose?


Revision [1863]

Edited on 2011-05-30 20:22:00 by KlenwellAdmin [adds lazy sampling]
Additions:
Kindle:
~- https://kindle.amazon.com/your_highlights


Revision [1861]

Edited on 2011-05-25 10:59:51 by KlenwellAdmin [adds lazy sampling]
Additions:
ConnectBot Without Password: http://goo.gl/Mvx2F
Press: APC white screen issue


Revision [1859]

Edited on 2011-05-10 10:20:08 by KlenwellAdmin [adds lazy sampling]
Additions:
Julian Date in Python (2011.05.11)
Deletions:
Julian Date in Python


Revision [1858]

Edited on 2011-05-10 10:19:50 by KlenwellAdmin [adds lazy sampling]
Additions:
Julian Date in Python
from datetime import datetime
juliandate = '%s%s' % (datetime.now().timetuple().tm_year, datetime.now().timetuple().tm_yday)


Revision [1851]

Edited on 2011-05-03 09:14:45 by KlenwellAdmin [adds lazy sampling]
Additions:
A test:
def test_encoding_normalization(self):
pound_sign = u'\u00A3'
cent_sign = u'\u00A2'
nonascii = 'derp... %s%s' % (pound_sign, cent_sign)
self.assertEqual(type(nonascii), unicode)
nonascii_str = nonascii.encode('utf-8')
nonascii_uni = nonascii_str.decode('utf-8')
ascii_str = nonascii_uni.encode('ascii', 'replace')
self.assertEqual(type(nonascii_str), str)
self.assertEqual(type(nonascii_uni), unicode)
# if default encoding is ascii, this fails
self.assertRaises(UnicodeDecodeError, unicode, nonascii_str)
self.assertRaises(UnicodeEncodeError, str, nonascii_uni)
# so to normalize either str or unicode, first decode, then encode
def normalize_utf8(input):
if type(input) == unicode:
input = input.encode('utf-8')
return input
for test_input in (nonascii_str, nonascii_uni, ascii_str):
normalized_input = normalize_utf8(test_input)
self.assertEqual(type(normalized_input), str)

# make sure no issues with string formatting
print 'string formatting: %s' % (normalized_input)

# convert utf8 str to ascii str
ascii_str = nonascii_str.decode('utf-8').encode('ascii', 'replace')
self.assertTrue(ascii_str.find('??') != -1)


Revision [1849]

Edited on 2011-04-29 10:28:15 by KlenwellAdmin [adds lazy sampling]

No Differences

Revision [1848]

Edited on 2011-04-29 10:27:26 by KlenwellAdmin [adds lazy sampling]
Additions:
hmac_digest = hmac.new('key', input, sha).hexdigest()
Deletions:
hmac_digest = hmac.new('user', input, sha).hexdigest()


Revision [1847]

Edited on 2011-04-29 10:26:55 by KlenwellAdmin [adds lazy sampling]
Additions:
More Encoding Issues (fixing encoding issue with hmac):
%%(python)
import hmac, sha, random
pound_sign = u'\u00A3'
cent_sign = u'\u00A2'
null_sign = u'\u0000'
random_sign = unichr(random.randint(1000,10000))
special_chars = 'derp... %s%s%s%s' % (pound_sign, cent_sign, null_sign,
random_sign)

# reproduces problem
try:
hmac_digest = hmac.new('key', special_chars, sha).hexdigest()
fail('expected exception')
except TypeError, e:
assert(str(e).find("can't encode characters") != -1)
# test unicode (ref: http://goo.gl/vJKlo)
input = unicode(special_chars).encode('utf-8')
assert(type(input) == str)
hmac_digest = hmac.new('user', input, sha).hexdigest()
print hmac_digest


Revision [1845]

Edited on 2011-04-27 09:23:27 by KlenwellAdmin [adds lazy sampling]
Additions:
MYSQL: convert a squiggly (encoded) password to hex and back
%%
mysql> SELECT HEX('abc');
+------------+
| HEX('abc') |
+------------+
| 616263 |
+------------+
1 row in set (0.06 sec)
mysql> SELECT X'616263';
+-----------+
| X'616263' |
+-----------+
| abc |
+-----------+
1 row in set (0.00 sec)
%%


Revision [1841]

Edited on 2011-03-24 09:38:43 by KlenwellAdmin [adds lazy sampling]
Additions:
*[[http://news.ycombinator.com/item?id=2364369 Idle Thoughts on the Next Market Bubble]] (Hacker News comment)


Revision [1838]

Edited on 2011-03-05 23:39:55 by KlenwellAdmin [adds lazy sampling]
Additions:
*[[http://preposthumously.blogspot.com/2011/03/cocktail-purple-cloud.html Purple Cloud]]
*[[http://pongsocket.com/forum/post/376/#p376 TweetNest Forum Post]] (Fix for date offset)
Deletions:
* [[http://preposthumously.blogspot.com/2011/03/cocktail-purple-cloud.html Purple Cloud]]
* [[http://pongsocket.com/forum/post/376/#p376 TweetNest Forum Post]] (Fix for date offset)


Revision [1837]

Edited on 2011-03-05 23:39:40 by KlenwellAdmin [adds lazy sampling]
Additions:
* [[http://preposthumously.blogspot.com/2011/03/cocktail-purple-cloud.html Purple Cloud]]


Revision [1828]

Edited on 2011-02-08 04:25:35 by KlenwellAdmin [adds lazy sampling]
Additions:
* [[http://pongsocket.com/forum/post/376/#p376 TweetNest Forum Post]] (Fix for date offset)


Revision [1807]

Edited on 2011-01-17 19:41:12 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.facebook.com/album.php?aid=221580&id=575476957&l=c6b5ca1e54 A Day at the Zoo]]


Revision [1800]

Edited on 2011-01-11 06:01:03 by KlenwellAdmin [adds lazy sampling]
Additions:
*[[http://news.ycombinator.com/item?id=2090678 Why Chinese Mothers are Not Superior (from a female Chinese engineer)]] (news.ycombinator.com)
*[[http://krugman.blogs.nytimes.com/2011/01/06/the-repeal-the-senior-murdering-secret-muslim-president-act/ HR 2 (Krugman)]]
Deletions:
[[http://krugman.blogs.nytimes.com/2011/01/06/the-repeal-the-senior-murdering-secret-muslim-president-act/ HR 2 (Krugman)]]


Revision [1795]

Edited on 2011-01-07 05:06:08 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://krugman.blogs.nytimes.com/2011/01/06/the-repeal-the-senior-murdering-secret-muslim-president-act/ HR 2 (Krugman)]]
Deletions:
http://krugman.blogs.nytimes.com/2011/01/06/the-repeal-the-senior-murdering-secret-muslim-president-act/


Revision [1794]

Edited on 2011-01-06 23:14:07 by KlenwellAdmin [adds lazy sampling]
Additions:
http://krugman.blogs.nytimes.com/2011/01/06/the-repeal-the-senior-murdering-secret-muslim-president-act/


Revision [1788]

Edited on 2011-01-06 19:00:49 by KlenwellAdmin [adds lazy sampling]
Additions:
NYR: CE Francis


Revision [1786]

Edited on 2011-01-06 18:59:15 by KlenwellAdmin [adds lazy sampling]
Additions:
""<small>links and notes for later organization</small>"">>[[CocktailNapkin2010 2010 Napkin]]
[[CocktailNapkin2009 2009 Napkin]]
Deletions:
""<small>links and notes for later organization</small>"">>[[CocktailNapkin2009 2009 Napkin]]
Emotibot: \m/(><)\m/
[[http://www.google.com/images?q=241543903&um=1&ie=UTF-8&source=og&sa=N&hl=en&tab=wi&biw=1366&bih=643 241543903]]
Twitter Bot Bracketology
NYR: Create a profile online for the person you want to be in the New Year, and be that person next year. (C. E. Francis)
Restaurant Templates, Medical Office Templates
[[http://goo.gl/y48DK TIL]] How much warning we'd have if a killer asteroid were bearing down on Earth...
[[http://www.reddit.com/r/fffffffuuuuuuuuuuuu/comments/eia8p/sarah_and_satan_slay_salmon_down_by_the_seashore/ salmon]]
Enabled cron for wiki on new vps
http://upload.wikimedia.org/wikipedia/en/b/bd/Sports_Illustrated_Miracle_on_Ice_cover.jpg
A [[http://i.imgur.com/hVSy6.jpg meme]]: [[http://media.syracuse.com/post-standard/photo/sarah-palin-cca83c184f28f369_large.jpg 1]] [[http://twitter.com/SarahPalinUSA/status/8564233180545024 2]] [[http://twitter.com/ha_satan/status/8567572337262593 3]] [[http://www.cathedralgrove.eu/pictures/01-4-spawned-b.jpg 4]]
Updating WordPress: http://codex.wordpress.org/Updating_WordPress
Python list.get(n):
%%
list_get = lambda l,n: len(l) > n and l[n]
l = [0,1,2,3]
print list_get(l,0)
print list_get(l,3)
print list_get(l,4)
%%
Twitter Search API
~- wget -O- http://search.twitter.com/search.json?q=hi
~- https://github.com/liris/tweepy/commit/831ec87dd476cc177f13a7cb37484e16086d8786
~- http://groups.google.com/group/tweepy/browse_thread/thread/205ba6965fc50e07#
app engine [[http://code.google.com/appengine/docs/python/taskqueue/overview.html task queues]]
php int to hash (for ids):
%%
<?php
function int_to_hash($int, $set_key='limited') {
$CodesetList = array(
'full' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
'limited' => 'abcdefghijklmnopqrstuvwxyz',
);
$pad = 100000;
$codeset = $CodesetList['limited'];

if ( isset($CodesetList[$set_key]) ) {
$codeset = $CodesetList[$set_key];
}

$hash = '';
$base = strlen($codeset);

$int += $pad;
while ($int > 0) {
$hash = substr($codeset, ($int % $base), 1) . $hash;
$int = floor($int/$base);
}

return $hash;
}
$TestSet = array(1,2,10,100,1000,10000,100000,999999,1000000);
print '<table>';
foreach ( $TestSet as $i ) {
printf('<tr><td>%s</td><td>%s</td></tr>', $i, int_to_hash($i));
}
print '</table>';
%%
mysql: "group by most recent"
That is: group results of a query such that only the most recent row of each group is returned
ref: http://www.artfulsoftware.com/infotree/queries.php?&bw=920#101
%%
# NOTE: this has not yet been tested
SELECT *
FROM (
SELECT *
FROM searches
WHERE terms = 'foo'
ORDER BY updated DESC
) AS s
LEFT JOIN results AS r ON r.id = s.result_id
GROUP BY result_id;
%%
python nltk unit test
%%
#!/usr/bin/python
"""
http://nltk.googlecode.com/svn/trunk/doc/book/ch05.html
"""
import unittest
import nltk
import sys, os
from os.path import dirname, exists, join, abspath
from datetime import date
#
# set base dir
#
base_marker = "__base__" # add this file to base dir
def find_base(base=dirname(__file__)):
if exists(join(base, base_marker)):
return base
if abspath(base) == '/':
raise Exception("Can't find project base! I was expecting it to be ../ or ../../.")
return find_base(join(base, '..'))
sys.path.append(find_base())
class TestTagging_5_1(unittest.TestCase):
def setUp(self):
pass


def tearDown(self):
pass

def testSimplePosTagger(self):
text = nltk.word_tokenize("And now for something completely different")
pos_tags = nltk.pos_tag(text)
self.assertEqual(pos_tags[2], ('for', 'IN'))
#print pos_tags
test_case_list = [TestTagging_5_1]
# main
if __name__ == "__main__":
for case in test_case_list:
suite = unittest.TestLoader().loadTestsFromTestCase(case)
unittest.TextTestRunner(verbosity=2).run(suite)
%%
[[http://freakonomics.blogs.nytimes.com/2010/08/09/what-do-you-want-to-hear-from-nassim-nicholas-taleb/comment-page-1/?apage=3#comments freakonomics blog NNT]]
bash pid example
%%
function start() {
if [[ -e $PID_FILE ]]; then
echo "server already running"
echo "if not running, try deleting pid file $PID_FILE"
exit 1
fi
paster serve development.ini &
PID=$!
sleep 1
echo $PID > $PID_FILE
echo 'server started'
}
function stop() {
if [[ ! -e $PID_FILE ]]; then
echo "pid file $PID_FILE not found"
echo "try 'ps aux' to stop manually"
exit 1
fi

PID=`cat $PID_FILE`
kill $PID
rm $PID_FILE
echo 'server stopped'
}
%%
bash find base: %%BASE=$(dirname $(readlink -fn $0))/..%%
parchment style: http://rlv.zcache.com/shakespeare_quotes_calendar-p1580846210289528122vxoc_400.jpg
[[http://groups.google.com/group/google-appengine-python/browse_thread/thread/1210c05bb37cb1be# app engine cron question]]
""<h5 id="nltk_meter">nltk example</h5>""http://nltk.googlecode.com/svn/trunk/doc/book/ch02.html#a-pronouncing-dictionary %%(python)
import nltk
#pdl = nltk.corpus.cmudict.entries()
pd = nltk.corpus.cmudict.dict()
def meter(pron):
return ''.join([str(int(bool(int(c)))) for p in pron for c in p if c.isdigit()])

def get_meter_list(m):
return [w for w, p in pdl if meter(p) == m]

#print len(get_meter_list('0'))
#print len(get_meter_list('1'))
def tokenize(sent):
return [w.strip().lower() for w in sent.split(' ')]

def scan(line):
m = []
for w in tokenize(line):
m.append(meter(pd.get(w)[0]))

return ''.join(m)
sent = 'A rose is a rose is a rose is a rose'
print scan(sent)
%%
""<h5 id="python_buffer_capture">python buffer capture (assign stdout to a variable)</h5>""%%
class BufferTestCase(unittest.TestCase):

def openBuffer(self):
import StringIO, sys
self.old_buffer = sys.stdout
sys.stdout = self.new_buffer = StringIO.StringIO()
return self.old_buffer

def closeBuffer(self):
buffer_content = self.new_buffer.getvalue()
sys.stdout = self.old_buffer
self.new_buffer.close()
return buffer_content

def testBuffer(self):
self.openBuffer()
print 'hello'
buffer = self.closeBuffer()
self.assertEqual(buffer, 'hello\n')
%%
python string diff:
%%
from difflib import Differ
d = Differ()
print '\n'.join(list(d.compare(app_output, expect)))
%%
google group question: [[http://groups.google.com/group/google-appengine-python/browse_thread/thread/ca1b6838bc68d64a/5be4288579bc5a77?q=klenwell#5be4288579bc5a77 serve atom through appengine]]
python:
%%
import re
def re_ungreedy(re_, s):
r = re_.replace('%s', '(.*?)')
return re.search(r, s).groups()
re_ = "<h2>%s</h2>"
H2List = re_ungreedy(re_, '<h2>one</h2><h2>two</h2>')
%%
python debugger: ""<tt>import pdb; pdb.set_trace()</tt>""
php safe query builder
%%
function safe_sql($sqlf, $ParamList) {
$SafeParamList = array();
foreach ( $ParamList as $value ) {
$SafeParamList[] = mysql_real_escape_string($value);
}
$SprintfArgList = array_merge(array($sqlf), $SafeParamList);
return call_user_func_array('sprintf', $SprintfArgList);
}
%%
PEAR HTTP_Request2 [[http://pear.php.net/manual/en/package.http.http-request2.intro.php docs]] [[http://pear.php.net/package/HTTP_Request2/docs/latest/HTTP_Request2/HTTP_Request2.html api]]
%%
<?php
/*
HTTP_Request2 Demo

Lib File Tree
kw_pear\
HTTP\
Request2\
Request2.php
Net\
URL2.php
PEAR\
Exception.php
PEAR.php
*/
$wwwd = dirname(dirname(__FILE__));
$peard = sprintf('%s/%s', $wwwd, 'kw_pear');
$path_ext = implode(PATH_SEPARATOR, array(get_include_path(),
$peard));
# imports
ini_set('include_path', $path_ext);
require_once 'HTTP/Request2.php';
$UrlList = array(
'ok' => 'http://pear.php.net/package/HTTP_Request2/docs',
'404' => 'http://pear.php.net/package/HTTP_Request2/docs/null',
'fail' => 'bad url'
);
$TestList = array_keys($UrlList);
$test = $TestList[array_rand($TestList)];
$url = $UrlList[$test];
$Client = new HTTP_Request2();
$Client->setMethod(HTTP_Request2::METHOD_GET);
$Client->setUrl($url);
try {
$Response = $Client->send();
$code = $Response->getStatus();
$code_class = floor($Response->getStatus() / 100);
}
catch (HTTP_Request2_Exception $e) {
trigger_error(sprintf('http exception: %s',
$e->getMessage()), E_USER_ERROR);
}
if ( $code_class == 2 ) {
$output = htmlspecialchars($Response->getBody());
}
else {
$output = sprintf('unexpected response [%s]: %s',
$Response->getStatus(),
$Response->getReasonPhrase());
}
printf('<h4>test: %s</h4><pre>%s</pre>', $test, $output);
%%
copy with exclude: ""<tt>rsync -rv --exclude=.svn source/* dest</tt>""
wikka update page function:
%%
function update_page($page_name, $page_body, $WikkaObj) {
$updatef = "UPDATE %s SET latest='N' WHERE tag='%s'";
$insertf = "INSERT INTO %s SET tag='%s', body='%s', owner='%s', user='%s', note='%s', time=NOW(), latest='Y'";
$note = 'auto updating page';
$user = '(system)';
$table_prefix = $WikkaObj->GetConfigValue('table_prefix');
$table_name = sprintf('%spages', $table_prefix);
$page_name = mysql_real_escape_string($page_name);
$page_body = mysql_real_escape_string($page_body);

if ( $WikkaObj->existsPage($page_name, $table_prefix) ) {
# set all other revisions to old
$is_updated = $WikkaObj->Query(sprintf($updatef, $table_name, $page_name));
}

# add new revision
return $WikkaObj->Query( sprintf( $insertf,
$table_name,
$page_name,
$page_body,
'(Public)',
$user,
$note ));
%%
To call a script, you can make it as handler and put it at (as of 1.1.6.2) the directory named handlers/page/, ie like handlers/page/cron.changemail.php [[http://wikkawiki.org/RecentChangesNotifier?show_comments=1#comments source]]
%%
function log() {
datestamp=$(date "+%Y-%m-%d %H:%M:%S")
printf "[%s] %s\n" "$datestamp" "$1"
}
CACHE_FILE_COUNT=$(find /tmp -type f | wc -l)
if [ $CACHE_FILE_COUNT -gt 0 ]; then
log "$CACHE_FILE_COUNT files found in /tmp"
else
log "no files found in /tmp"
fi
%%
Office Hacks: during ethnic holidays, go up to people at random and ask if they have any plans. (e.g.: week before passover, ask Chinese co-worker: "so do you have any Passover plans this weekend?")
Against the [[http://corneredcat.com/Ethics/civilization.aspx Gun is Civilization Argument]]: Pastebin20100226
Pattern Request Page: jquery json ajax request with cakephp
[[http://news.ycombinator.com/threads?id=klenwell ycombo]]
[[http://i.imgur.com/OAvqY.jpg fly bomber]] (it's supafly)
[[http://www.youtube.com/watch?v=IKmCCIjgY4E classic olympic fail]]
[[http://groups.google.com/group/gdata-python-client-library-contributors/browse_thread/thread/eaa1bb7aecca54a7 gdata python question on google groups]]
[[http://images.google.com/imgres?imgurl=http://gregcookland.com/journal/uploaded_images/picComteRizzoli-766773.jpg&imgrefurl=http://gregcookland.com/journal/2008_06_15_archive.html&usg=__USS6LoobgDc3pWmwX-xN6gNekmI=&h=320&w=400&sz=29&hl=en&start=5&um=1&itbs=1&tbnid=Ey-NAsHfo6f9VM:&tbnh=99&tbnw=124&prev=/images%3Fq%3Dzaha%2Bhadid%2Byoung%26hl%3Den%26sa%3DG%26um%3D1 curious]]
copying DB in php
%%(php)
function _switch_database($new_db) {
$Dbo = ConnectionManager::getDataSource("default");
$old_db = $Dbo->config['database'];
$Dbo->reconnect(array('database'=>$new_db));
return $old_db;
}

function _copy_database($db, $new_db) {
$Dbo = ConnectionManager::getDataSource("default");

# get tables
$sql_show_tables_ = 'SHOW TABLES IN %s';
$extract_pattern = sprintf('{n}.TABLE_NAMES.Tables_in_%s', $db);
$ShowTables = $Dbo->query(sprintf($sql_show_tables_, $db));
$TableList = Set::extract($ShowTables, $extract_pattern);

# create new database
$sql = sprintf('CREATE DATABASE %s', $new_db);
$Dbo->query($sql);

# copy tables
$sql1_t = 'CREATE TABLE %s.%s LIKE %s.%s';
$sql2_t = 'INSERT INTO %s.%s SELECT * FROM %s.%s';
foreach ( $TableList as $table ) {
$sql1 = sprintf($sql1_t, $new_db, $table, $db, $table);
$sql2 = sprintf($sql2_t, $new_db, $table, $db, $table);
$Dbo->query($sql1);
$Dbo->query($sql2);
}

# test table lists
$ShowTables = $Dbo->query(sprintf($sql_show_tables_, $db));
$TableList1 = Set::extract($ShowTables, "{n}.TABLE_NAMES.Tables_in_$db");

$ShowTables = $Dbo->query(sprintf($sql_show_tables_, $new_db));
$TableList2 = Set::extract($ShowTables, "{n}.TABLE_NAMES.Tables_in_$new_db");

if ( array_diff($TableList1, $TableList2) ) {
trigger_error('table lists in new db dows not match old', E_USER_WARNING);
return 0;
}
$this->Log_[] = "all tables in $db copied to $new_db";

# test query: count all records and compare
$old_db_count = 0;
$new_db_count = 0;
foreach ( $TableList as $table ) {
$sql_ = 'SELECT COUNT(*) as count_ FROM %s.%s';
$OldDb = $Dbo->query(sprintf($sql_, $db, $table));
$NewDb = $Dbo->query(sprintf($sql_, $new_db, $table));
$old_db_count += $OldDb[0][0]['count_'];
$new_db_count += $NewDb[0][0]['count_'];
}
$rand_table = $TableList[array_rand($TableList)];


if ( $old_db_count != $new_db_count ) {
$mt_ = 'record count for new db (%s) and old db (%s) does not match';
trigger_error(sprintf($mt_, $new_db_count, $old_db_count), E_USER_WARNING);
return 0;
}
else {
$mt_ = 'record count for new db (%s) and old db (%s)';
$this->Log_[] = sprintf($mt_, $new_db_count, $old_db_count);
return 1;
}
}
%%
php encoding tests
requires http://hsivonen.iki.fi/php-utf8/php-utf8.tar.gz
%%(php)
<?php
require('utf8.inc');
$char = 'Ü';
$h_char = htmlentities($char);
$utf8 = htmlspecialchars($char, ENT_QUOTES, 'UTF-8');
$h_utf8 = htmlentities($utf8);
$uni_char = utf8ToUnicode($char);
$data = array(
'$char' => $char,
'$h_char - htmlentities($char)' => $h_char,
'$utf8 - htmlspecialchars($char,ENT_QUOTES,\'UTF-8\')' =>
$utf8,
'htmlspecialchars(\'Ü\',ENT_QUOTES,\'UTF-8\')' =>
htmlspecialchars('Ü', ENT_QUOTES, 'UTF-8'),
'$h_utf8 - htmlentities($utf8)' =>
$h_utf8,
'strlen($char)' => strlen($char),
'strlen($h_char)' => strlen($h_char),
'strlen($utf8)' => strlen($utf8),
'strlen($h_utf8)' => strlen($h_utf8),
'ord($char)' => ord($char),
'ord($utf8)' => ord($utf8),
'utf8ToUnicode($char)' => $uni_char,
'dechex(ord($char))' => dechex(ord($char)),
'sprintf(\'&#x%s;\', dechex(ord($char)))' =>
sprintf('&#x%s;', dechex(ord($char))),
'sprintf(\'&#x%s;\', ord($char))' =>
sprintf('&#x%s;', ord($char)),
'sprintf(\'&#%s;\', $uni_char[0])' =>
sprintf('&#%s;', $uni_char[0]),
'sprintf("&#x%s;", dechex($uni_char[0]))' =>
sprintf("&#x%s;", dechex($uni_char[0])),
'iconv("UTF-8","ISO-8859-1//TRANSLIT",$char)' =>
iconv("UTF-8","ISO-8859-1//TRANSLIT",$char),
);

$xhtml = <<<XHTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>sandbox</title></head>
<body>
<pre>
%s
</pre>
</body>
</html>
XHTML;
$charset = 'UTF-8'; #'ISO-8859-1';
header( 'Content-type: text/html; charset='.$charset );
printf($xhtml, print_r($data,1));
var_dump($char);
var_dump($h_char);
var_dump($utf8);
var_dump($h_utf8);
%%
jquery quiz
%%
== jQuiz: jQuirks ==
A short quiz on jQuery behavior.
===1. What will these lines of code produce?===
<code><pre>
var Test1El1 = $('div#Test1El1');
var Test1El2 = $('div').attr('id', 'Test1El2');
var Test1El3 = $('<div id="Test1El3" />');
console.log(Test1El1);
console.log(Test1El2);
console.log(Test1El3);
</pre></code>
===2. What will be the output of the code below?===
<code><pre>
var Test2El1 = $('<div id="Test2El1" />');
$(document.body).append(Test2El1);
var elid = Test2El1Test2El1.attr('id');
var Test2El2 = $(elid);
console.log(Test2El1);
console.log(elid);
console.log(Test2El2);
</pre></code>
===3. True or False===
<code><pre>
var id_ = 'test3id';
$('<div id="' + id_ + '" />').appendTo(document.body);
var Test3El1 = document.getElementById(id_);
var Test3El2 = $('#'+id_);
console.log(Test3El1.id == Test3El2.id);
</pre></code>
===4. True or False===
<code><pre>
var Test4El1 = $('<div id="Test4El" />').appendTo(document.body);
var Test4El2 = $(Test4El1);
console.log(Test4El1 == Test4El2);
console.log(Test4El1.attr('id') == Test4El2.attr('id'));
</pre></code>
===Given a document with the following table code, answer the next 2 questions:===
<code><pre>
<table id="Test5Table">
<tr id="Test5Tr1"><td>cell1</td><td>cell2</td></tr>
<tr id="Test5Tr2"><td>cell1</td><td>cell2</td></tr>
</table>
var Test5Table = $('<table id="Test5Table"><tr id="tr1"><td>cell1</td><td>cell2</td></tr><tr id="tr2"><td>cell1</td><td>cell2</td></tr></table>');
$(document.body).append(Test5Table);
</pre></code>
====5. What will the value of TableRows[0] be below?====
<code><pre>
var Test5Table = $('table#Test5Table');
var TableRows = Test5Table.find('tr');
console.log(TableRows[0].attr('id'));
</pre></code>
====6. What will the value of RowIds[0] be below?====
<code><pre>
var Test5Table = $('table#Test5Table');
var TableRows = Test5Table.find('tr');
var RowIds = [];
TableRows.each( function(i, El) {
RowIds.push(El.attr('id'));
});
console.log(RowIds[0]);
</pre></code>
===7. What will the value of FindEl be below?===
<code><pre>
// build and add element to our document
var elid = 'formbid-0.field';
var NewDiv = $('<div id="'+elid+'" />').text(elid);
$(document.body).append(NewDiv);
var jqid = NewDiv.attr('id');
var FindEl = $(document.body).find('#'+jqid); // note # sign
console.log(jqid, FindEl);
</pre></code>
<div style="display:none;">Answer:
<code><pre>
jesc = jqid.replace('.', '\\.');
var FindEl = $(document.body).find('#'+jesc);
console.log(jesc, FindEl);
</pre></code>
</div>
%%
**music on-demand**
[[http://www.reddit.com/r/programming/comments/aq59o/for_those_of_you_who_dont_know_about_it_firebug/c0iuayh this]] + http://www.dizzler.com/ + http://getfirebug.com/net.html
some cakephp code
%%
function render($action=NULL, $layout=NULL, $file=NULL) {
if ( $action == null ) {
$action = $this->view_action;
}
$output = parent::render($action, $layout, $file);
return $output;
}
function index()
{
$m = 'null';
if ( isset($this->params['pass'][0]) ) {
$m = $this->params['pass'][0];
}
#debug($this->params);
#debug($m);

if ( method_exists($this, $m) ) {
$this->view_action = sprintf('/journal/%s', $m);
return $this->$m();
}
else {
$this->set('error', 'page_not_found');
}
}
%%


Revision [1781]

Edited on 2010-12-29 03:19:31 by KlenwellAdmin [adds lazy sampling]
Additions:
Emotibot: \m/(><)\m/


Revision [1780]

Edited on 2010-12-28 17:56:25 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.google.com/images?q=241543903&um=1&ie=UTF-8&source=og&sa=N&hl=en&tab=wi&biw=1366&bih=643 241543903]]


Revision [1777]

Edited on 2010-12-28 16:15:19 by KlenwellAdmin [adds lazy sampling]
Additions:
""<small>links and notes for later organization</small>"">>[[CocktailNapkin2009 2009 Napkin]]
[[CocktailQuestions Questions for Strangers]]>>
Twitter Bot Bracketology
NYR: Create a profile online for the person you want to be in the New Year, and be that person next year. (C. E. Francis)
Restaurant Templates, Medical Office Templates
Deletions:
""<small>links and notes for later organization</small>""
[[CocktailNapkin2009 2009 Napkin]]
[[CocktailQuestions Questions for Strangers]]


Revision [1774]

Edited on 2010-12-14 23:23:27 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://goo.gl/y48DK TIL]] How much warning we'd have if a killer asteroid were bearing down on Earth...
Deletions:
[[http://goo.gl/y48DK TIL]] How much warning...


Revision [1773]

Edited on 2010-12-14 23:21:53 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://goo.gl/y48DK TIL]] How much warning...


Revision [1764]

Edited on 2010-12-08 14:12:28 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.reddit.com/r/fffffffuuuuuuuuuuuu/comments/eia8p/sarah_and_satan_slay_salmon_down_by_the_seashore/ salmon]]


Revision [1763]

Edited on 2010-12-07 06:09:48 by KlenwellAdmin [adds lazy sampling]
Additions:
Enabled cron for wiki on new vps


Revision [1762]

Edited on 2010-12-04 17:33:33 by KlenwellAdmin [adds lazy sampling]
Additions:
A [[http://i.imgur.com/hVSy6.jpg meme]]: [[http://media.syracuse.com/post-standard/photo/sarah-palin-cca83c184f28f369_large.jpg 1]] [[http://twitter.com/SarahPalinUSA/status/8564233180545024 2]] [[http://twitter.com/ha_satan/status/8567572337262593 3]] [[http://www.cathedralgrove.eu/pictures/01-4-spawned-b.jpg 4]]
Deletions:
A meme: [[http://media.syracuse.com/post-standard/photo/sarah-palin-cca83c184f28f369_large.jpg 1]] [[http://twitter.com/SarahPalinUSA/status/8564233180545024 2]] [[http://twitter.com/ha_satan/status/8567572337262593 3]] [[http://www.cathedralgrove.eu/pictures/01-4-spawned-b.jpg 4]]


Revision [1761]

Edited on 2010-12-04 16:52:52 by KlenwellAdmin [adds lazy sampling]
Additions:
http://upload.wikimedia.org/wikipedia/en/b/bd/Sports_Illustrated_Miracle_on_Ice_cover.jpg


Revision [1760]

Edited on 2010-12-04 16:46:07 by KlenwellAdmin [adds lazy sampling]
Additions:
A meme: [[http://media.syracuse.com/post-standard/photo/sarah-palin-cca83c184f28f369_large.jpg 1]] [[http://twitter.com/SarahPalinUSA/status/8564233180545024 2]] [[http://twitter.com/ha_satan/status/8567572337262593 3]] [[http://www.cathedralgrove.eu/pictures/01-4-spawned-b.jpg 4]]
Deletions:
A meme: [[http://media.syracuse.com/post-standard/photo/sarah-palin-cca83c184f28f369_large.jpg 1]] [[http://twitter.com/SarahPalinUSA/status/8564233180545024 2]] [[http://twitter.com/ha_satan/status/8567572337262593 3]] [[http://media.washingtonpost.com/wp-dyn/content/photo/2007/06/26/PH2007062601922.jpg 4]]


Revision [1759]

Edited on 2010-12-04 16:37:56 by KlenwellAdmin [adds lazy sampling]
Additions:
A meme: [[http://media.syracuse.com/post-standard/photo/sarah-palin-cca83c184f28f369_large.jpg 1]] [[http://twitter.com/SarahPalinUSA/status/8564233180545024 2]] [[http://twitter.com/ha_satan/status/8567572337262593 3]] [[http://media.washingtonpost.com/wp-dyn/content/photo/2007/06/26/PH2007062601922.jpg 4]]


Revision [1749]

Edited on 2010-12-01 15:31:40 by KlenwellAdmin [adds lazy sampling]
Additions:
Updating WordPress: http://codex.wordpress.org/Updating_WordPress
Deletions:
Updating Wordpress: http://codex.wordpress.org/Updating_WordPress


Revision [1748]

Edited on 2010-12-01 15:31:28 by KlenwellAdmin [adds lazy sampling]
Additions:
Updating Wordpress: http://codex.wordpress.org/Updating_WordPress


Revision [1724]

Edited on 2010-11-19 10:45:55 by KlenwellAdmin [adds lazy sampling]
Additions:
Python list.get(n):
list_get = lambda l,n: len(l) > n and l[n]
l = [0,1,2,3]
print list_get(l,0)
print list_get(l,3)
print list_get(l,4)


Revision [1697]

Edited on 2010-11-09 07:39:33 by KlenwellAdmin [adds lazy sampling]
Additions:
~- http://groups.google.com/group/tweepy/browse_thread/thread/205ba6965fc50e07#


Revision [1696]

Edited on 2010-11-09 07:35:28 by KlenwellAdmin [adds lazy sampling]
Additions:
Twitter Search API
~- wget -O- http://search.twitter.com/search.json?q=hi
~- https://github.com/liris/tweepy/commit/831ec87dd476cc177f13a7cb37484e16086d8786


Revision [1604]

Edited on 2010-10-06 08:10:15 by KlenwellAdmin [adds lazy sampling]
Additions:
SpecialReading


Revision [1602]

Edited on 2010-10-04 08:15:48 by KlenwellAdmin [adds lazy sampling]
Additions:
app engine [[http://code.google.com/appengine/docs/python/taskqueue/overview.html task queues]]


Revision [1583]

Edited on 2010-09-23 10:27:54 by KlenwellAdmin [adds lazy sampling]
Additions:
php int to hash (for ids):
function int_to_hash($int, $set_key='limited') {
$CodesetList = array(
'full' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
'limited' => 'abcdefghijklmnopqrstuvwxyz',
$pad = 100000;
$codeset = $CodesetList['limited'];
if ( isset($CodesetList[$set_key]) ) {
$codeset = $CodesetList[$set_key];
$hash = '';
$base = strlen($codeset);
$int += $pad;
while ($int > 0) {
$hash = substr($codeset, ($int % $base), 1) . $hash;
$int = floor($int/$base);
return $hash;
$TestSet = array(1,2,10,100,1000,10000,100000,999999,1000000);
print '<table>';
foreach ( $TestSet as $i ) {
printf('<tr><td>%s</td><td>%s</td></tr>', $i, int_to_hash($i));
print '</table>';


Revision [1569]

Edited on 2010-09-16 08:25:11 by KlenwellAdmin [adds lazy sampling]
Additions:
mysql: "group by most recent"
That is: group results of a query such that only the most recent row of each group is returned
ref: http://www.artfulsoftware.com/infotree/queries.php?&bw=920#101
# NOTE: this has not yet been tested
SELECT *
FROM (
SELECT *
FROM searches
WHERE terms = 'foo'
ORDER BY updated DESC
) AS s
LEFT JOIN results AS r ON r.id = s.result_id
GROUP BY result_id;


Revision [1556]

Edited on 2010-08-27 10:03:00 by KlenwellAdmin [adds lazy sampling]
Additions:
python nltk unit test
#!/usr/bin/python
"""
http://nltk.googlecode.com/svn/trunk/doc/book/ch05.html
"""
import unittest
import sys, os
from os.path import dirname, exists, join, abspath
from datetime import date
#
# set base dir
#
base_marker = "__base__" # add this file to base dir
def find_base(base=dirname(__file__)):
if exists(join(base, base_marker)):
return base
if abspath(base) == '/':
raise Exception("Can't find project base! I was expecting it to be ../ or ../../.")
return find_base(join(base, '..'))
sys.path.append(find_base())
class TestTagging_5_1(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def testSimplePosTagger(self):
text = nltk.word_tokenize("And now for something completely different")
pos_tags = nltk.pos_tag(text)
self.assertEqual(pos_tags[2], ('for', 'IN'))
#print pos_tags
test_case_list = [TestTagging_5_1]
# main
if __name__ == "__main__":
for case in test_case_list:
suite = unittest.TestLoader().loadTestsFromTestCase(case)
unittest.TextTestRunner(verbosity=2).run(suite)


Revision [1544]

Edited on 2010-08-11 12:15:55 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://freakonomics.blogs.nytimes.com/2010/08/09/what-do-you-want-to-hear-from-nassim-nicholas-taleb/comment-page-1/?apage=3#comments freakonomics blog NNT]]


Revision [1533]

Edited on 2010-08-05 12:20:26 by KlenwellAdmin [adds lazy sampling]
Additions:
bash pid example
function start() {
if [[ -e $PID_FILE ]]; then
echo "server already running"
echo "if not running, try deleting pid file $PID_FILE"
exit 1
fi
paster serve development.ini &
PID=$!
sleep 1
echo $PID > $PID_FILE
echo 'server started'
function stop() {
if [[ ! -e $PID_FILE ]]; then
echo "pid file $PID_FILE not found"
echo "try 'ps aux' to stop manually"
exit 1
fi
PID=`cat $PID_FILE`
kill $PID
rm $PID_FILE
echo 'server stopped'


Revision [1503]

Edited on 2010-07-13 12:19:02 by KlenwellAdmin [adds lazy sampling]
Additions:
bash find base: %%BASE=$(dirname $(readlink -fn $0))/..%%


Revision [1500]

Edited on 2010-07-12 15:18:06 by KlenwellAdmin [adds lazy sampling]
Additions:
parchment style: http://rlv.zcache.com/shakespeare_quotes_calendar-p1580846210289528122vxoc_400.jpg


Revision [1446]

Edited on 2010-06-28 14:02:02 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://groups.google.com/group/google-appengine-python/browse_thread/thread/1210c05bb37cb1be# app engine cron question]]


Revision [1429]

Edited on 2010-06-03 14:12:46 by KlenwellAdmin [adds lazy sampling]
Additions:
""<h5 id="nltk_meter">nltk example</h5>""http://nltk.googlecode.com/svn/trunk/doc/book/ch02.html#a-pronouncing-dictionary %%(python)
import nltk
#pdl = nltk.corpus.cmudict.entries()
pd = nltk.corpus.cmudict.dict()
def meter(pron):
return ''.join([str(int(bool(int(c)))) for p in pron for c in p if c.isdigit()])

def get_meter_list(m):
return [w for w, p in pdl if meter(p) == m]
#print len(get_meter_list('0'))
#print len(get_meter_list('1'))
def tokenize(sent):
return [w.strip().lower() for w in sent.split(' ')]
def scan(line):
m = []
for w in tokenize(line):
m.append(meter(pd.get(w)[0]))
return ''.join(m)
sent = 'A rose is a rose is a rose is a rose'
print scan(sent)
""<h5 id="python_buffer_capture">python buffer capture (assign stdout to a variable)</h5>""%%
Deletions:
""<h4 id="python_buffer_capture">python buffer capture (assign stdout to a variable)</h4>""


Revision [1411]

Edited on 2010-05-21 16:07:29 by KlenwellAdmin [adds lazy sampling]
Additions:
""<h4 id="python_buffer_capture">python buffer capture (assign stdout to a variable)</h4>""
Deletions:
""<h4 id="python_buffer_capture>python buffer capture (assign stdout to a variable)</h4>""


Revision [1410]

Edited on 2010-05-21 16:07:13 by KlenwellAdmin [adds lazy sampling]
Additions:
""<h4 id="python_buffer_capture>python buffer capture (assign stdout to a variable)</h4>""
Deletions:
python buffer capture (assign stdout to a variable):


Revision [1409]

Edited on 2010-05-21 16:06:31 by KlenwellAdmin [adds lazy sampling]
Additions:
python buffer capture (assign stdout to a variable):
class BufferTestCase(unittest.TestCase):
def openBuffer(self):
import StringIO, sys
self.old_buffer = sys.stdout
sys.stdout = self.new_buffer = StringIO.StringIO()
return self.old_buffer
def closeBuffer(self):
buffer_content = self.new_buffer.getvalue()
sys.stdout = self.old_buffer
self.new_buffer.close()
return buffer_content
def testBuffer(self):
self.openBuffer()
print 'hello'
buffer = self.closeBuffer()
self.assertEqual(buffer, 'hello\n')


Revision [1408]

Edited on 2010-05-21 11:09:43 by KlenwellAdmin [adds lazy sampling]
Additions:
python string diff:
from difflib import Differ
d = Differ()
print '\n'.join(list(d.compare(app_output, expect)))


Revision [1342]

Edited on 2010-05-02 20:16:14 by KlenwellAdmin [adds lazy sampling]
Additions:
google group question: [[http://groups.google.com/group/google-appengine-python/browse_thread/thread/ca1b6838bc68d64a/5be4288579bc5a77?q=klenwell#5be4288579bc5a77 serve atom through appengine]]


Revision [1341]

Edited on 2010-05-02 11:06:39 by KlenwellAdmin [adds lazy sampling]
Additions:
python:
import re
def re_ungreedy(re_, s):
r = re_.replace('%s', '(.*?)')
return re.search(r, s).groups()
re_ = "<h2>%s</h2>"
H2List = re_ungreedy(re_, '<h2>one</h2><h2>two</h2>')


Revision [1325]

Edited on 2010-04-26 10:32:24 by KlenwellAdmin [adds lazy sampling]
Additions:
python debugger: ""<tt>import pdb; pdb.set_trace()</tt>""


Revision [1303]

Edited on 2010-04-16 11:47:59 by KlenwellAdmin [adds lazy sampling]
Additions:
php safe query builder
function safe_sql($sqlf, $ParamList) {
$SafeParamList = array();
foreach ( $ParamList as $value ) {
$SafeParamList[] = mysql_real_escape_string($value);
$SprintfArgList = array_merge(array($sqlf), $SafeParamList);
return call_user_func_array('sprintf', $SprintfArgList);


Revision [1188]

Edited on 2010-03-30 14:48:49 by KlenwellAdmin [adds lazy sampling]
Additions:
PEAR HTTP_Request2 [[http://pear.php.net/manual/en/package.http.http-request2.intro.php docs]] [[http://pear.php.net/package/HTTP_Request2/docs/latest/HTTP_Request2/HTTP_Request2.html api]]


Revision [1187]

Edited on 2010-03-30 14:46:55 by KlenwellAdmin [adds lazy sampling]
Additions:
/*
HTTP_Request2 Demo
Lib File Tree
kw_pear\
HTTP\
Request2\
Request2.php
Net\
URL2.php
PEAR\
Exception.php
PEAR.php
*/
$wwwd = dirname(dirname(__FILE__));
$peard = sprintf('%s/%s', $wwwd, 'kw_pear');
$path_ext = implode(PATH_SEPARATOR, array(get_include_path(),
$peard));
# imports
ini_set('include_path', $path_ext);
require_once 'HTTP/Request2.php';
$UrlList = array(
'ok' => 'http://pear.php.net/package/HTTP_Request2/docs',
'404' => 'http://pear.php.net/package/HTTP_Request2/docs/null',
'fail' => 'bad url'
);
$TestList = array_keys($UrlList);
$test = $TestList[array_rand($TestList)];
$url = $UrlList[$test];
$Client = new HTTP_Request2();
$Client->setMethod(HTTP_Request2::METHOD_GET);
$Client->setUrl($url);
try {
$Response = $Client->send();
$code = $Response->getStatus();
$code_class = floor($Response->getStatus() / 100);
catch (HTTP_Request2_Exception $e) {
trigger_error(sprintf('http exception: %s',
$e->getMessage()), E_USER_ERROR);
if ( $code_class == 2 ) {
$output = htmlspecialchars($Response->getBody());
else {
$output = sprintf('unexpected response [%s]: %s',
$Response->getStatus(),
$Response->getReasonPhrase());
printf('<h4>test: %s</h4><pre>%s</pre>', $test, $output);


Revision [1163]

Edited on 2010-03-24 21:52:18 by KlenwellAdmin [adds lazy sampling]
Additions:
copy with exclude: ""<tt>rsync -rv --exclude=.svn source/* dest</tt>""


Revision [1162]

Edited on 2010-03-24 12:31:08 by KlenwellAdmin [adds lazy sampling]
Additions:
wikka update page function:
function update_page($page_name, $page_body, $WikkaObj) {
$updatef = "UPDATE %s SET latest='N' WHERE tag='%s'";
$insertf = "INSERT INTO %s SET tag='%s', body='%s', owner='%s', user='%s', note='%s', time=NOW(), latest='Y'";
$note = 'auto updating page';
$user = '(system)';
$table_prefix = $WikkaObj->GetConfigValue('table_prefix');
$table_name = sprintf('%spages', $table_prefix);
$page_name = mysql_real_escape_string($page_name);
$page_body = mysql_real_escape_string($page_body);
if ( $WikkaObj->existsPage($page_name, $table_prefix) ) {
# set all other revisions to old
$is_updated = $WikkaObj->Query(sprintf($updatef, $table_name, $page_name));
# add new revision
return $WikkaObj->Query( sprintf( $insertf,
$table_name,
$page_name,
$page_body,
'(Public)',
$user,
$note ));


Revision [1161]

Edited on 2010-03-23 14:51:55 by KlenwellAdmin [adds lazy sampling]
Additions:
To call a script, you can make it as handler and put it at (as of 1.1.6.2) the directory named handlers/page/, ie like handlers/page/cron.changemail.php [[http://wikkawiki.org/RecentChangesNotifier?show_comments=1#comments source]]


Revision [1143]

Edited on 2010-03-20 22:17:40 by KlenwellAdmin [adds lazy sampling]
Additions:
function log() {
datestamp=$(date "+%Y-%m-%d %H:%M:%S")
printf "[%s] %s\n" "$datestamp" "$1"
}
CACHE_FILE_COUNT=$(find /tmp -type f | wc -l)
if [ $CACHE_FILE_COUNT -gt 0 ]; then
log "$CACHE_FILE_COUNT files found in /tmp"
else
log "no files found in /tmp"
fi


Revision [1142]

Edited on 2010-03-19 08:14:12 by KlenwellAdmin [adds lazy sampling]
Additions:
Office Hacks: during ethnic holidays, go up to people at random and ask if they have any plans. (e.g.: week before passover, ask Chinese co-worker: "so do you have any Passover plans this weekend?")
$Dbo = ConnectionManager::getDataSource("default");
$old_db = $Dbo->config['database'];
$Dbo->reconnect(array('database'=>$new_db));
return $old_db;
$Dbo = ConnectionManager::getDataSource("default");

# get tables
$sql_show_tables_ = 'SHOW TABLES IN %s';
$extract_pattern = sprintf('{n}.TABLE_NAMES.Tables_in_%s', $db);
$ShowTables = $Dbo->query(sprintf($sql_show_tables_, $db));
$TableList = Set::extract($ShowTables, $extract_pattern);

# create new database
$sql = sprintf('CREATE DATABASE %s', $new_db);
$Dbo->query($sql);

# copy tables
$sql1_t = 'CREATE TABLE %s.%s LIKE %s.%s';
$sql2_t = 'INSERT INTO %s.%s SELECT * FROM %s.%s';
foreach ( $TableList as $table ) {
$sql1 = sprintf($sql1_t, $new_db, $table, $db, $table);
$sql2 = sprintf($sql2_t, $new_db, $table, $db, $table);
$Dbo->query($sql1);
$Dbo->query($sql2);
}

# test table lists
$ShowTables = $Dbo->query(sprintf($sql_show_tables_, $db));
$TableList1 = Set::extract($ShowTables, "{n}.TABLE_NAMES.Tables_in_$db");

$ShowTables = $Dbo->query(sprintf($sql_show_tables_, $new_db));
$TableList2 = Set::extract($ShowTables, "{n}.TABLE_NAMES.Tables_in_$new_db");

if ( array_diff($TableList1, $TableList2) ) {
trigger_error('table lists in new db dows not match old', E_USER_WARNING);
return 0;
}
$this->Log_[] = "all tables in $db copied to $new_db";

# test query: count all records and compare
$old_db_count = 0;
$new_db_count = 0;
foreach ( $TableList as $table ) {
$sql_ = 'SELECT COUNT(*) as count_ FROM %s.%s';
$OldDb = $Dbo->query(sprintf($sql_, $db, $table));
$NewDb = $Dbo->query(sprintf($sql_, $new_db, $table));
$old_db_count += $OldDb[0][0]['count_'];
$new_db_count += $NewDb[0][0]['count_'];
}
$rand_table = $TableList[array_rand($TableList)];


if ( $old_db_count != $new_db_count ) {
$mt_ = 'record count for new db (%s) and old db (%s) does not match';
trigger_error(sprintf($mt_, $new_db_count, $old_db_count), E_USER_WARNING);
return 0;
}
else {
$mt_ = 'record count for new db (%s) and old db (%s)';
$this->Log_[] = sprintf($mt_, $new_db_count, $old_db_count);
return 1;
}
'$char' => $char,
'$h_char - htmlentities($char)' => $h_char,
'$utf8 - htmlspecialchars($char,ENT_QUOTES,\'UTF-8\')' =>
$utf8,
'htmlspecialchars(\'Ü\',ENT_QUOTES,\'UTF-8\')' =>
htmlspecialchars('Ü', ENT_QUOTES, 'UTF-8'),
'$h_utf8 - htmlentities($utf8)' =>
$h_utf8,
'strlen($char)' => strlen($char),
'strlen($h_char)' => strlen($h_char),
'strlen($utf8)' => strlen($utf8),
'strlen($h_utf8)' => strlen($h_utf8),
'ord($char)' => ord($char),
'ord($utf8)' => ord($utf8),
'utf8ToUnicode($char)' => $uni_char,
'dechex(ord($char))' => dechex(ord($char)),
'sprintf(\'&#x%s;\', dechex(ord($char)))' =>
sprintf('&#x%s;', dechex(ord($char))),
'sprintf(\'&#x%s;\', ord($char))' =>
sprintf('&#x%s;', ord($char)),
'sprintf(\'&#%s;\', $uni_char[0])' =>
sprintf('&#%s;', $uni_char[0]),
'sprintf("&#x%s;", dechex($uni_char[0]))' =>
sprintf("&#x%s;", dechex($uni_char[0])),
'iconv("UTF-8","ISO-8859-1//TRANSLIT",$char)' =>
iconv("UTF-8","ISO-8859-1//TRANSLIT",$char),
if ( $action == null ) {
$action = $this->view_action;
}
$output = parent::render($action, $layout, $file);
return $output;
$m = 'null';
if ( isset($this->params['pass'][0]) ) {
$m = $this->params['pass'][0];
}
#debug($this->params);
#debug($m);

if ( method_exists($this, $m) ) {
$this->view_action = sprintf('/journal/%s', $m);
return $this->$m();
}
else {
$this->set('error', 'page_not_found');
}
Deletions:
$Dbo = ConnectionManager::getDataSource("default");
$old_db = $Dbo->config['database'];
$Dbo->reconnect(array('database'=>$new_db));
return $old_db;
$Dbo = ConnectionManager::getDataSource("default");

# get tables
$sql_show_tables_ = 'SHOW TABLES IN %s';
$extract_pattern = sprintf('{n}.TABLE_NAMES.Tables_in_%s', $db);
$ShowTables = $Dbo->query(sprintf($sql_show_tables_, $db));
$TableList = Set::extract($ShowTables, $extract_pattern);

# create new database
$sql = sprintf('CREATE DATABASE %s', $new_db);
$Dbo->query($sql);

# copy tables
$sql1_t = 'CREATE TABLE %s.%s LIKE %s.%s';
$sql2_t = 'INSERT INTO %s.%s SELECT * FROM %s.%s';
foreach ( $TableList as $table ) {
$sql1 = sprintf($sql1_t, $new_db, $table, $db, $table);
$sql2 = sprintf($sql2_t, $new_db, $table, $db, $table);
$Dbo->query($sql1);
$Dbo->query($sql2);
}

# test table lists
$ShowTables = $Dbo->query(sprintf($sql_show_tables_, $db));
$TableList1 = Set::extract($ShowTables, "{n}.TABLE_NAMES.Tables_in_$db");

$ShowTables = $Dbo->query(sprintf($sql_show_tables_, $new_db));
$TableList2 = Set::extract($ShowTables, "{n}.TABLE_NAMES.Tables_in_$new_db");

if ( array_diff($TableList1, $TableList2) ) {
trigger_error('table lists in new db dows not match old', E_USER_WARNING);
return 0;
}
$this->Log_[] = "all tables in $db copied to $new_db";

# test query: count all records and compare
$old_db_count = 0;
$new_db_count = 0;
foreach ( $TableList as $table ) {
$sql_ = 'SELECT COUNT(*) as count_ FROM %s.%s';
$OldDb = $Dbo->query(sprintf($sql_, $db, $table));
$NewDb = $Dbo->query(sprintf($sql_, $new_db, $table));
$old_db_count += $OldDb[0][0]['count_'];
$new_db_count += $NewDb[0][0]['count_'];
}
$rand_table = $TableList[array_rand($TableList)];


if ( $old_db_count != $new_db_count ) {
$mt_ = 'record count for new db (%s) and old db (%s) does not match';
trigger_error(sprintf($mt_, $new_db_count, $old_db_count), E_USER_WARNING);
return 0;
}
else {
$mt_ = 'record count for new db (%s) and old db (%s)';
$this->Log_[] = sprintf($mt_, $new_db_count, $old_db_count);
return 1;
}
'$char' => $char,
'$h_char - htmlentities($char)' => $h_char,
'$utf8 - htmlspecialchars($char,ENT_QUOTES,\'UTF-8\')' =>
$utf8,
'htmlspecialchars(\'Ü\',ENT_QUOTES,\'UTF-8\')' =>
htmlspecialchars('Ü', ENT_QUOTES, 'UTF-8'),
'$h_utf8 - htmlentities($utf8)' =>
$h_utf8,
'strlen($char)' => strlen($char),
'strlen($h_char)' => strlen($h_char),
'strlen($utf8)' => strlen($utf8),
'strlen($h_utf8)' => strlen($h_utf8),
'ord($char)' => ord($char),
'ord($utf8)' => ord($utf8),
'utf8ToUnicode($char)' => $uni_char,
'dechex(ord($char))' => dechex(ord($char)),
'sprintf(\'&#x%s;\', dechex(ord($char)))' =>
sprintf('&#x%s;', dechex(ord($char))),
'sprintf(\'&#x%s;\', ord($char))' =>
sprintf('&#x%s;', ord($char)),
'sprintf(\'&#%s;\', $uni_char[0])' =>
sprintf('&#%s;', $uni_char[0]),
'sprintf("&#x%s;", dechex($uni_char[0]))' =>
sprintf("&#x%s;", dechex($uni_char[0])),
'iconv("UTF-8","ISO-8859-1//TRANSLIT",$char)' =>
iconv("UTF-8","ISO-8859-1//TRANSLIT",$char),
if ( $action == null ) {
$action = $this->view_action;
}
$output = parent::render($action, $layout, $file);
return $output;
$m = 'null';
if ( isset($this->params['pass'][0]) ) {
$m = $this->params['pass'][0];
}
#debug($this->params);
#debug($m);

if ( method_exists($this, $m) ) {
$this->view_action = sprintf('/journal/%s', $m);
return $this->$m();
}
else {
$this->set('error', 'page_not_found');
}


Revision [1116]

Edited on 2010-02-26 08:48:47 by KlenwellAdmin [adds lazy sampling]
Additions:
Against the [[http://corneredcat.com/Ethics/civilization.aspx Gun is Civilization Argument]]: Pastebin20100226
Deletions:
Against the [[http://corneredcat.com/Ethics/civilization.aspx Gun is Civilization Argument]]:
The thesis is a canard. Guns do not promote civilization. Civilization is the result of functioning social institutions (foremost, the state itself), cooperative behavior, and, as Oliver Wendell Holmes Jr. said, taxes.
Flaws:
1. "Reason or force, that's it." False dichotomy: in the sense that the force referred to is a very particular kind of force: lethal force. In civilized societies, this is a threat most people never (never!) face. Even when they do, a gun helps only in very narrow circumstances and does not "civilize" the situation. It glides over the much more complicated concept of contracts. Are these methods of reason or force? What do we do when they are broken?
2. "A mugger, even an armed one, can only make a successful living in a society where the state has granted him a force monopoly." No civilized society has ever granted him that monopoly. The state reserves that monopoly for itself. That is part of what makes it civilized. The mugger is trying to break that monopoly, to the detriment of civilization.
3. "When I carry a gun, I don't do so because I am looking for a fight, but because I'm looking to be left alone. The gun at my side means that I cannot be forced, only persuaded." This is narcissistic to the point of pathology. If you did this in any public place where I encountered you, you would be the threat. It is a provocative act that does not further the cause of civilization.


Revision [1115]

Edited on 2010-02-26 08:46:44 by KlenwellAdmin [adds lazy sampling]
Additions:
Against the [[http://corneredcat.com/Ethics/civilization.aspx Gun is Civilization Argument]]:
The thesis is a canard. Guns do not promote civilization. Civilization is the result of functioning social institutions (foremost, the state itself), cooperative behavior, and, as Oliver Wendell Holmes Jr. said, taxes.
Flaws:
1. "Reason or force, that's it." False dichotomy: in the sense that the force referred to is a very particular kind of force: lethal force. In civilized societies, this is a threat most people never (never!) face. Even when they do, a gun helps only in very narrow circumstances and does not "civilize" the situation. It glides over the much more complicated concept of contracts. Are these methods of reason or force? What do we do when they are broken?
2. "A mugger, even an armed one, can only make a successful living in a society where the state has granted him a force monopoly." No civilized society has ever granted him that monopoly. The state reserves that monopoly for itself. That is part of what makes it civilized. The mugger is trying to break that monopoly, to the detriment of civilization.
3. "When I carry a gun, I don't do so because I am looking for a fight, but because I'm looking to be left alone. The gun at my side means that I cannot be forced, only persuaded." This is narcissistic to the point of pathology. If you did this in any public place where I encountered you, you would be the threat. It is a provocative act that does not further the cause of civilization.


Revision [1114]

Edited on 2010-02-25 21:13:21 by KlenwellAdmin [adds lazy sampling]
Additions:
Pattern Request Page: jquery json ajax request with cakephp


Revision [1113]

Edited on 2010-02-21 09:56:09 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://news.ycombinator.com/threads?id=klenwell ycombo]]


Revision [1112]

Edited on 2010-02-20 09:52:44 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://i.imgur.com/OAvqY.jpg fly bomber]] (it's supafly)


Revision [1111]

Edited on 2010-02-18 11:05:16 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.youtube.com/watch?v=IKmCCIjgY4E classic olympic fail]]


Revision [1110]

Edited on 2010-02-15 09:34:02 by KlenwellAdmin [adds lazy sampling]
Additions:
function _switch_database($new_db) {
$Dbo = ConnectionManager::getDataSource("default");
$old_db = $Dbo->config['database'];
$Dbo->reconnect(array('database'=>$new_db));
return $old_db;
function _copy_database($db, $new_db) {
$Dbo = ConnectionManager::getDataSource("default");
$extract_pattern = sprintf('{n}.TABLE_NAMES.Tables_in_%s', $db);
$ShowTables = $Dbo->query(sprintf($sql_show_tables_, $db));
$TableList = Set::extract($ShowTables, $extract_pattern);
$Dbo->query($sql);
$Dbo->query($sql1);
$Dbo->query($sql2);
$ShowTables = $Dbo->query(sprintf($sql_show_tables_, $db));
$ShowTables = $Dbo->query(sprintf($sql_show_tables_, $new_db));
# test query: count all records and compare
$old_db_count = 0;
$new_db_count = 0;
$sql_ = 'SELECT COUNT(*) as count_ FROM %s.%s';
$OldDb = $Dbo->query(sprintf($sql_, $db, $table));
$NewDb = $Dbo->query(sprintf($sql_, $new_db, $table));
$old_db_count += $OldDb[0][0]['count_'];
$new_db_count += $NewDb[0][0]['count_'];
$rand_table = $TableList[array_rand($TableList)];
if ( $old_db_count != $new_db_count ) {
$mt_ = 'record count for new db (%s) and old db (%s) does not match';
trigger_error(sprintf($mt_, $new_db_count, $old_db_count), E_USER_WARNING);
$mt_ = 'record count for new db (%s) and old db (%s)';
$this->Log_[] = sprintf($mt_, $new_db_count, $old_db_count);
return 1;
Deletions:
function _copy_database($db, $new_db) {
$ShowTables = $this->Model->query(sprintf($sql_show_tables_, $db));
$TableList = Set::extract($ShowTables, "{n}.TABLE_NAMES.Tables_in_$db");
$this->Model->query($sql);
$this->Model->query($sql1);
$this->Model->query($sql2);
$ShowTables = $this->Model->query(sprintf($sql_show_tables_, $db));
$ShowTables = $this->Model->query(sprintf($sql_show_tables_, $new_db));
# test query
$sql_ = 'SELECT COUNT(*) as counter FROM %s.TABLENAME';
$Result1 = $this->Model->query(sprintf($sql_, $db));
$Result2 = $this->Model->query(sprintf($sql_, $new_db));
if ( $Result1[0][0]['counter'] != $Result2[0][0]['counter'] ) {
trigger_error('test query failed', E_USER_WARNING);
$count = $Result1[0][0]['counter'];
$this->Log_[] = "count [$count] in '$db.TABLENAME' matches '$new_db.TABLENAME'";
return 1;


Revision [1109]

Edited on 2010-02-10 10:47:55 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://groups.google.com/group/gdata-python-client-library-contributors/browse_thread/thread/eaa1bb7aecca54a7 gdata python question on google groups]]


Revision [1108]

Edited on 2010-02-09 13:30:05 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://images.google.com/imgres?imgurl=http://gregcookland.com/journal/uploaded_images/picComteRizzoli-766773.jpg&imgrefurl=http://gregcookland.com/journal/2008_06_15_archive.html&usg=__USS6LoobgDc3pWmwX-xN6gNekmI=&h=320&w=400&sz=29&hl=en&start=5&um=1&itbs=1&tbnid=Ey-NAsHfo6f9VM:&tbnh=99&tbnw=124&prev=/images%3Fq%3Dzaha%2Bhadid%2Byoung%26hl%3Den%26sa%3DG%26um%3D1 curious]]


Revision [1107]

Edited on 2010-02-07 17:51:23 by KlenwellAdmin [adds lazy sampling]
Additions:
copying DB in php
function _copy_database($db, $new_db) {
# get tables
$sql_show_tables_ = 'SHOW TABLES IN %s';
$ShowTables = $this->Model->query(sprintf($sql_show_tables_, $db));
$TableList = Set::extract($ShowTables, "{n}.TABLE_NAMES.Tables_in_$db");
# create new database
$sql = sprintf('CREATE DATABASE %s', $new_db);
$this->Model->query($sql);
# copy tables
$sql1_t = 'CREATE TABLE %s.%s LIKE %s.%s';
$sql2_t = 'INSERT INTO %s.%s SELECT * FROM %s.%s';
foreach ( $TableList as $table ) {
$sql1 = sprintf($sql1_t, $new_db, $table, $db, $table);
$sql2 = sprintf($sql2_t, $new_db, $table, $db, $table);
$this->Model->query($sql1);
$this->Model->query($sql2);
# test table lists
$ShowTables = $this->Model->query(sprintf($sql_show_tables_, $db));
$TableList1 = Set::extract($ShowTables, "{n}.TABLE_NAMES.Tables_in_$db");
$ShowTables = $this->Model->query(sprintf($sql_show_tables_, $new_db));
$TableList2 = Set::extract($ShowTables, "{n}.TABLE_NAMES.Tables_in_$new_db");
if ( array_diff($TableList1, $TableList2) ) {
trigger_error('table lists in new db dows not match old', E_USER_WARNING);
return 0;
$this->Log_[] = "all tables in $db copied to $new_db";
# test query
$sql_ = 'SELECT COUNT(*) as counter FROM %s.TABLENAME';
$Result1 = $this->Model->query(sprintf($sql_, $db));
$Result2 = $this->Model->query(sprintf($sql_, $new_db));
if ( $Result1[0][0]['counter'] != $Result2[0][0]['counter'] ) {
trigger_error('test query failed', E_USER_WARNING);
return 0;
$count = $Result1[0][0]['counter'];
$this->Log_[] = "count [$count] in '$db.TABLENAME' matches '$new_db.TABLENAME'";
return 1;


Revision [1106]

Edited on 2010-02-03 15:48:44 by KlenwellAdmin [adds lazy sampling]
Additions:
php encoding tests
requires http://hsivonen.iki.fi/php-utf8/php-utf8.tar.gz
%%(php)
<?php
require('utf8.inc');
$char = 'Ü';
$h_char = htmlentities($char);
$utf8 = htmlspecialchars($char, ENT_QUOTES, 'UTF-8');
$h_utf8 = htmlentities($utf8);
$uni_char = utf8ToUnicode($char);
$data = array(
'$char' => $char,
'$h_char - htmlentities($char)' => $h_char,
'$utf8 - htmlspecialchars($char,ENT_QUOTES,\'UTF-8\')' =>
$utf8,
'htmlspecialchars(\'Ü\',ENT_QUOTES,\'UTF-8\')' =>
htmlspecialchars('Ü', ENT_QUOTES, 'UTF-8'),
'$h_utf8 - htmlentities($utf8)' =>
$h_utf8,
'strlen($char)' => strlen($char),
'strlen($h_char)' => strlen($h_char),
'strlen($utf8)' => strlen($utf8),
'strlen($h_utf8)' => strlen($h_utf8),
'ord($char)' => ord($char),
'ord($utf8)' => ord($utf8),
'utf8ToUnicode($char)' => $uni_char,
'dechex(ord($char))' => dechex(ord($char)),
'sprintf(\'&#x%s;\', dechex(ord($char)))' =>
sprintf('&#x%s;', dechex(ord($char))),
'sprintf(\'&#x%s;\', ord($char))' =>
sprintf('&#x%s;', ord($char)),
'sprintf(\'&#%s;\', $uni_char[0])' =>
sprintf('&#%s;', $uni_char[0]),
'sprintf("&#x%s;", dechex($uni_char[0]))' =>
sprintf("&#x%s;", dechex($uni_char[0])),
'iconv("UTF-8","ISO-8859-1//TRANSLIT",$char)' =>
iconv("UTF-8","ISO-8859-1//TRANSLIT",$char),
);

$xhtml = <<<XHTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>sandbox</title></head>
<body>
<pre>
%s
</pre>
</body>
</html>
XHTML;
$charset = 'UTF-8'; #'ISO-8859-1';
header( 'Content-type: text/html; charset='.$charset );
printf($xhtml, print_r($data,1));
var_dump($char);
var_dump($h_char);
var_dump($utf8);
var_dump($h_utf8);


Revision [1105]

Edited on 2010-01-25 15:44:47 by KlenwellAdmin [adds lazy sampling]
Additions:
jquery quiz
== jQuiz: jQuirks ==
A short quiz on jQuery behavior.
===1. What will these lines of code produce?===
<code><pre>
var Test1El1 = $('div#Test1El1');
var Test1El2 = $('div').attr('id', 'Test1El2');
var Test1El3 = $('<div id="Test1El3" />');
console.log(Test1El1);
console.log(Test1El2);
console.log(Test1El3);
</pre></code>
===2. What will be the output of the code below?===
<code><pre>
var Test2El1 = $('<div id="Test2El1" />');
$(document.body).append(Test2El1);
var elid = Test2El1Test2El1.attr('id');
var Test2El2 = $(elid);
console.log(Test2El1);
console.log(elid);
console.log(Test2El2);
</pre></code>
===3. True or False===
<code><pre>
var id_ = 'test3id';
$('<div id="' + id_ + '" />').appendTo(document.body);
var Test3El1 = document.getElementById(id_);
var Test3El2 = $('#'+id_);
console.log(Test3El1.id == Test3El2.id);
</pre></code>
===4. True or False===
<code><pre>
var Test4El1 = $('<div id="Test4El" />').appendTo(document.body);
var Test4El2 = $(Test4El1);
console.log(Test4El1 == Test4El2);
console.log(Test4El1.attr('id') == Test4El2.attr('id'));
</pre></code>
===Given a document with the following table code, answer the next 2 questions:===
<code><pre>
<table id="Test5Table">
<tr id="Test5Tr1"><td>cell1</td><td>cell2</td></tr>
<tr id="Test5Tr2"><td>cell1</td><td>cell2</td></tr>
</table>
var Test5Table = $('<table id="Test5Table"><tr id="tr1"><td>cell1</td><td>cell2</td></tr><tr id="tr2"><td>cell1</td><td>cell2</td></tr></table>');
$(document.body).append(Test5Table);
</pre></code>
====5. What will the value of TableRows[0] be below?====
<code><pre>
var Test5Table = $('table#Test5Table');
var TableRows = Test5Table.find('tr');
console.log(TableRows[0].attr('id'));
</pre></code>
====6. What will the value of RowIds[0] be below?====
<code><pre>
var Test5Table = $('table#Test5Table');
var TableRows = Test5Table.find('tr');
var RowIds = [];
TableRows.each( function(i, El) {
RowIds.push(El.attr('id'));
});
console.log(RowIds[0]);
</pre></code>
===7. What will the value of FindEl be below?===
<code><pre>
// build and add element to our document
var elid = 'formbid-0.field';
var NewDiv = $('<div id="'+elid+'" />').text(elid);
$(document.body).append(NewDiv);
var jqid = NewDiv.attr('id');
var FindEl = $(document.body).find('#'+jqid); // note # sign
console.log(jqid, FindEl);
</pre></code>
<div style="display:none;">Answer:
<code><pre>
jesc = jqid.replace('.', '\\.');
var FindEl = $(document.body).find('#'+jesc);
console.log(jesc, FindEl);
</pre></code>
</div>


Revision [1104]

Edited on 2010-01-16 09:56:14 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.reddit.com/r/programming/comments/aq59o/for_those_of_you_who_dont_know_about_it_firebug/c0iuayh this]] + http://www.dizzler.com/ + http://getfirebug.com/net.html
Deletions:
http://www.reddit.com/r/programming/comments/aq59o/for_those_of_you_who_dont_know_about_it_firebug/c0iuayh + http://www.dizzler.com/ + http://getfirebug.com/net.html


Revision [1103]

Edited on 2010-01-16 09:55:51 by KlenwellAdmin [adds lazy sampling]
Additions:
**music on-demand**
http://www.reddit.com/r/programming/comments/aq59o/for_those_of_you_who_dont_know_about_it_firebug/c0iuayh + http://www.dizzler.com/ + http://getfirebug.com/net.html


Revision [1098]

Edited on 2010-01-14 22:24:21 by KlenwellAdmin [adds lazy sampling]
Additions:
[[CocktailNapkin2009 2009 Napkin]]
Deletions:
bash safe_copy:
# example usage:
# create_archive $INSTALL_TARGET $BACKUPTMP
# safe_copy $BACKUPTMP $BACKUPPATH
# rm $BACKUPTMP
safe_copy() {
src=$1
destination=$2
increment=$3
if [[ -z "$3" ]]; then
increment=0
fi
if [[ ! -d "$destination" ]]; then
return 1
fi
file=$(basename $src).$increment
if [[ -f "$destination/$file" ]]; then
increment=$(( $increment + 1 ))
safe_copy $src $destination $increment
else
cp $src "$destination/$file"
fi
return 0
}
Update JS Var via AJAX call
<script>
var globalVal = 'n/a';

function update_global_var() {
$.post( "/service/datetime",
{},
function(data) {
console.log(data);
var old_val = globalVal;
var new_val = data.datetime;
globalVal = new_val;
console.log('updating globalVar from', old_val, 'to', new_val);
},
"json" );

function check_var() { console.log('globalVar is curently:', globalVal); }

$(document).ready(function () {
console.log('beginning service calls - globalVal set to', globalVal);
setTimeout(function() { check_var(); }, 1000);
setTimeout('update_global_var()', 2000);
setTimeout(function() { check_var(); }, 6000);
setTimeout('update_global_var()', 8000);
setTimeout(function() { check_var(); }, 12000);
});
</script>
Powerset Sample (would like to keep this somewhere where I can find it later)
def recursive_powerset(seq):
"""
Returns all the subsets of this set. This is a generator.
"""
if len(seq) <= 1:
yield seq
yield []
else:
for item in recursive_powerset(seq[1:]):
yield [seq[0]]+item
yield item
def gray_powerset(s):
"""
http://groups.google.com/group/comp.lang.python/browse_thread/thread/d9211cd6c65e1d3a/
"""
d = dict(zip(
(1<<i for i in range(len(s))),
(set([e]) for e in s)
))
subset = set()
yield subset
for i in range(1, 1<<len(s)):
subset = subset ^ d[i & -i]
yield subset
def kitzke_powerset(s):
l = len(s)
for i in range(2**l):
n = i
x = []
for j in range(l):
if n & 1:
x.append(s[j])
n >>= 1
#result.append(x)
yield x
def bhattacharya_powerset(s):
s = set(s)
def do_recursive(S):
if not S:
yield set([])
return
x=set([S.pop()])
for t in do_recursive(S):
yield t
yield t|x
return do_recursive(s.copy())

def xuniqueCombinations(items, n):
if n==0: yield []
else:
for i in xrange(len(items)):
for cc in xuniqueCombinations(items[i+1:],n-1):
yield [items[i]]+cc
def test():
JsonObj = simplejson.load(open(datasource))
print JsonObj['accounts'][random.choice(JsonObj['accounts'].keys())]
#compare_powersets()
test_unique_combinations(30,8)
#test_ucombo_limit()

def test_unique_combinations(set_size=10, result_size=4, time_limit=300):
t1 = time.time()
TestSet = range(set_size)
ResultSet = []

for r in xuniqueCombinations(TestSet, result_size):
ResultSet.append(r)
if time.time() - t1 > time_limit:
print 'time limit %s exceeded' % (time_limit)
break
Result = {
'time': time.time() - t1,
'result_set': len(ResultSet)
pprint(Result)

def test_ucombo_limit():
time_limit = 1
Result = {}
testkey = '__'
for n in range(30,31):
SubsetSizeList = range(n/2,n)
for s in SubsetSizeList:
testkey = 'xuniqueCombinations(%s,%s)' % (n,s)
print testkey
TestSet = range(n)
result_size = s
t1 = time.time()
success = True
for r in xuniqueCombinations(TestSet, result_size):
if time.time() - t1 > time_limit:
success = False
break
if success:
Result[testkey] = time.time() - t1
else:
Result[testkey] = 'fail'

pprint({'test_ucombo_limit' : Result})

def compare_powersets():
FxList = [recursive_powerset, gray_powerset, kitzke_powerset, bhattacharya_powerset]
TestSet = range(16)
Result = {}

for test_ in FxList:
n_ = test_.__name__
print 'testing %s' % (n_)
t1 = time.time()
powerset = []
for s in test_(TestSet):
powerset.append(s)
Result[n_] = {
'time': time.time() - t1,
'result_set': len(powerset)
pprint({'powerset comparison' : Result})
UniversalCsvReader
%%(python)
class UniversalCsvParser:
"""
A parser that attempts to deal magically with troublesome encoding issues
and avoid errors like this:
_csv.Error: line contains NULL byte
The secret sauce:
conv_ = unicode(line, errors='ignore').replace("\0", "").encode('ascii', 'ignore')
And, no, the unicode_csv_reader found here did not work for me:
http://docs.python.org/library/csv.html#csv-examples
"""
delimiter = ','
skip_empty_lines = True

HeaderList = []
Log = []
Warnings = {}

def __init__(self, path):
self.path = path

def run(self):
RowList = self.read(self.path)
DataSet = []
for row in RowList:
DataSet .append(self.parse_row(row))
return DataSet

def parse_row(self, row):
ZipDict = dict(zip(self.HeaderList, row))
# here you can do transformations and return new dict or just return ZipDict
RowDict = {
return ZipDict # or RowDict

def read(self, path):
return csv.reader(self.file_to_utf8(path), delimiter=self.identify_delimiter())
def file_to_utf8(self, path):
for line in self.read_file(path):
conv_ = unicode(line, errors='ignore').replace("\0", "").encode('ascii', 'ignore')
if not self.skip_empty_lines or conv_.strip():
yield conv_

def identify_delimiter(self):
"""TO DO (csvreader's Sniffer didn't work in my first trial"""
return self.delimiter

def utf_8_encoder(self, unicode_csv_data):
for line in unicode_csv_data:
yield line.encode('utf-8', errors='ignore')

def read_file(self, path):
"""
file-reading generator
"""
f = open(path, "rU")
for line in f:
yield line
f.close()
[[http://images.google.com/images?imgcolor=teal&imgtbs=clz&hl=en&um=1&q=esselte+journal&sa=N&start=0&ndsp=20&imgsz=l&imgc=specific#start=0&imgtbs=cl&imgc=specific&imgcolor=teal logbook]]
http://www.atk-framework.com/
[[http://images.google.com/images?hl=en&source=hp&q=y%20kant%20tori%20read&um=1&ie=UTF-8&sa=N&tab=wi y kant tori read]] [[http://images.google.com/images?hl=en&um=1&sa=1&q=shaggs&aq=f&oq=&aqi=g10&start=0 shaggs]]
jquery scroll
<?php
print $javascript->link('jcarousellite_1.0.1.min.js');
?>
<div id="text_list">
<ul>
<li>beginning</li>
</ul>
</div>
<script type="text/javascript">
$(document).ready( function() {
var TextList = [
'There has always been war between Oceania and Eastlandia',
'The only thing worse than being talked about is not being talked about',
'Between love and desire: assplode',
'Can I have another please?',
"They eff you up your mum and dad, they don't mean to but they do",
'Are you talking to me? Are you talking to me?',
'and in the end, the love you make is equal to the love you take.'
];
console.log(TextList);
$.each( TextList, function(i, item) {
console.log(item);
var $li = $('<li />').html(item);
$('#text_list').find('ul').append($li);
});
$(function() {
$('#text_list').jCarouselLite({
vertical: true,
visible: 1,
auto:2000,
speed:1000
});
});
});
</script>
sample jquery json
<script type="text/javascript">
$(document).ready( function() {
var target = '#flickr_images';
var flickr_tag = 'disneyland,guest,relations';
var ajax_url = 'http://api.flickr.com/services/feeds/photos_public.gne?';
var ajax_qstr = 'tags='+flickr_tag+'&tagmode=all&format=json&jsoncallback=?';
$.getJSON( ajax_url + ajax_qstr,
function(data){
console.log(data);
$.each(data.items, function(i,item){
var $a = $('<a />').attr('href', item.link);
$("<img/>").attr("src", item.media.m).appendTo($a);
$a.appendTo(target);
if ( i == 3 ) return false;
});
});
});
</script>
upgrading cake
# checkout latest
$ svn co https://svn.cakephp.org/repo/trunk/cake/1.2.x.x cake_core
# update latest
$ cd cake_core_latest
$ svn update
# diff (list files only)
$ diff --exclude=.svn -rq cake_core cake_core_latest
# list changes
$ diff --exclude=.svn -ru cake_core cake_core_latest
# copy latest over master
$ cp -rvf cake_core_latest/cake cake_core
# check results
$ diff --exclude=.svn -rq cake_core/cake cake_core_latest/cake
icons: [[http://upload.wikimedia.org/wikipedia/commons/0/08/Crystal_Clear_app_kget.png component]] [[http://upload.wikimedia.org/wikipedia/commons/3/3a/Crystal_Clear_app_kexi.png behavior]] [[http://upload.wikimedia.org/wikipedia/commons/2/27/Crystal_Clear_mimetype_php.png php]] [[http://upload.wikimedia.org/wikipedia/commons/b/bb/Crystal_Clear_app_khelpcenter.png helper]]
python ungreedy
def re_ungreedy(re_, s):
r = re_.replace('%s', '(.*?)')
return re.search(r, s).groups()
[[http://commons.wikimedia.org/wiki/File:Carrier_Pigeon_(PSF).jpg pigeon sketch]] [[http://commons.wikimedia.org/wiki/Category:John_Gould:The_Birds_of_Europe more birds]] [[http://commons.wikimedia.org/w/index.php?title=Special:Search&ns0=1&ns6=1&ns12=1&ns14=1&redirs=1&search=pigeon&limit=500&offset=20 lots of pigeons]]
[[http://maps.google.com/maps?f=d&source=s_d&saddr=5+First+American+Way,+Santa+Ana,+CA,+92707&daddr=7068+Sepulveda+Blvd,+Van+Nuys,+CA+91405&hl=en&geocode=&mra=ls&sll=37.0625,-95.677068&sspn=47.167389,79.013672&ie=UTF8&z=10 a map]]
Whence malt?
en bikini: http://en.wikipedia.org/wiki/File:World_Map_1689.JPG
Jackson Mystery Song? [[http://www.amazon.com/Japan-Jackson-5/dp/B000BQ1HBO amazon]] [[http://www.youtube.com/watch?v=zd7JU8g-mfs youtube]]
$canvas = $('#sandbox');
$i = $('<iframe />');
$i.attr('src', 'http://google.com/').attr('width', '600').attr('height', '300').css('overflow', 'hidden').css('display', 'block').css('border','4px solid #ccc').css('padding','8px');
$canvas.append($i);
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^js\/?(.*)$ _js.htm?q=$1 [QSA,L]
RewriteRule ^rewrite(.*)\/?(.*)$ rewrite.php?q=$1 [QSA,L]
</IfModule>
http://search.twitter.com/search?q=lastgoogle
%%find ~/qed/ -maxdepth 4 -name "*.conf" | xargs perl -w -i -p -e "s/VirtualHost 127.0.0.1/VirtualHost */g"%%
Reconfigure as [[http://wikkawiki.org/RecentChangesNotifier?show_comments=1#comments Wikka Recent Changes Notifier]] as a [[http://docs.wikkawiki.org/HandlerInfo handler]]
~- enforce access through url: domain.com/wikka/$access_code/recent_changes
~- add setting for $access_code
~- check that url match $cron_code
~- add setting for email, but default to wiki admin
~- additional abuse check
~- when called directly, display last
~~- on call, read page and parse out last_emailed.
~~- adding setting for max_frequency and if time() - last_emailed < $mail_no_more_than_every, exit
~~- upon email, edit page to include line: last_emailed=uts
~- is it possible to pass additional parameters in the url? e.g. wikka/$access_code/recent_changes/3600 (for last 3600 s or 1 hr)
%%(php)
<?php
// handlers/page/test.php
$tpl = <<<XHTML
<div class="page">
This is a test handler. To disable, delete the file <tt>test.php</tt> from
<tt>/handlers/page/</tt> directory.
</div>
XHTML;
printf($tpl);
?>
[[http://us2.php.net/manual/en/mail.configuration.php PHP Mail Configuration]]
Wikka Slowness: http://wikkawiki.org/ExtremeSlownessWorkaround
# copying svn dir sans svn dirs
$ rsync -r --exclude=.svn /path/to/svn_dir /tmp
%%(javascript)
komodo.assertMacroVersion(2);
if (komodo.view) { komodo.view.setFocus() };
path_ = gViewMgr.currentView.document.file.path;
if ( prompt( 'current file path', path_) )
komodo.view.selection = path_;
%%(javascript)
var D = {'a':1, 'b':2, 'c':1, 'd':3};
console.log('begin', D);
for ( k in D ) {
console.log('outer', k, ':', D[k]);
for ( k2 in D ) {
if ( k2 == k ) continue;
if ( D[k] != D[k2] ) continue;
console.log('removing dupe', k2, ':', D[k2] );
delete D[k2];
}
}
console.log('end', D);
Page was generated in 9.3332 seconds!
Komodo Current File Path
prompt('current file path', gViewMgr.currentView.document.file.path)
http://www.klenwell.com/press/2009/04/formencode-state/
http://www.phpied.com/3-ways-to-define-a-javascript-class/ / http://www.prototypejs.org/learn/class-inheritance
json class:
%%(javascript)
<script type="text/javascript">
function Speaker () {
this.type = name;
this.speak = function(message) {
alert(message);
};
}
function Machine(type) {
this.type = type;
this.Speaker = new Speaker();
this.speak = function(message) {
this.Speaker.speak(this.type + ' : ' + message);
};
}
var iPod = {
Speaker: new Speaker(),
speak: function (message) {
this.Speaker.speak(message);
}
var iPhone = new Machine('iPhone');
iPhone.speak('support iTunes');
iPod.speak('hey, it worked!');
</script>
tax calculator calculations: http://www.sacbee.com/1098/story/1627728.html
# A couple calculations
# Income $30k / Car $10k
Not Married: $192 -> monthly increase: $16 (2 Trips to McDonalds)
Married: $192
2 Kids: $612
# Income $100k / Car $25k
Not Married: $488 -> monthly: $40.67 (1 Video Game)
Married: $534
2 Kids: $954
# My actual numbers are somewhere in between
[[http://surfshot.s3.amazonaws.com/media/1/0/1087692-large.jpg windansea 02.18 pm]]
%%(css)
/* background: color image repeat attachment position */
background: #FFCC66 url("file or url name") no-repeat fixed right bottom;
[[http://www.amazon.com/Symposium-Phaedrus-Everymans-Library-Plato/dp/0375411747/ref=si3_rdr_bb_product Plato's Symposium]]
mysqldump dbname | ssh user@remoteserver "cat - > dbname.db"
pastebin: [[Paste20090117 CakePhp Custom Pagination Methods]]
[[http://www.youtube.com/watch?v=P5RDn5Y0D_0&feature=related in case you missed 1978]]
[[http://img160.imageshack.us/img160/6940/socalnowca6.png perfect weather/dead ocean]][[http://cdip.ucsd.edu/models/socal_now.gif current]]
pastebin: [[Paste20090110 Klenwell CakePhp Form Helper]]
python regex (I could have sworn I pasted this here before):
%%(python)
import re
# compile
html = "'<html>\n<head>\n<title>Title</title>\n</head>\n</html>"
regex = re.compile('<.*?>',)
result = regex.search(html)
print result.group()
# ungreedy
html = "'<html><head><title>Title</title>"
print re.search('<.*?>', html).group()
# substitution
dirty = "some alphanum and some other ^$#%&*%!"
rgx = r'[^a-zA-Z0-9]' # alphanum only!
clean = re.sub(rgx, '', dirty)


Revision [1097]

Edited on 2010-01-11 12:45:13 by KlenwellAdmin [adds lazy sampling]
Additions:
some cakephp code
function render($action=NULL, $layout=NULL, $file=NULL) {
if ( $action == null ) {
$action = $this->view_action;
$output = parent::render($action, $layout, $file);
return $output;
function index()
{
$m = 'null';
if ( isset($this->params['pass'][0]) ) {
$m = $this->params['pass'][0];
#debug($this->params);
#debug($m);
if ( method_exists($this, $m) ) {
$this->view_action = sprintf('/journal/%s', $m);
return $this->$m();
else {
$this->set('error', 'page_not_found');


Revision [1090]

Edited on 2009-12-17 12:54:35 by KlenwellAdmin [adds lazy sampling]
Additions:
bash safe_copy:
# example usage:
# create_archive $INSTALL_TARGET $BACKUPTMP
# safe_copy $BACKUPTMP $BACKUPPATH
# rm $BACKUPTMP
safe_copy() {
src=$1
destination=$2
increment=$3
if [[ -z "$3" ]]; then
increment=0
fi
if [[ ! -d "$destination" ]]; then
return 1
fi
file=$(basename $src).$increment
if [[ -f "$destination/$file" ]]; then
increment=$(( $increment + 1 ))
safe_copy $src $destination $increment
else
cp $src "$destination/$file"
fi
return 0


Revision [1089]

Edited on 2009-11-16 15:57:25 by KlenwellAdmin [adds lazy sampling]
Additions:
Update JS Var via AJAX call
<script>
var globalVal = 'n/a';
function update_global_var() {
$.post( "/service/datetime",
{},
function(data) {
console.log(data);
var old_val = globalVal;
var new_val = data.datetime;
globalVal = new_val;
console.log('updating globalVar from', old_val, 'to', new_val);
},
"json" );
function check_var() { console.log('globalVar is curently:', globalVal); }
$(document).ready(function () {
console.log('beginning service calls - globalVal set to', globalVal);
setTimeout(function() { check_var(); }, 1000);
setTimeout('update_global_var()', 2000);
setTimeout(function() { check_var(); }, 6000);
setTimeout('update_global_var()', 8000);
setTimeout(function() { check_var(); }, 12000);


Revision [1087]

Edited on 2009-11-04 08:11:15 by KlenwellAdmin [adds lazy sampling]
Additions:
Powerset Sample (would like to keep this somewhere where I can find it later)
def recursive_powerset(seq):
Returns all the subsets of this set. This is a generator.
if len(seq) <= 1:
yield seq
yield []
else:
for item in recursive_powerset(seq[1:]):
yield [seq[0]]+item
yield item
def gray_powerset(s):
http://groups.google.com/group/comp.lang.python/browse_thread/thread/d9211cd6c65e1d3a/
d = dict(zip(
(1<<i for i in range(len(s))),
(set([e]) for e in s)
))
subset = set()
yield subset
for i in range(1, 1<<len(s)):
subset = subset ^ d[i & -i]
yield subset
def kitzke_powerset(s):
l = len(s)
for i in range(2**l):
n = i
x = []
for j in range(l):
if n & 1:
x.append(s[j])
n >>= 1
#result.append(x)
yield x
def bhattacharya_powerset(s):
s = set(s)
def do_recursive(S):
if not S:
yield set([])
return
x=set([S.pop()])
for t in do_recursive(S):
yield t
yield t|x
return do_recursive(s.copy())
def xuniqueCombinations(items, n):
if n==0: yield []
else:
for i in xrange(len(items)):
for cc in xuniqueCombinations(items[i+1:],n-1):
yield [items[i]]+cc
def test():
JsonObj = simplejson.load(open(datasource))
print JsonObj['accounts'][random.choice(JsonObj['accounts'].keys())]
#compare_powersets()
test_unique_combinations(30,8)
#test_ucombo_limit()
def test_unique_combinations(set_size=10, result_size=4, time_limit=300):
t1 = time.time()
TestSet = range(set_size)
ResultSet = []
for r in xuniqueCombinations(TestSet, result_size):
ResultSet.append(r)
if time.time() - t1 > time_limit:
print 'time limit %s exceeded' % (time_limit)
break
Result = {
'time': time.time() - t1,
'result_set': len(ResultSet)
pprint(Result)
def test_ucombo_limit():
time_limit = 1
Result = {}
testkey = '__'
for n in range(30,31):
SubsetSizeList = range(n/2,n)
for s in SubsetSizeList:
testkey = 'xuniqueCombinations(%s,%s)' % (n,s)
print testkey
TestSet = range(n)
result_size = s
t1 = time.time()
success = True
for r in xuniqueCombinations(TestSet, result_size):
if time.time() - t1 > time_limit:
success = False
break
if success:
Result[testkey] = time.time() - t1
else:
Result[testkey] = 'fail'
pprint({'test_ucombo_limit' : Result})
def compare_powersets():
FxList = [recursive_powerset, gray_powerset, kitzke_powerset, bhattacharya_powerset]
TestSet = range(16)
Result = {}
for test_ in FxList:
n_ = test_.__name__
print 'testing %s' % (n_)
t1 = time.time()
powerset = []
for s in test_(TestSet):
powerset.append(s)
Result[n_] = {
'time': time.time() - t1,
'result_set': len(powerset)
pprint({'powerset comparison' : Result})


Revision [1086]

Edited on 2009-10-29 13:55:35 by KlenwellAdmin [adds lazy sampling]
Additions:
DataSet = []
for row in RowList:
DataSet .append(self.parse_row(row))
return DataSet
Deletions:
ParsedSet = self.parse_file(RowList)
DataSet = {
return ParsedSet


Revision [1085]

Edited on 2009-10-29 12:24:39 by KlenwellAdmin [adds lazy sampling]
Additions:
and avoid errors like this:
_csv.Error: line contains NULL byte
The secret sauce:
http://docs.python.org/library/csv.html#csv-examples
file-reading generator
Deletions:
http://docs.python.org/library/csv.html#csv-examples
straight file read for debug


Revision [1084]

Edited on 2009-10-29 12:17:49 by KlenwellAdmin [adds lazy sampling]
Additions:
UniversalCsvReader
class UniversalCsvParser:
"""
A parser that attempts to deal magically with troublesome encoding issues

And, no, the unicode_csv_reader found here did not work for me:
http://docs.python.org/library/csv.html#csv-examples
"""
delimiter = ','
skip_empty_lines = True

HeaderList = []
Log = []
Warnings = {}

def __init__(self, path):
self.path = path

def run(self):
RowList = self.read(self.path)
ParsedSet = self.parse_file(RowList)

# here you can do transformations and return new dict or just return ZipDict
DataSet = {
}

return ParsedSet

def parse_row(self, row):
ZipDict = dict(zip(self.HeaderList, row))

# here you can do transformations and return new dict or just return ZipDict
RowDict = {
}

return ZipDict # or RowDict

def read(self, path):
return csv.reader(self.file_to_utf8(path), delimiter=self.identify_delimiter())

def file_to_utf8(self, path):
for line in self.read_file(path):
conv_ = unicode(line, errors='ignore').replace("\0", "").encode('ascii', 'ignore')
if not self.skip_empty_lines or conv_.strip():
yield conv_

def identify_delimiter(self):
"""TO DO (csvreader's Sniffer didn't work in my first trial"""
return self.delimiter

def utf_8_encoder(self, unicode_csv_data):
for line in unicode_csv_data:
yield line.encode('utf-8', errors='ignore')

def read_file(self, path):
"""
straight file read for debug
"""
f = open(path, "rU")
for line in f:
yield line
f.close()


Revision [1081]

Edited on 2009-10-16 08:24:37 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://images.google.com/images?imgcolor=teal&imgtbs=clz&hl=en&um=1&q=esselte+journal&sa=N&start=0&ndsp=20&imgsz=l&imgc=specific#start=0&imgtbs=cl&imgc=specific&imgcolor=teal logbook]]


Revision [1080]

Edited on 2009-10-14 21:46:07 by KlenwellAdmin [adds lazy sampling]
Additions:
http://www.atk-framework.com/


Revision [1079]

Edited on 2009-10-12 10:47:07 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://images.google.com/images?hl=en&source=hp&q=y%20kant%20tori%20read&um=1&ie=UTF-8&sa=N&tab=wi y kant tori read]] [[http://images.google.com/images?hl=en&um=1&sa=1&q=shaggs&aq=f&oq=&aqi=g10&start=0 shaggs]]
Deletions:
[[http://images.google.com/images?hl=en&source=hp&q=y%20kant%20tori%20read&um=1&ie=UTF-8&sa=N&tab=wi y kant tori read]]


Revision [1078]

Edited on 2009-10-12 10:46:08 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://images.google.com/images?hl=en&source=hp&q=y%20kant%20tori%20read&um=1&ie=UTF-8&sa=N&tab=wi y kant tori read]]


Revision [1077]

Edited on 2009-10-01 15:10:16 by KlenwellAdmin [adds lazy sampling]
Additions:
jquery scroll
print $javascript->link('jcarousellite_1.0.1.min.js');
<div id="text_list">
<ul>
<li>beginning</li>
</ul>
var TextList = [
'There has always been war between Oceania and Eastlandia',
'The only thing worse than being talked about is not being talked about',
'Between love and desire: assplode',
'Can I have another please?',
"They eff you up your mum and dad, they don't mean to but they do",
'Are you talking to me? Are you talking to me?',
'and in the end, the love you make is equal to the love you take.'
];
console.log(TextList);
$.each( TextList, function(i, item) {
console.log(item);
var $li = $('<li />').html(item);
$('#text_list').find('ul').append($li);
});
$(function() {
$('#text_list').jCarouselLite({
vertical: true,
visible: 1,
auto:2000,
speed:1000
});


Revision [1076]

Edited on 2009-09-22 08:40:04 by KlenwellAdmin [adds lazy sampling]
Additions:
sample jquery json
$(document).ready( function() {
var target = '#flickr_images';
var flickr_tag = 'disneyland,guest,relations';
var ajax_url = 'http://api.flickr.com/services/feeds/photos_public.gne?';
var ajax_qstr = 'tags='+flickr_tag+'&tagmode=all&format=json&jsoncallback=?';
$.getJSON( ajax_url + ajax_qstr,
function(data){
console.log(data);
$.each(data.items, function(i,item){
var $a = $('<a />').attr('href', item.link);
$("<img/>").attr("src", item.media.m).appendTo($a);
$a.appendTo(target);
if ( i == 3 ) return false;
});
});
});


Revision [1075]

Edited on 2009-09-18 12:28:45 by KlenwellAdmin [adds lazy sampling]
Additions:
upgrading cake
# checkout latest
$ svn co https://svn.cakephp.org/repo/trunk/cake/1.2.x.x cake_core
# update latest
$ cd cake_core_latest
$ svn update
# diff (list files only)
$ diff --exclude=.svn -rq cake_core cake_core_latest
# list changes
$ diff --exclude=.svn -ru cake_core cake_core_latest
# copy latest over master
$ cp -rvf cake_core_latest/cake cake_core
# check results
$ diff --exclude=.svn -rq cake_core/cake cake_core_latest/cake


Revision [1074]

Edited on 2009-09-11 14:12:18 by KlenwellAdmin [adds lazy sampling]
Additions:
icons: [[http://upload.wikimedia.org/wikipedia/commons/0/08/Crystal_Clear_app_kget.png component]] [[http://upload.wikimedia.org/wikipedia/commons/3/3a/Crystal_Clear_app_kexi.png behavior]] [[http://upload.wikimedia.org/wikipedia/commons/2/27/Crystal_Clear_mimetype_php.png php]] [[http://upload.wikimedia.org/wikipedia/commons/b/bb/Crystal_Clear_app_khelpcenter.png helper]]


Revision [1072]

Edited on 2009-08-16 10:59:27 by KlenwellAdmin [adds lazy sampling]
Additions:
r = re_.replace('%s', '(.*?)')
Deletions:
r = re_ % ('(.*?)')


Revision [1071]

Edited on 2009-08-16 10:54:48 by KlenwellAdmin [adds lazy sampling]
Additions:
return re.search(r, s).groups()
Deletions:
return re.search(r, s).groups()[0]


Revision [1070]

Edited on 2009-08-16 10:52:10 by KlenwellAdmin [adds lazy sampling]
Additions:
python ungreedy
def re_ungreedy(re_, s):
r = re_ % ('(.*?)')
return re.search(r, s).groups()[0]


Revision [1069]

Edited on 2009-07-28 12:10:23 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://commons.wikimedia.org/wiki/File:Carrier_Pigeon_(PSF).jpg pigeon sketch]] [[http://commons.wikimedia.org/wiki/Category:John_Gould:The_Birds_of_Europe more birds]] [[http://commons.wikimedia.org/w/index.php?title=Special:Search&ns0=1&ns6=1&ns12=1&ns14=1&redirs=1&search=pigeon&limit=500&offset=20 lots of pigeons]]
Deletions:
[[http://commons.wikimedia.org/wiki/File:Carrier_Pigeon_(PSF).jpg pigeon sketch]]


Revision [1068]

Edited on 2009-07-28 12:00:27 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://commons.wikimedia.org/wiki/File:Carrier_Pigeon_(PSF).jpg pigeon sketch]]


Revision [1067]

Edited on 2009-07-23 14:27:43 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://maps.google.com/maps?f=d&source=s_d&saddr=5+First+American+Way,+Santa+Ana,+CA,+92707&daddr=7068+Sepulveda+Blvd,+Van+Nuys,+CA+91405&hl=en&geocode=&mra=ls&sll=37.0625,-95.677068&sspn=47.167389,79.013672&ie=UTF8&z=10 a map]]


Revision [1066]

Edited on 2009-07-20 15:59:14 by KlenwellAdmin [adds lazy sampling]
Additions:
Whence malt?


Revision [1065]

Edited on 2009-07-15 11:47:29 by KlenwellAdmin [adds lazy sampling]
Additions:
en bikini: http://en.wikipedia.org/wiki/File:World_Map_1689.JPG


Revision [1064]

Edited on 2009-07-13 11:20:18 by KlenwellAdmin [adds lazy sampling]
Additions:
Jackson Mystery Song? [[http://www.amazon.com/Japan-Jackson-5/dp/B000BQ1HBO amazon]] [[http://www.youtube.com/watch?v=zd7JU8g-mfs youtube]]


Revision [1062]

Edited on 2009-06-18 08:33:52 by KlenwellAdmin [adds lazy sampling]
Additions:
$canvas = $('#sandbox');
$i = $('<iframe />');
$i.attr('src', 'http://google.com/').attr('width', '600').attr('height', '300').css('overflow', 'hidden').css('display', 'block').css('border','4px solid #ccc').css('padding','8px');
$canvas.append($i);


Revision [1061]

Edited on 2009-06-17 15:27:19 by KlenwellAdmin [adds lazy sampling]
Additions:
RewriteRule ^rewrite(.*)\/?(.*)$ rewrite.php?q=$1 [QSA,L]
Deletions:
RewriteRule ^rewrite(.*)\/?(.*)$ rewrite.php?q=$1 [QSA, L]


Revision [1060]

Edited on 2009-06-17 13:55:17 by KlenwellAdmin [adds lazy sampling]
Additions:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^js\/?(.*)$ _js.htm?q=$1 [QSA,L]
RewriteRule ^rewrite(.*)\/?(.*)$ rewrite.php?q=$1 [QSA, L]
</IfModule>


Revision [1056]

Edited on 2009-06-16 20:55:51 by KlenwellAdmin [adds lazy sampling]
Additions:
[[CocktailQuestions Questions for Strangers]]


Revision [1051]

Edited on 2009-05-19 13:52:41 by KlenwellAdmin [adds lazy sampling]
Additions:
http://search.twitter.com/search?q=lastgoogle


Revision [1050]

Edited on 2009-05-18 09:16:14 by KlenwellAdmin [adds lazy sampling]
Additions:
%%(php)
<?php
// handlers/page/test.php
$tpl = <<<XHTML
<div class="page">
This is a test handler. To disable, delete the file <tt>test.php</tt> from
<tt>/handlers/page/</tt> directory.
</div>
XHTML;
printf($tpl);
?>


Revision [1049]

Edited on 2009-04-18 13:34:11 by KlenwellAdmin [adds lazy sampling]
Additions:
%%find ~/qed/ -maxdepth 4 -name "*.conf" | xargs perl -w -i -p -e "s/VirtualHost 127.0.0.1/VirtualHost */g"%%


Revision [1048]

Edited on 2009-04-11 11:53:00 by KlenwellAdmin [adds lazy sampling]
Additions:
http://www.klenwell.com/press/2009/04/formencode-state/
Deletions:
formencode state: http://wiki.pylonshq.com/display/pylonscookbook/The+other+FormEncode+manual+(UNFINISHED) (see bottom)
# in controller
class FormencodeState(object):
"""
State class for formencode
Although NOT well documented, to use the state argument in the to_python
method in the context of schema that does complex, multistep validation,
the state argument must be an object that formencode can hang additional
attributes from, else you get errors like:
Module formencode.schema:114 in _to_python
>> state.full_dict = value_dict
<type 'exceptions.AttributeError'>: 'dict' object has no attribute 'full_dict'
"""
pass
...
Validator = SourceDataPreValidator()
ControllerState = FormencodeState()
ControllerState.source = 'csv'
Validator.to_python(DataValue, ControllerState)
# in validator
class SourceDataPreValidator(formencode.validators.FormValidator):
"""normalize data from either a form submission or a csv file upload and validate"""
validate_partial_form = True
def _to_python(self, value, state):
"""normalize csv input"""
if state.source == 'csv':
value['normal_data'] = self._normalize_csv_data(value.get('csv_import_file'), state)
elif state.source == 'form':
pass
return value
def _normalize_import_data(self, csv_file_string, state):
NormalDataList = []
ImportedLines = csv_file_string.split('\n')
for i in range(len(ImportedLines)):
ColValues = ImportedLines[i].split(',')
fpre = 'csv_import-' + str(i)
NormalDataList.append((fpre + '.id', str(ColValues[1])))
NormalDataList.append((fpre + '.amount', str(ColValues[2])))
NormalDataList.append((fpre + '.date',
self._importdate_to_python_date(ColValues[4])))
return NormalDataList
def _importdate_to_python_date(self, datestr):
"""some code to convert a date string to object"""
pass


Revision [1047]

Edited on 2009-04-10 12:03:34 by KlenwellAdmin [adds lazy sampling]
Additions:
~~- adding setting for max_frequency and if time() - last_emailed < $mail_no_more_than_every, exit
Deletions:
~~- adding setting for max_frequency and if time() - last_emailed < max_mail_frequency, exit


Revision [1046]

Edited on 2009-04-10 12:02:36 by KlenwellAdmin [adds lazy sampling]
Additions:
~- enforce access through url: domain.com/wikka/$access_code/recent_changes
~- additional abuse check
~- when called directly, display last
~~- on call, read page and parse out last_emailed.
~~- adding setting for max_frequency and if time() - last_emailed < max_mail_frequency, exit
~~- upon email, edit page to include line: last_emailed=uts
~- is it possible to pass additional parameters in the url? e.g. wikka/$access_code/recent_changes/3600 (for last 3600 s or 1 hr)
Deletions:
~- enforce access through url: domain.com/wikka/$access_code/mail_changes_to_admin


Revision [1045]

Edited on 2009-04-10 11:57:26 by KlenwellAdmin [adds lazy sampling]
Additions:
~- enforce access through url: domain.com/wikka/$access_code/mail_changes_to_admin
~- add setting for $access_code
Deletions:
~- enforce security through url: domain.com/wikka/$cron_code/mail_changes_to_admin
~- add setting for $cron_code


Revision [1044]

Edited on 2009-04-10 11:56:37 by KlenwellAdmin [adds lazy sampling]
Additions:
Reconfigure as [[http://wikkawiki.org/RecentChangesNotifier?show_comments=1#comments Wikka Recent Changes Notifier]] as a [[http://docs.wikkawiki.org/HandlerInfo handler]]
~- enforce security through url: domain.com/wikka/$cron_code/mail_changes_to_admin
~- add setting for $cron_code
~- check that url match $cron_code
~- add setting for email, but default to wiki admin
Deletions:
Reconfigure as [[http://wikkawiki.org/RecentChangesNotifier?show_comments=1#comments Wikka Recent Changes Notifier]] as a [[http://docs.wikkawiki.org/HandlerInfo handler]]


Revision [1043]

Edited on 2009-04-10 11:07:27 by KlenwellAdmin [adds lazy sampling]
Additions:
Reconfigure as [[http://wikkawiki.org/RecentChangesNotifier?show_comments=1#comments Wikka Recent Changes Notifier]] as a [[http://docs.wikkawiki.org/HandlerInfo handler]]


Revision [1042]

Edited on 2009-04-10 07:50:01 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://us2.php.net/manual/en/mail.configuration.php PHP Mail Configuration]]


Revision [1041]

Edited on 2009-04-01 10:49:55 by KlenwellAdmin [adds lazy sampling]
Additions:
Wikka Slowness: http://wikkawiki.org/ExtremeSlownessWorkaround


Revision [1040]

Edited on 2009-03-30 19:25:27 by KlenwellAdmin [adds lazy sampling]
Additions:
# copying svn dir sans svn dirs
$ rsync -r --exclude=.svn /path/to/svn_dir /tmp


Revision [1039]

Edited on 2009-03-17 12:04:20 by KlenwellAdmin [adds lazy sampling]
Additions:
komodo.assertMacroVersion(2);
if (komodo.view) { komodo.view.setFocus() };
path_ = gViewMgr.currentView.document.file.path;
if ( prompt( 'current file path', path_) )
komodo.view.selection = path_;


Revision [1038]

Edited on 2009-03-16 09:17:59 by KlenwellAdmin [adds lazy sampling]
Additions:
var D = {'a':1, 'b':2, 'c':1, 'd':3};
console.log('begin', D);
for ( k in D ) {
console.log('outer', k, ':', D[k]);
for ( k2 in D ) {
if ( k2 == k ) continue;
if ( D[k] != D[k2] ) continue;
console.log('removing dupe', k2, ':', D[k2] );
delete D[k2];
}
console.log('end', D);
Page was generated in 9.3332 seconds!


Revision [1037]

Edited on 2009-03-14 12:27:45 by KlenwellAdmin [adds lazy sampling]
Additions:
Komodo Current File Path
prompt('current file path', gViewMgr.currentView.document.file.path)
Deletions:
Array
(
[op] => max supported int: 2^52 or 4503599627370496
[bc] => max supported int >= 2^999 or 5357543035931336604742125245300009052807024058527668037218751941851755255624680612465991894078479290637973364587765734125935726428461570217992288787349287401967283887412115492710537302531185570938977091076523237491790970633699383779582771973038531457285598238843271083830214915826312193418602834034688
)


Revision [1036]

Edited on 2009-03-14 10:16:35 by KlenwellAdmin [adds lazy sampling]
Deletions:
%%(php)
<?php
$max = 1000;
foreach ( range(1,$max) as $x )
{
if (
! ( pow(2,$x)+1 > pow(2,$x) ) ||
! ( pow(2,$x)-1 < pow(2,$x) ) ||
! ( pow(2,$x-1)*2 == pow(2,$x) )
) break;
$maxpow = $x-1;
$maxint = bcpow(2, $maxpow);
$Result['op'] = "max supported int: 2^$maxpow or $maxint\n";
foreach ( range(1,$max) as $x )
{
if (
! ( bccomp(bcadd(bcpow(2,$x),1), bcpow(2,$x)) == 1 ) ||
! ( bccomp(bcsub(bcpow(2,$x),1), bcpow(2,$x)) == -1 ) ||
! ( bccomp(bcmul(bcpow(2,$x-1),2), bcpow(2,$x)) == 0 )
) break;
$maxpow = $x-1;
$maxint = bcpow(2, $maxpow);
$Result['bc'] = "max supported int >= 2^$maxpow or $maxint\n";
printf("<pre>%s</pre>", print_r($Result,1));
?>


Revision [1035]

Edited on 2009-03-10 13:55:17 by KlenwellAdmin [adds lazy sampling]
Additions:
%%(php)
<?php
$max = 1000;
foreach ( range(1,$max) as $x )
{
if (
! ( pow(2,$x)+1 > pow(2,$x) ) ||
! ( pow(2,$x)-1 < pow(2,$x) ) ||
! ( pow(2,$x-1)*2 == pow(2,$x) )
) break;
$maxpow = $x-1;
$maxint = bcpow(2, $maxpow);
$Result['op'] = "max supported int: 2^$maxpow or $maxint\n";
foreach ( range(1,$max) as $x )
{
if (
! ( bccomp(bcadd(bcpow(2,$x),1), bcpow(2,$x)) == 1 ) ||
! ( bccomp(bcsub(bcpow(2,$x),1), bcpow(2,$x)) == -1 ) ||
! ( bccomp(bcmul(bcpow(2,$x-1),2), bcpow(2,$x)) == 0 )
) break;
$maxpow = $x-1;
$maxint = bcpow(2, $maxpow);
$Result['bc'] = "max supported int >= 2^$maxpow or $maxint\n";
printf("<pre>%s</pre>", print_r($Result,1));
?>
Array
(
[op] => max supported int: 2^52 or 4503599627370496
[bc] => max supported int >= 2^999 or 5357543035931336604742125245300009052807024058527668037218751941851755255624680612465991894078479290637973364587765734125935726428461570217992288787349287401967283887412115492710537302531185570938977091076523237491790970633699383779582771973038531457285598238843271083830214915826312193418602834034688
)


Revision [1034]

Edited on 2009-03-05 09:26:14 by KlenwellAdmin [adds lazy sampling]
Additions:
formencode state: http://wiki.pylonshq.com/display/pylonscookbook/The+other+FormEncode+manual+(UNFINISHED) (see bottom)
# in controller
class FormencodeState(object):
"""
State class for formencode
Although NOT well documented, to use the state argument in the to_python
method in the context of schema that does complex, multistep validation,
the state argument must be an object that formencode can hang additional
attributes from, else you get errors like:
Module formencode.schema:114 in _to_python
>> state.full_dict = value_dict
<type 'exceptions.AttributeError'>: 'dict' object has no attribute 'full_dict'
"""
pass
...
Validator = SourceDataPreValidator()
ControllerState = FormencodeState()
ControllerState.source = 'csv'
Validator.to_python(DataValue, ControllerState)
# in validator
class SourceDataPreValidator(formencode.validators.FormValidator):
"""normalize data from either a form submission or a csv file upload and validate"""
validate_partial_form = True
def _to_python(self, value, state):
"""normalize csv input"""
if state.source == 'csv':
value['normal_data'] = self._normalize_csv_data(value.get('csv_import_file'), state)
elif state.source == 'form':
pass
return value
def _normalize_import_data(self, csv_file_string, state):
NormalDataList = []
ImportedLines = csv_file_string.split('\n')
for i in range(len(ImportedLines)):
ColValues = ImportedLines[i].split(',')
fpre = 'csv_import-' + str(i)
NormalDataList.append((fpre + '.id', str(ColValues[1])))
NormalDataList.append((fpre + '.amount', str(ColValues[2])))
NormalDataList.append((fpre + '.date',
self._importdate_to_python_date(ColValues[4])))
return NormalDataList
def _importdate_to_python_date(self, datestr):
"""some code to convert a date string to object"""
pass


Revision [1033]

Edited on 2009-03-03 10:28:05 by KlenwellAdmin [adds lazy sampling]
Additions:
http://www.phpied.com/3-ways-to-define-a-javascript-class/ / http://www.prototypejs.org/learn/class-inheritance
json class:
<script type="text/javascript">
function Speaker () {
this.type = name;
this.speak = function(message) {
alert(message);
};
function Machine(type) {
this.type = type;
this.Speaker = new Speaker();
this.speak = function(message) {
this.Speaker.speak(this.type + ' : ' + message);
};
var iPod = {
Speaker: new Speaker(),
speak: function (message) {
this.Speaker.speak(message);
var iPhone = new Machine('iPhone');
iPhone.speak('support iTunes');
iPod.speak('hey, it worked!');
</script>
Deletions:
json class (http://www.prototypejs.org/learn/class-inheritance):
var dog = {
name: "Fido",
breed: "beagle",
speak: function () {
alert('ruff ruff');


Revision [1032]

Edited on 2009-03-03 09:49:34 by KlenwellAdmin [adds lazy sampling]
Additions:
json class (http://www.prototypejs.org/learn/class-inheritance):
%%(javascript)
var dog = {
name: "Fido",
breed: "beagle",
speak: function () {
alert('ruff ruff');
}
}


Revision [1031]

Edited on 2009-02-27 08:04:54 by KlenwellAdmin [adds lazy sampling]
Additions:
tax calculator calculations: http://www.sacbee.com/1098/story/1627728.html
# A couple calculations
# Income $30k / Car $10k
Not Married: $192 -> monthly increase: $16 (2 Trips to McDonalds)
Married: $192
2 Kids: $612
# Income $100k / Car $25k
Not Married: $488 -> monthly: $40.67 (1 Video Game)
Married: $534
2 Kids: $954
# My actual numbers are somewhere in between


Revision [1030]

Edited on 2009-02-18 15:04:47 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://surfshot.s3.amazonaws.com/media/1/0/1087692-large.jpg windansea 02.18 pm]]
Deletions:
http://surfshot.s3.amazonaws.com/media/1/0/1087692-large.jpg


Revision [1029]

Edited on 2009-02-18 15:04:05 by KlenwellAdmin [adds lazy sampling]
Additions:
http://surfshot.s3.amazonaws.com/media/1/0/1087692-large.jpg


Revision [1028]

Edited on 2009-02-17 10:27:25 by KlenwellAdmin [adds lazy sampling]
Additions:
%%(css)
/* background: color image repeat attachment position */
background: #FFCC66 url("file or url name") no-repeat fixed right bottom;


Revision [1027]

Edited on 2009-02-15 20:50:37 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.amazon.com/Symposium-Phaedrus-Everymans-Library-Plato/dp/0375411747/ref=si3_rdr_bb_product Plato's Symposium]]


Revision [1024]

Edited on 2009-02-06 10:36:02 by KlenwellAdmin [adds lazy sampling]
Additions:
mysqldump dbname | ssh user@remoteserver "cat - > dbname.db"


Revision [1012]

Edited on 2009-01-17 10:50:31 by KlenwellAdmin [adds lazy sampling]
Additions:
pastebin: [[Paste20090117 CakePhp Custom Pagination Methods]]
pastebin: [[Paste20090110 Klenwell CakePhp Form Helper]]
Deletions:
pastebin: [[Paste20090110 Klenwell Form Helper]]


Revision [1011]

Edited on 2009-01-17 00:46:41 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.youtube.com/watch?v=P5RDn5Y0D_0&feature=related in case you missed 1978]]


Revision [1010]

Edited on 2009-01-16 14:32:57 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://img160.imageshack.us/img160/6940/socalnowca6.png perfect weather/dead ocean]][[http://cdip.ucsd.edu/models/socal_now.gif current]]
Deletions:
[[http://cdip.ucsd.edu/models/socal_now.gif perfect weather/dead ocean]]


Revision [1009]

Edited on 2009-01-16 14:28:51 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://cdip.ucsd.edu/models/socal_now.gif perfect weather/dead ocean]]


Revision [1002]

Edited on 2009-01-10 10:22:48 by KlenwellAdmin [adds lazy sampling]
Additions:
pastebin: [[Paste20090110 Klenwell Form Helper]]
Deletions:
pastebin: Paste20090110


Revision [1001]

Edited on 2009-01-10 10:22:16 by KlenwellAdmin [adds lazy sampling]
Additions:
pastebin: Paste20090110


Revision [1000]

Edited on 2009-01-06 07:35:05 by KlenwellAdmin [adds lazy sampling]
Additions:
python regex (I could have sworn I pasted this here before):
%%(python)
import re
# compile
html = "'<html>\n<head>\n<title>Title</title>\n</head>\n</html>"
regex = re.compile('<.*?>',)
result = regex.search(html)
print result.group()
# ungreedy
html = "'<html><head><title>Title</title>"
print re.search('<.*?>', html).group()
# substitution
dirty = "some alphanum and some other ^$#%&*%!"
rgx = r'[^a-zA-Z0-9]' # alphanum only!
clean = re.sub(rgx, '', dirty)
%%


Revision [997]

Edited on 2009-01-06 07:30:32 by KlenwellAdmin [adds lazy sampling]
Additions:
[[CocktailNapkin2008 2008 Napkin]]
[[CocktailNapkin2007 2007 Napkin]]
Deletions:
[[CocktailNapkin2007 2007 Cocktail Napkin]]
SpecialCakePhpModelTesting
mysql: value in one table not another
%%(mysql)SELECT somecol FROM a WHERE somecol NOT IN ( SELECT somecol FROM b )%%
%%CREATE TABLE db2.table LIKE db1.table;
INSERT INTO db2.table SELECT * FROM db1.table;%%
[[http://www.nytimes.com/2008/11/10/opinion/10krugman.html in defense of public works projects]]
cakephp form "multiple models": [[http://book.cakephp.org/view/189/Automagic-Form-Elements Form Helper]] [[http://book.cakephp.org/view/125/Data-Validation Data Validation]] [[http://book.cakephp.org/view/75/Saving-Your-Data Models]] [[http://bakery.cakephp.org/articles/view/improved-advance-validation-with-parameters bakery article]] [[http://teknoid.wordpress.com/2008/06/09/15-essential-cakephp-tips/ teknoid tips]]
waves 11/5 in oside: [[http://surfshot.s3.amazonaws.com/media/1/0/1043981-large.jpg 1]] [[http://surfshot.s3.amazonaws.com/media/1/0/1043975-large.jpg 2]] [[http://surfshot.s3.amazonaws.com/media/1/0/1043980-large.jpg 3]]
[[SpecialCrondSample Sample cron.d file]]
http://forum.notebookreview.com/showthread.php?t=294364 [[http://accessories.us.dell.com/sna/products/Motherboards/productdetail.aspx?c=us&l=en&s=bsd&cs=04&sku=TT359&mfgpid=192256&chassisid=8544#Overview order]]
HG: Add path to new repository:
%%
# web server paths
[paths]
# virtual/path (http:/domain/name = /real/path)
test = /home/klenwell/root/tmp/hgtest
new_repo = /path/to/repo
[web]
style = gitweb
contact = admin@email.com
description = mercurial repositories
name = central repository
%%
http://bitchphd.blogspot.com/
[[http://www.nytimes.com/slideshow/2008/08/31/travel/0831-BIARRITZ_index.html photos that actually make me want to travel again]]
http://freakonomics.blogs.nytimes.com/2008/08/20/have-economic-debates-changed-since-1977/index.html?hp
http://garfield.nfshost.com/?s=lasagna&p=2
[[http://www.nytimes.com/2008/08/17/books/review/Donadio-t.html?8bu&emc=bu blurbs]]
python [[http://docs.python.org/lib/node46.html re]]:
%%(python)
try:
result = re.search(pattern, subject, re.S).groups()[0]
return result
except Exception, e:
return False
%%
logrotate: http://linux.about.com/od/commands/l/blcmdl8_logrota.htm http://www.linux.com/articles/48390
[[http://www.newyorker.com/talk/comment/2008/07/28/080728taco_talk_cassidy For some twenty years, politicians of both parties have been using free-market rhetoric as a cover for favors to big campaign contributors.]]
linux autostop: ""<tt>ps aux | grep 'foo' | awk '{print $2}' | xargs kill -9</tt>""
[[http://www.nytimes.com/2008/07/20/business/20debt.html?th&emc=th junk fees]]
[[http://www.faqts.com/knowledge_base/view.phtml/aid/30990/fid/53 js __file__]]
[[http://ask.slashdot.org/askslashdot/08/07/18/0046220.shtml os for old machines]]
[[http://nltk.sourceforge.net/index.php/Getting_Started python nltk]] [[http://www.abisource.org/projects/link-grammar/ link grammar parser]]
[[http://www.nytimes.com/2008/07/13/magazine/13officer-t.html?pagewanted=all 2nd Amendment as Foreign Policy Issue]]
[[http://judson.blogs.nytimes.com/2008/07/15/lets-get-rid-of-darwinism/index.html Against Darwinism]]
[[http://it.slashdot.org/comments.pl?sid=613269&cid=24182529 columbo 2.0]]
[[http://arstechnica.com/news.ars/post/20080708-hands-on-googles-lively-social-3d-world-is-20-percent-done.html Google Lively]] (for sonnet monkeys?)
[[http://tech.slashdot.org/article.pl?sid=08/07/08/0116238 Handling Flash Crowds from your Garage]]
AVG alternatives: [[http://www.clamwin.com/ clamwin]] [[http://www.avast.com/ avast]]
[[http://www.makelinux.net/kernel_map linux kernel map]]
To Do: take a charge in the break room
[[http://www.bbc.co.uk/languages/spanish/ BBC Spanish]] [[http://www.bravenewtraveler.com/2008/02/04/8-free-online-resources-for-learning-a-new-language/ free language lessons]]
I'll have to check this out when I get home: http://icanhaslolpron.com
[[http://sites.google.com/ Google wiki]]
http://www.worldcat.org/
bad housing news: [[http://calculatedrisk.blogspot.com/2008/03/real-case-shiller-house-price-index.html calculatedrisk]] [[http://sdhpi.blogspot.com/2008/05/is-this-bottom.html sdhpi]] [[http://en.wikipedia.org/wiki/Case-Shiller_index Case-Shiller]]
[[http://tech.slashdot.org/comments.pl?sid=592263&cid=23904759 /. troll of the day and riposte]]
""<tt>A[HREF*="myspace.com"]:after { content: " [BRAIN DAMAGE WARNING]"!important ; color: red }</tt>"" ([[http://tech.slashdot.org/comments.pl?sid=592263&cid=23904767 source]])
[[http://www.nytimes.com/2008/06/17/science/17mund.html steampunk web]] (almost literally)
.hg [[http://www.selenic.com/mercurial/wiki/index.cgi/UsingExtensions extensions]]:
%%(python)
[extensions]
# Enable the 'glog' graphical log extension
hgext.graphlog =
# Enable CVS style variable substitution
hgext.keyword =
%%
[[http://seehuhn.de/pages/pdate python dates and times]] (I'm always forgetting this crap):
%%(python)
import datetime, time
print datetime.datetime.now() # current local datetime
print time.time() # unix timestamp
%%
[[http://www.simulation-argument.com/classic.html simulation argument]]
a pythonic tribute to [[http://forums.xkcd.com/viewtopic.php?f=11&t=23249 xkcd]]: ""<code>xkcd = lambda x,k,c,d: (({k:False},d,c)[int(''.join([str(int(k in t)) for t in [c,d]]),2)])[k] or x</code>""
more django: [[http://www.djangoproject.com/documentation/modelforms/ modelforms]] [[http://www.djangoproject.com/documentation/newforms/#modelmultiplechoicefield forms]]
rent or buy: http://www.nytimes.com/2008/05/28/business/28leonhardt.html [[http://www.nytimes.com/2007/04/10/business/2007_BUYRENT_GRAPHIC.html? calculator]]
[[http://en.wikipedia.org/wiki/Pitaya dragonfruit]]
[[http://code.google.com/apis/ajaxlibs/ google ajaxlibs]] ([[http://developers.slashdot.org/developers/08/05/28/144218.shtml /.]])
[[http://www.nytimes.com/2008/05/28/dining/28flavor.html flavor-tripping]]
[[http://home.netcom.com/~tjensen/ptr/ch1x.htm pointers]] (to the point)
[[http://www.fonts500.com/?page=1 500 Fonts]] [[http://thepiratebay.org/tor/3660252/500_Fonts_from_fonts500.com all at once]]
[[http://tech.slashdot.org/comments.pl?sid=565231&cid=23559299 leave it to Jesus 666]]
[[http://www.djangoproject.com/documentation/forms/ django forms]] [[http://www.djangoproject.com/documentation/newforms/ django newforms]] [[http://code.google.com/appengine/articles/djangoforms.html django form validation]] [[http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/widgets.py django form tests (examples)]] [[http://www.djangoproject.com/documentation/form_wizard/ django forms wizard]]
scripps 05.23: [[http://surfshot.s3.amazonaws.com/media/9/7/975364-large.jpg 1]] [[http://surfshot.s3.amazonaws.com/media/9/7/975363-large.jpg 2]] [[http://surfshot.s3.amazonaws.com/media/9/7/975370-large.jpg 3]]
http://code.google.com/p/google-app-engine-samples/wiki/GoogleAppEngineSamples [[http://groups.google.com/group/google-appengine/browse_frm/thread/d3673d0ec7ead0e2 djangoforms]] [[http://groups.google.com/group/google-appengine/browse_frm/thread/13d1f026d46bd35f model keys]]
[[http://archive.ics.uci.edu/ml/ lots of data]] (courtesy of my alma mater)
[[http://highscalability.com/how-i-learned-stop-worrying-and-love-using-lot-disk-space-scale querying gapp]]
http://img143.imageshack.us/img143/3660/fbooknb5.png
sessions: [[http://groups.google.com/group/google-appengine/browse_frm/thread/1c459b2ca7a6e643/2311877beffe0403?lnk=gst&q=session#2311877beffe0403 datastore]] [[http://groups.google.com/group/google-appengine/browse_frm/thread/f162c186c3e68f1a/1ea824e3bebd5801?lnk=gst&q=session#1ea824e3bebd5801 class]] [[http://code.google.com/appengine/docs/python/appcaching.html appcaching]]
[[http://entertainment.slashdot.org/comments.pl?sid=556912&cid=23461200 mythbuntu]]
[[http://www.rinkworks.com/words/collective.shtml words for groups of animals]]
[[http://kwap.appspot.com/ klenwell @ google app engine]] [[http://groups.google.com/group/google-appengine/browse_frm/thread/c9e8a906a88a8102 links to good gapp tips]]
[[http://us2.php.net/manual/en/function.debug-backtrace.php#72534 php debug]]
[[http://www.nytimes.com/2008/05/13/world/middleeast/13girls.html?_r=1&hp=&pagewanted=all Project Alia]]
[[http://entertainment.slashdot.org/entertainment/08/05/13/0316251.shtml free as in beer beer]]
[[http://www.msnbc.msn.com/id/23359042/from/ET/ no plastic surgery!]]
[[http://www.housingmaps.com/ housingmaps.com]]
on fonts: [[http://fontstruct.fontshop.com/ fontstruct]] [[http://www.sweeperscalendar.com/variorum/1129/ the prophecy]]
stupid lambda tricks: ""<code>in_dict_list = lambda dic, k, v: v in [d[k] for d in dic]</code>""
[[http://www.nytimes.com/2008/05/08/fashion/08PUNK.html?_r=1&oref=slogin steampunk]] ""=="" [[http://en.wikipedia.org/wiki/Tomorrowland#Tomorrowland_1998 tomorrowland 1998]]
[[http://code.google.com/appengine/docs/gettingstarted/ google app engine]] [[http://blog.wachob.com/2008/04/google-appengin.html scaling with gae]] [[http://perspectives.mvdirona.com/2008/04/21/GoogleApplicationEngine.aspx a review]] [[http://code.google.com/appengine/docs/python/purepython.html python in gae]] [[http://groups.google.com/group/google-appengine/browse_frm/thread/dc927ba00944027f gApp on ubuntu]] [[http://code.google.com/p/rietveld/source/browse gApp example code]]
[[http://aspn.activestate.com/ASPN/docs/Komodo/4.3/komodo-js-api.html komodo js api]]
[[http://en.wikipedia.org/wiki/AI_Winter AI Winter]] [[http://www.nytimes.com/2008/05/03/technology/03koller.html?th&emc=th is over]]
http://www.gnu.org/software/diction/ http://www.link.cs.cmu.edu/link/ [[http://alanhorkan.livejournal.com/16062.html overview]] [[http://papyr.com/hypertextbooks/grammar/gramchek.htm tests]] [[http://en.wikipedia.org/wiki/Grammar_checker wikipedia]]
[[http://pidgin.im/ pidgin]] (nice home page)
[[http://www.herecomeseverybody.org/2008/04/looking-for-the-mouse.html the sitcom]] [[http://tech.slashdot.org/tech/08/04/27/1422258.shtml (./)]] | [[http://tech.slashdot.org/article.pl?sid=08/04/30/1515229 Berners-Lee on Web]]
[[http://www.shoutcast.com/directory/index.phtml shoutcast streams]] see also [[http://lifehacker.com/384545/superior-alternatives-to-crappy-windows-software vlc]]
[[http://yro.slashdot.org/comments.pl?sid=537280&cid=23231314 /. life lessons: if arrested...]]
[[http://politics.slashdot.org/comments.pl?sid=228403&cid=18513137 John McCain ad hominem]]
[[http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references HTML entities]]
[[http://en.wikipedia.org/wiki/Simon-Ehrlich_wager Simon-Ehrlich Wager]] [[http://krugman.blogs.nytimes.com/2008/04/22/limits-to-growth-and-related-stuff/ Krugman]]
[[http://www.selenic.com/pipermail/mercurial/2007-April/012921.html removing a file from a python repo without deleting]] **use hg rm -A** (e.g. hg rm -A dir/*)
[[http://www.nytimes.com/2008/04/24/books/24garn.html?_r=1&th&emc=th&oref=slogin kleinzahler]]
[[http://www.ocfamily.com/t-FeatureStory_BabyNames_0408.aspx oc baby names]]
[[http://www.activestate.com/Products/komodo_ide/komodo_edit.mhtml komodo edit]] [[http://community.activestate.com/faq/komodo-file-locations saving preference file]]
[[http://code.google.com/apis/igoogle/ igoogle API]]
[[http://tech.slashdot.org/article.pl?sid=08/04/16/121225&from=rss Yahoo Analytics (IndexTools)]]
[[http://www.pseudocoder.com/archives/2007/02/27/cakephp-cache-performance/ cakephp cache benchmark]]
%%(bash)
# cron.d file
# to activate, link to /etc/cron.d: ln -s <path>/fname.cron /etc/cron.d/link_name
# +---------------- minute (0 - 59)
# | +------------- hour (0 - 23)
# | | +---------- day of month (1 - 31)
# | | | +------- month (1 - 12)
# | | | | +---- day of week (0 - 6) (Sunday=0 or 7)
# | | | | |
# M H DM MO DW USER SCRIPT
%%
[[http://www.nytimes.com/2008/04/21/opinion/21krugman.html the commodities bubble]]
[[http://tech.slashdot.org/comments.pl?sid=526820&cid=23115228 oss binary blobs]]
emacs: [[http://www.google.com/search?q=customize+emacs+-scribd.com&hl=en&lr=&as_qdr=all&start=10&sa=N customize]] [[http://www.google.com/search?hl=en&lr=&as_qdr=all&q=+site:www.gnu.org+customize+emacs+-scribd.com manual]] [[http://www.gnu.org/software/emacs/tour/ tour]]
[[http://forums.xkcd.com/viewtopic.php?f=11&t=11935&st=0&sk=t&sd=a&start=440#p693630 a mighty daemon]]
[[http://w-shadow.com/blog/2008/04/12/simple-text-summarizer-in-php/ simple text summarizer]] [[http://www.symfony-project.org/askeet/1_0/21 simple search engine]]
ny times: [[http://www.nytimes.com/2008/04/13/business/13cash.html?th=&emc=th&pagewanted=all wall st. sleaze]] [[http://www.nytimes.com/2008/04/14/business/media/14link.html?th=&emc=th&pagewanted=all some guy who wrote a program to write 200,000 books]]
cakephp: [[http://book.cakephp.org/view/32/installation#advanced-installation-35 shared core setup]] [[http://bakery.cakephp.org/articles/view/maintaining-an-application-independant-code-library app-indy lib]] [[http://manual.cakephp.org/chapter/plugins plugins]]
[[http://bakery.cakephp.org/ <a href="http://mushpup.org/">pw</a>: m{d/u}l11]]
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP [[http://dev.mysql.com/doc/refman/4.1/en/timestamp.html mysql.com]]
python encoding: [[http://mail.python.org/pipermail/python-list/2007-May/442985.html nutshell]] [[http://www.reportlab.com/i18n/python_unicode_tutorial.html unicode tutorial]]
python on web: [[http://www.modpython.org/ modpython]] [[http://www.zope.org/ zope]] [[http://code.google.com/appengine/docs/gettingstarted/ google webapp]]
[[http://code.google.com/appengine/docs/whatisgoogleappengine.html google app engine]]
vim: [[http://www.linux.com/articles/54159 marks and jumps]]
PHP PCRE Issue: [[http://us3.php.net/manual/en/ref.pcre.php#77790 cause]] [[http://www.phpinsider.com/smarty-forum/viewtopic.php?p=48604 cause]] [[http://bugs.php.net/bug.php?id=40846 bugs.php.net]] [[http://tracker.moodle.org/browse/MDL-11237?focusedCommentId=34538#action_34538 a solution]]
[[http://en.wikipedia.org/wiki/Moby_Project Moby Project]] [[http://www.nzdl.org/ELKB/download.html Roget's]]
[[http://cb.vu/unixtoolbox.xhtml unix cheat sheet]]
[[http://www.dell.com/content/products/productdetails.aspx/vostronb_1400?c=us&cs=04&l=en&s=bsd&~tab=bundlestab vostro 1400]]
[[http://www.interest.com/content/calculators/rentvsbuy.asp rent v. buy]] [[http://www.bloomberg.com/invest/calculators/mortgage.html bloomberg mortgage calculator]]
[[SpecialBCAA BCAA]]
[[http://garfieldminusgarfield.tumblr.com/ Garfield - Garfield = Existential Humor]]
Cool Dingbats: [[http://www.bittbox.com/fonts/dingbats-roundup-16-incredibly-detailed-useful-and-free-dingbat-fonts/ bittbox.com]]
Tivo for Radio: [[http://www.handcoding.com/archives/2005/03/20/ripping-npr-to-mp3-for-an-ipod/ excellent tutorial]] [[http://streamripper.sourceforge.net/ streamripper]] (windows or linux)
OS Flash Dev: [[http://www.mtasc.org/ MTASC]] [[http://www.flashdevelop.org/community/viewtopic.php?t=305 flashdevelop.org]] [[http://fgpwiki.corewatch.net/index.php/How_do_I_get_Started game dev]]
""CakePhp"" config: [[http://www.virtualapplicationserver.com/CakePHP_MultipleInstallNotes.html multiple apps on single site]] [[http://bakery.cakephp.org/articles/view/hosting-admin-urls-on-a-subdomain admin subdomain]]
SSL on Debian ""Apache2"": [[http://ilovett.com/blog/projects/installing-ssl-on-debian-apache2 ilovett.com]] [[http://www.debian-administration.org/articles/349 debian-administration.org]]
[[http://slashdot.org/article.pl?sid=08/01/06/1731247 Goodbye Cruel Word]]: Hello, [[http://www.lyx.org/ lyx]]!
Fun with apache logs: [[http://russell.dyerhouse.com/cgi-bin/article.cgi?article_id=82 set-up]] [[http://www.builderau.com.au/program/unix/soa/Managing-and-parsing-your-Apache-logs/0,339024638,320280756,00.htm parsing]] [[http://crazytoon.com/2007/05/31/apache-how-do-you-set-up-log-rotation-and-archiving-for-apache-logs/ archiving logs]] [[http://www.eos.ncsu.edu/remoteaccess/man/scp.html scp man]]


Revision [994]

Edited on 2008-12-22 17:08:43 by KlenwellAdmin [adds lazy sampling]
Additions:
SpecialCakePhpModelTesting


Revision [991]

Edited on 2008-12-10 15:04:36 by KlenwellAdmin [adds lazy sampling]
Additions:
%%(mysql)SELECT somecol FROM a WHERE somecol NOT IN ( SELECT somecol FROM b )%%
Deletions:
%%(mysql)SELECT field FROM a WHERE field NOT IN ( SELECT field FROM b )%%


Revision [990]

Edited on 2008-12-10 15:04:13 by KlenwellAdmin [adds lazy sampling]
Additions:
mysql: value in one table not another
%%(mysql)SELECT field FROM a WHERE field NOT IN ( SELECT field FROM b )%%


Revision [986]

Edited on 2008-11-20 08:12:50 by KlenwellAdmin [adds lazy sampling]
Additions:
%%CREATE TABLE db2.table LIKE db1.table;
INSERT INTO db2.table SELECT * FROM db1.table;%%


Revision [985]

Edited on 2008-11-17 19:26:23 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2008/11/10/opinion/10krugman.html in defense of public works projects]]


Revision [984]

Edited on 2008-11-16 21:21:23 by KlenwellAdmin [adds lazy sampling]
Additions:
cakephp form "multiple models": [[http://book.cakephp.org/view/189/Automagic-Form-Elements Form Helper]] [[http://book.cakephp.org/view/125/Data-Validation Data Validation]] [[http://book.cakephp.org/view/75/Saving-Your-Data Models]] [[http://bakery.cakephp.org/articles/view/improved-advance-validation-with-parameters bakery article]] [[http://teknoid.wordpress.com/2008/06/09/15-essential-cakephp-tips/ teknoid tips]]
Deletions:
cakephp form "multiple models": [[http://bakery.cakephp.org/articles/view/improved-advance-validation-with-parameters bakery article]] [[http://teknoid.wordpress.com/2008/06/09/15-essential-cakephp-tips/ teknoid tips]]


Revision [983]

Edited on 2008-11-16 12:27:47 by KlenwellAdmin [adds lazy sampling]
Additions:
cakephp form "multiple models": [[http://bakery.cakephp.org/articles/view/improved-advance-validation-with-parameters bakery article]] [[http://teknoid.wordpress.com/2008/06/09/15-essential-cakephp-tips/ teknoid tips]]
Deletions:
cakephp form "multiple models": [[http://bakery.cakephp.org/articles/view/improved-advance-validation-with-parameters bakery article]]
[[http://teknoid.wordpress.com/2008/06/09/15-essential-cakephp-tips/ teknoid tips]]


Revision [982]

Edited on 2008-11-16 12:27:31 by KlenwellAdmin [adds lazy sampling]
Additions:
cakephp form "multiple models": [[http://bakery.cakephp.org/articles/view/improved-advance-validation-with-parameters bakery article]]
[[http://teknoid.wordpress.com/2008/06/09/15-essential-cakephp-tips/ teknoid tips]]


Revision [979]

Edited on 2008-11-06 08:32:52 by KlenwellAdmin [adds lazy sampling]
Additions:
waves 11/5 in oside: [[http://surfshot.s3.amazonaws.com/media/1/0/1043981-large.jpg 1]] [[http://surfshot.s3.amazonaws.com/media/1/0/1043975-large.jpg 2]] [[http://surfshot.s3.amazonaws.com/media/1/0/1043980-large.jpg 3]]
Deletions:
waves 11/5: [[http://surfshot.s3.amazonaws.com/media/1/0/1043981-large.jpg 1]] [[http://surfshot.s3.amazonaws.com/media/1/0/1043975-large.jpg 2]] [[http://surfshot.s3.amazonaws.com/media/1/0/1043980-large.jpg 3]]


Revision [978]

Edited on 2008-11-06 08:32:19 by KlenwellAdmin [adds lazy sampling]
Additions:
waves 11/5: [[http://surfshot.s3.amazonaws.com/media/1/0/1043981-large.jpg 1]] [[http://surfshot.s3.amazonaws.com/media/1/0/1043975-large.jpg 2]] [[http://surfshot.s3.amazonaws.com/media/1/0/1043980-large.jpg 3]]


Revision [972]

Edited on 2008-10-20 21:33:31 by KlenwellAdmin [adds lazy sampling]
Additions:
[[SpecialCrondSample Sample cron.d file]]


Revision [971]

Edited on 2008-10-03 08:08:41 by KlenwellAdmin [adds lazy sampling]
Additions:
http://forum.notebookreview.com/showthread.php?t=294364 [[http://accessories.us.dell.com/sna/products/Motherboards/productdetail.aspx?c=us&l=en&s=bsd&cs=04&sku=TT359&mfgpid=192256&chassisid=8544#Overview order]]
Deletions:
http://forum.notebookreview.com/showthread.php?t=294364


Revision [970]

Edited on 2008-10-03 07:40:14 by KlenwellAdmin [adds lazy sampling]
Additions:
http://forum.notebookreview.com/showthread.php?t=294364


Revision [969]

Edited on 2008-09-02 23:19:37 by KlenwellAdmin [adds lazy sampling]
Additions:
HG: Add path to new repository:
# web server paths
[paths]
# virtual/path (http:/domain/name = /real/path)
test = /home/klenwell/root/tmp/hgtest
new_repo = /path/to/repo
[web]
style = gitweb
contact = admin@email.com
description = mercurial repositories
name = central repository


Revision [968]

Edited on 2008-08-29 09:24:31 by KlenwellAdmin [adds lazy sampling]
Additions:
http://bitchphd.blogspot.com/


Revision [967]

Edited on 2008-08-29 08:18:07 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/slideshow/2008/08/31/travel/0831-BIARRITZ_index.html photos that actually make me want to travel again]]


Revision [966]

Edited on 2008-08-20 15:22:20 by KlenwellAdmin [adds lazy sampling]
Additions:
http://freakonomics.blogs.nytimes.com/2008/08/20/have-economic-debates-changed-since-1977/index.html?hp


Revision [965]

Edited on 2008-08-20 11:14:48 by KlenwellAdmin [adds lazy sampling]
Additions:
http://garfield.nfshost.com/?s=lasagna&p=2


Revision [964]

Edited on 2008-08-15 15:31:56 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2008/08/17/books/review/Donadio-t.html?8bu&emc=bu blurbs]]


Revision [962]

Edited on 2008-07-30 11:34:34 by KlenwellAdmin [adds lazy sampling]
Additions:
python [[http://docs.python.org/lib/node46.html re]]:
try:
result = re.search(pattern, subject, re.S).groups()[0]
return result
except Exception, e:
return False


Revision [958]

Edited on 2008-07-24 12:39:26 by KlenwellAdmin [adds lazy sampling]
Additions:
logrotate: http://linux.about.com/od/commands/l/blcmdl8_logrota.htm http://www.linux.com/articles/48390


Revision [957]

Edited on 2008-07-22 14:30:40 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.newyorker.com/talk/comment/2008/07/28/080728taco_talk_cassidy For some twenty years, politicians of both parties have been using free-market rhetoric as a cover for favors to big campaign contributors.]]


Revision [956]

Edited on 2008-07-22 07:33:12 by KlenwellAdmin [adds lazy sampling]
Additions:
linux autostop: ""<tt>ps aux | grep 'foo' | awk '{print $2}' | xargs kill -9</tt>""


Revision [955]

Edited on 2008-07-21 07:23:46 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2008/07/20/business/20debt.html?th&emc=th junk fees]]


Revision [954]

Edited on 2008-07-19 20:16:21 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.faqts.com/knowledge_base/view.phtml/aid/30990/fid/53 js __file__]]


Revision [953]

Edited on 2008-07-18 12:51:26 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://ask.slashdot.org/askslashdot/08/07/18/0046220.shtml os for old machines]]


Revision [952]

Edited on 2008-07-16 12:59:57 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://nltk.sourceforge.net/index.php/Getting_Started python nltk]] [[http://www.abisource.org/projects/link-grammar/ link grammar parser]]


Revision [951]

Edited on 2008-07-16 08:19:49 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2008/07/13/magazine/13officer-t.html?pagewanted=all 2nd Amendment as Foreign Policy Issue]]


Revision [950]

Edited on 2008-07-16 07:34:20 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://judson.blogs.nytimes.com/2008/07/15/lets-get-rid-of-darwinism/index.html Against Darwinism]]


Revision [949]

Edited on 2008-07-14 10:59:22 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://it.slashdot.org/comments.pl?sid=613269&cid=24182529 columbo 2.0]]


Revision [948]

Edited on 2008-07-09 07:35:31 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://tech.slashdot.org/article.pl?sid=08/07/08/0116238 Handling Flash Crowds from your Garage]]
Deletions:
[[http://www.klenwell.com/is/SpecialCocktailNapkin/edit Handling Flash Crowds from your Garage]]


Revision [947]

Edited on 2008-07-09 07:34:57 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://arstechnica.com/news.ars/post/20080708-hands-on-googles-lively-social-3d-world-is-20-percent-done.html Google Lively]] (for sonnet monkeys?)


Revision [946]

Edited on 2008-07-08 07:05:00 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.klenwell.com/is/SpecialCocktailNapkin/edit Handling Flash Crowds from your Garage]]


Revision [945]

Edited on 2008-07-03 14:27:07 by KlenwellAdmin [adds lazy sampling]
Additions:
AVG alternatives: [[http://www.clamwin.com/ clamwin]] [[http://www.avast.com/ avast]]


Revision [944]

Edited on 2008-06-29 12:35:33 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.makelinux.net/kernel_map linux kernel map]]


Revision [941]

Edited on 2008-06-26 16:02:09 by KlenwellAdmin [adds lazy sampling]
Additions:
ThumbDrive


Revision [940]

Edited on 2008-06-26 10:29:57 by KlenwellAdmin [adds lazy sampling]
Additions:
To Do: take a charge in the break room


Revision [939]

Edited on 2008-06-25 18:25:17 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.bbc.co.uk/languages/spanish/ BBC Spanish]] [[http://www.bravenewtraveler.com/2008/02/04/8-free-online-resources-for-learning-a-new-language/ free language lessons]]
I'll have to check this out when I get home: http://icanhaslolpron.com
Deletions:
I'll have to check this out when I get home: icanhaslolpron.com


Revision [938]

Edited on 2008-06-25 10:28:48 by KlenwellAdmin [adds lazy sampling]
Additions:
I'll have to check this out when I get home: icanhaslolpron.com


Revision [933]

Edited on 2008-06-24 10:43:12 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://sites.google.com/ Google wiki]]


Revision [932]

Edited on 2008-06-24 10:40:36 by KlenwellAdmin [adds lazy sampling]
Additions:
http://www.worldcat.org/


Revision [931]

Edited on 2008-06-24 08:02:31 by KlenwellAdmin [adds lazy sampling]
Additions:
bad housing news: [[http://calculatedrisk.blogspot.com/2008/03/real-case-shiller-house-price-index.html calculatedrisk]] [[http://sdhpi.blogspot.com/2008/05/is-this-bottom.html sdhpi]] [[http://en.wikipedia.org/wiki/Case-Shiller_index Case-Shiller]]


Revision [930]

Edited on 2008-06-23 14:19:03 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://tech.slashdot.org/comments.pl?sid=592263&cid=23904759 /. troll of the day and riposte]]


Revision [929]

Edited on 2008-06-23 14:14:51 by KlenwellAdmin [adds lazy sampling]
Additions:
""<tt>A[HREF*="myspace.com"]:after { content: " [BRAIN DAMAGE WARNING]"!important ; color: red }</tt>"" ([[http://tech.slashdot.org/comments.pl?sid=592263&cid=23904767 source]])


Revision [928]

Edited on 2008-06-17 15:48:07 by KlenwellAdmin [adds lazy sampling]

No Differences

Revision [927]

Edited on 2008-06-17 15:47:59 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2008/06/17/science/17mund.html steampunk web]] (almost literally)


Revision [925]

Edited on 2008-06-10 12:03:15 by KlenwellAdmin [adds lazy sampling]
Additions:
.hg [[http://www.selenic.com/mercurial/wiki/index.cgi/UsingExtensions extensions]]:
Deletions:
.hg:


Revision [924]

Edited on 2008-06-10 12:01:57 by KlenwellAdmin [adds lazy sampling]
Additions:
.hg:
[extensions]
# Enable the 'glog' graphical log extension
hgext.graphlog =
# Enable CVS style variable substitution
hgext.keyword =


Revision [923]

Edited on 2008-06-10 09:52:12 by KlenwellAdmin [adds lazy sampling]
Additions:
print datetime.datetime.now() # current local datetime
print time.time() # unix timestamp
Deletions:
print datetime.datetime.now()
print time.time()


Revision [922]

Edited on 2008-06-10 09:51:40 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://seehuhn.de/pages/pdate python dates and times]] (I'm always forgetting this crap):
import datetime, time
print time.time()
Deletions:
python now:
import datetime


Revision [921]

Edited on 2008-06-10 09:43:48 by KlenwellAdmin [adds lazy sampling]
Additions:
python now:
%%(python)
import datetime
print datetime.datetime.now()


Revision [920]

Edited on 2008-06-03 13:43:47 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.simulation-argument.com/classic.html simulation argument]]
[[http://forums.xkcd.com/viewtopic.php?f=11&t=11935&st=0&sk=t&sd=a&start=440#p693630 a mighty daemon]]
Deletions:
%%(python)
...
# decapitate parent
os.chdir("/")
os.setsid()
os.umask(0)
# fork #2
try:
pid = os.fork()
if pid > 0:
print "pid: %d" % pid
sys.exit(0)
except OSError, e:
print >>sys.stderr, "fork #2 failed: %d (%s)" % (e.errno, e.strerror)
sys.exit(1)


# A Mighty Daemon has been spawned. Hail Satan!
# Get pointer to "/dev/null"
if (hasattr(os, "devnull")):
REDIRECT_TO = os.devnull
else:
REDIRECT_TO = "/dev/null"

...


Revision [919]

Edited on 2008-06-02 20:27:33 by KlenwellAdmin [adds lazy sampling]
Additions:
a pythonic tribute to [[http://forums.xkcd.com/viewtopic.php?f=11&t=23249 xkcd]]: ""<code>xkcd = lambda x,k,c,d: (({k:False},d,c)[int(''.join([str(int(k in t)) for t in [c,d]]),2)])[k] or x</code>""
Deletions:
a pythonic tribute to xkcd:
# php: print x = ( isset($C[$k]) ) ? $C[$k] : ( isset($D[$k]) ? $D[$k] : 'default');
xkcd = lambda x,k,c,d: (({k:False},d,c)[int(''.join([str(int(k in t)) for t in [c,d]]),2)])[k] or x
C = {'a':1, 'b':2}
D = {'needle':'got it!', 'a':23}
C1 = D
D1 = C
X = 'default'
K = 'needle'
print xkcd(X,K,C,D)
print xkcd(X,'missing',C,D)
print xkcd(X,K,C1,D1)


Revision [918]

Edited on 2008-06-02 15:23:31 by KlenwellAdmin [adds lazy sampling]
Additions:
xkcd = lambda x,k,c,d: (({k:False},d,c)[int(''.join([str(int(k in t)) for t in [c,d]]),2)])[k] or x
Deletions:
xkcd = lambda x,k,c,d: (({k:False},d,c)[int(''.join([(str(int(k in t))) for t in [c,d]]),2)])[k] or x


Revision [917]

Edited on 2008-06-02 15:21:36 by KlenwellAdmin [adds lazy sampling]
Additions:
xkcd = lambda x,k,c,d: (({k:False},d,c)[int(''.join([(str(int(k in t))) for t in [c,d]]),2)])[k] or x
Deletions:
xkcd = lambda x,k,c,d: (({k:False},d,c)[int(''.join([str((int(k in t))) for t in [c,d]]),2)])[k] or x


Revision [916]

Edited on 2008-06-02 15:19:54 by KlenwellAdmin [adds lazy sampling]
Additions:
a pythonic tribute to xkcd:
# php: print x = ( isset($C[$k]) ) ? $C[$k] : ( isset($D[$k]) ? $D[$k] : 'default');
xkcd = lambda x,k,c,d: (({k:False},d,c)[int(''.join([str((int(k in t))) for t in [c,d]]),2)])[k] or x
C = {'a':1, 'b':2}
D = {'needle':'got it!', 'a':23}
C1 = D
D1 = C
X = 'default'
K = 'needle'
print xkcd(X,K,C,D)
print xkcd(X,'missing',C,D)
print xkcd(X,K,C1,D1)


Revision [904]

Edited on 2008-05-30 13:48:23 by KlenwellAdmin [adds lazy sampling]
Additions:
more django: [[http://www.djangoproject.com/documentation/modelforms/ modelforms]] [[http://www.djangoproject.com/documentation/newforms/#modelmultiplechoicefield forms]]


Revision [903]

Edited on 2008-05-29 12:42:49 by KlenwellAdmin [adds lazy sampling]
Additions:
rent or buy: http://www.nytimes.com/2008/05/28/business/28leonhardt.html [[http://www.nytimes.com/2007/04/10/business/2007_BUYRENT_GRAPHIC.html? calculator]]


Revision [902]

Edited on 2008-05-28 10:03:30 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://en.wikipedia.org/wiki/Pitaya dragonfruit]]


Revision [901]

Edited on 2008-05-28 08:14:50 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://code.google.com/apis/ajaxlibs/ google ajaxlibs]] ([[http://developers.slashdot.org/developers/08/05/28/144218.shtml /.]])


Revision [899]

Edited on 2008-05-28 07:46:31 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2008/05/28/dining/28flavor.html flavor-tripping]]


Revision [898]

Edited on 2008-05-28 06:58:37 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://home.netcom.com/~tjensen/ptr/ch1x.htm pointers]] (to the point)


Revision [897]

Edited on 2008-05-27 19:53:39 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.fonts500.com/?page=1 500 Fonts]] [[http://thepiratebay.org/tor/3660252/500_Fonts_from_fonts500.com all at once]]


Revision [896]

Edited on 2008-05-27 14:03:44 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://tech.slashdot.org/comments.pl?sid=565231&cid=23559299 leave it to Jesus 666]]


Revision [895]

Edited on 2008-05-27 08:27:10 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.djangoproject.com/documentation/forms/ django forms]] [[http://www.djangoproject.com/documentation/newforms/ django newforms]] [[http://code.google.com/appengine/articles/djangoforms.html django form validation]] [[http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/widgets.py django form tests (examples)]] [[http://www.djangoproject.com/documentation/form_wizard/ django forms wizard]]


Revision [894]

Edited on 2008-05-23 09:56:44 by KlenwellAdmin [adds lazy sampling]
Additions:
scripps 05.23: [[http://surfshot.s3.amazonaws.com/media/9/7/975364-large.jpg 1]] [[http://surfshot.s3.amazonaws.com/media/9/7/975363-large.jpg 2]] [[http://surfshot.s3.amazonaws.com/media/9/7/975370-large.jpg 3]]


Revision [893]

Edited on 2008-05-22 08:28:18 by KlenwellAdmin [adds lazy sampling]
Additions:
http://code.google.com/p/google-app-engine-samples/wiki/GoogleAppEngineSamples [[http://groups.google.com/group/google-appengine/browse_frm/thread/d3673d0ec7ead0e2 djangoforms]] [[http://groups.google.com/group/google-appengine/browse_frm/thread/13d1f026d46bd35f model keys]]
Deletions:
http://code.google.com/p/google-app-engine-samples/wiki/GoogleAppEngineSamples [[http://groups.google.com/group/google-appengine/browse_frm/thread/d3673d0ec7ead0e2 djangoforms]]


Revision [892]

Edited on 2008-05-22 08:25:04 by KlenwellAdmin [adds lazy sampling]
Additions:
http://code.google.com/p/google-app-engine-samples/wiki/GoogleAppEngineSamples [[http://groups.google.com/group/google-appengine/browse_frm/thread/d3673d0ec7ead0e2 djangoforms]]
Deletions:
http://code.google.com/p/google-app-engine-samples/wiki/GoogleAppEngineSamples


Revision [891]

Edited on 2008-05-22 08:22:13 by KlenwellAdmin [adds lazy sampling]
Additions:
http://code.google.com/p/google-app-engine-samples/wiki/GoogleAppEngineSamples


Revision [890]

Edited on 2008-05-21 19:34:22 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://archive.ics.uci.edu/ml/ lots of data]] (courtesy of my alma mater)


Revision [889]

Edited on 2008-05-21 08:52:28 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://highscalability.com/how-i-learned-stop-worrying-and-love-using-lot-disk-space-scale querying gapp]]


Revision [888]

Edited on 2008-05-20 21:38:09 by KlenwellAdmin [adds lazy sampling]
Additions:
http://img143.imageshack.us/img143/3660/fbooknb5.png


Revision [887]

Edited on 2008-05-20 09:04:58 by KlenwellAdmin [adds lazy sampling]
Additions:
sessions: [[http://groups.google.com/group/google-appengine/browse_frm/thread/1c459b2ca7a6e643/2311877beffe0403?lnk=gst&q=session#2311877beffe0403 datastore]] [[http://groups.google.com/group/google-appengine/browse_frm/thread/f162c186c3e68f1a/1ea824e3bebd5801?lnk=gst&q=session#1ea824e3bebd5801 class]] [[http://code.google.com/appengine/docs/python/appcaching.html appcaching]]
Deletions:
sessions: [[http://groups.google.com/group/google-appengine/browse_frm/thread/1c459b2ca7a6e643/2311877beffe0403?lnk=gst&q=session#2311877beffe0403 datastore]] [[http://groups.google.com/group/google-appengine/browse_frm/thread/f162c186c3e68f1a/1ea824e3bebd5801?lnk=gst&q=session#1ea824e3bebd5801 class]]


Revision [886]

Edited on 2008-05-20 09:00:40 by KlenwellAdmin [adds lazy sampling]
Additions:
sessions: [[http://groups.google.com/group/google-appengine/browse_frm/thread/1c459b2ca7a6e643/2311877beffe0403?lnk=gst&q=session#2311877beffe0403 datastore]] [[http://groups.google.com/group/google-appengine/browse_frm/thread/f162c186c3e68f1a/1ea824e3bebd5801?lnk=gst&q=session#1ea824e3bebd5801 class]]


Revision [885]

Edited on 2008-05-19 06:55:15 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://entertainment.slashdot.org/comments.pl?sid=556912&cid=23461200 mythbuntu]]


Revision [881]

Edited on 2008-05-18 15:56:39 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.rinkworks.com/words/collective.shtml words for groups of animals]]


Revision [868]

Edited on 2008-05-16 11:46:53 by KlenwellAdmin [adds lazy sampling]
Additions:
WordsIReallyLike


Revision [867]

Edited on 2008-05-16 07:35:07 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://kwap.appspot.com/ klenwell @ google app engine]] [[http://groups.google.com/group/google-appengine/browse_frm/thread/c9e8a906a88a8102 links to good gapp tips]]
Deletions:
[[http://kwap.appspot.com/ klenwell @ google app engine]]


Revision [866]

Edited on 2008-05-15 23:33:32 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://kwap.appspot.com/ klenwell @ google app engine]]


Revision [865]

Edited on 2008-05-13 08:21:15 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://us2.php.net/manual/en/function.debug-backtrace.php#72534 php debug]]


Revision [864]

Edited on 2008-05-13 07:02:18 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2008/05/13/world/middleeast/13girls.html?_r=1&hp=&pagewanted=all Project Alia]]


Revision [863]

Edited on 2008-05-13 06:55:30 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://entertainment.slashdot.org/entertainment/08/05/13/0316251.shtml free as in beer beer]]


Revision [862]

Edited on 2008-05-12 07:27:15 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.msnbc.msn.com/id/23359042/from/ET/ no plastic surgery!]]


Revision [861]

Edited on 2008-05-10 10:33:20 by KlenwellAdmin [adds lazy sampling]

No Differences

Revision [860]

Edited on 2008-05-10 10:21:39 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.housingmaps.com/ housingmaps.com]]


Revision [859]

Edited on 2008-05-09 08:08:45 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://code.google.com/appengine/docs/gettingstarted/ google app engine]] [[http://blog.wachob.com/2008/04/google-appengin.html scaling with gae]] [[http://perspectives.mvdirona.com/2008/04/21/GoogleApplicationEngine.aspx a review]] [[http://code.google.com/appengine/docs/python/purepython.html python in gae]] [[http://groups.google.com/group/google-appengine/browse_frm/thread/dc927ba00944027f gApp on ubuntu]] [[http://code.google.com/p/rietveld/source/browse gApp example code]]
Deletions:
[[http://code.google.com/appengine/docs/gettingstarted/ google app engine]] [[http://blog.wachob.com/2008/04/google-appengin.html scaling with gae]] [[http://perspectives.mvdirona.com/2008/04/21/GoogleApplicationEngine.aspx a review]] [[http://code.google.com/appengine/docs/python/purepython.html python in gae]] [[http://groups.google.com/group/google-appengine/browse_frm/thread/dc927ba00944027f gApp on ubuntu]]


Revision [858]

Edited on 2008-05-09 08:04:31 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://code.google.com/appengine/docs/gettingstarted/ google app engine]] [[http://blog.wachob.com/2008/04/google-appengin.html scaling with gae]] [[http://perspectives.mvdirona.com/2008/04/21/GoogleApplicationEngine.aspx a review]] [[http://code.google.com/appengine/docs/python/purepython.html python in gae]] [[http://groups.google.com/group/google-appengine/browse_frm/thread/dc927ba00944027f gApp on ubuntu]]
Deletions:
[[http://code.google.com/appengine/docs/gettingstarted/ google app engine]] [[http://blog.wachob.com/2008/04/google-appengin.html scaling with gae]] [[http://perspectives.mvdirona.com/2008/04/21/GoogleApplicationEngine.aspx a review]] [[http://code.google.com/appengine/docs/python/purepython.html python in gae]]


Revision [857]

Edited on 2008-05-09 07:48:58 by KlenwellAdmin [adds lazy sampling]
Additions:
on fonts: [[http://fontstruct.fontshop.com/ fontstruct]] [[http://www.sweeperscalendar.com/variorum/1129/ the prophecy]]


Revision [856]

Edited on 2008-05-08 12:44:04 by KlenwellAdmin [adds lazy sampling]
Additions:
stupid lambda tricks: ""<code>in_dict_list = lambda dic, k, v: v in [d[k] for d in dic]</code>""


Revision [855]

Edited on 2008-05-08 07:05:57 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2008/05/08/fashion/08PUNK.html?_r=1&oref=slogin steampunk]] ""=="" [[http://en.wikipedia.org/wiki/Tomorrowland#Tomorrowland_1998 tomorrowland 1998]]
Deletions:
[[http://www.nytimes.com/2008/05/08/fashion/08PUNK.html?_r=1&oref=slogin steampunk]] == [[http://en.wikipedia.org/wiki/Tomorrowland#Tomorrowland_1998 tomorrowland 1998]]


Revision [854]

Edited on 2008-05-08 07:05:29 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2008/05/08/fashion/08PUNK.html?_r=1&oref=slogin steampunk]] == [[http://en.wikipedia.org/wiki/Tomorrowland#Tomorrowland_1998 tomorrowland 1998]]


Revision [853]

Edited on 2008-05-07 16:07:39 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://code.google.com/appengine/docs/gettingstarted/ google app engine]] [[http://blog.wachob.com/2008/04/google-appengin.html scaling with gae]] [[http://perspectives.mvdirona.com/2008/04/21/GoogleApplicationEngine.aspx a review]] [[http://code.google.com/appengine/docs/python/purepython.html python in gae]]
Deletions:
[[http://code.google.com/appengine/docs/gettingstarted/ google app engine]] [[http://blog.wachob.com/2008/04/google-appengin.html scaling with gae]] [[http://perspectives.mvdirona.com/2008/04/21/GoogleApplicationEngine.aspx a review]]


Revision [852]

Edited on 2008-05-07 16:07:05 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://code.google.com/appengine/docs/gettingstarted/ google app engine]] [[http://blog.wachob.com/2008/04/google-appengin.html scaling with gae]] [[http://perspectives.mvdirona.com/2008/04/21/GoogleApplicationEngine.aspx a review]]


Revision [851]

Edited on 2008-05-04 14:09:37 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://aspn.activestate.com/ASPN/docs/Komodo/4.3/komodo-js-api.html komodo js api]]


Revision [850]

Edited on 2008-05-03 10:44:36 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://en.wikipedia.org/wiki/AI_Winter AI Winter]] [[http://www.nytimes.com/2008/05/03/technology/03koller.html?th&emc=th is over]]


Revision [849]

Edited on 2008-05-02 11:01:18 by KlenwellAdmin [adds lazy sampling]
Additions:
http://www.gnu.org/software/diction/ http://www.link.cs.cmu.edu/link/ [[http://alanhorkan.livejournal.com/16062.html overview]] [[http://papyr.com/hypertextbooks/grammar/gramchek.htm tests]] [[http://en.wikipedia.org/wiki/Grammar_checker wikipedia]]
Deletions:
http://www.gnu.org/software/diction/ http://www.link.cs.cmu.edu/link/ http://alanhorkan.livejournal.com/16062.html [[http://papyr.com/hypertextbooks/grammar/gramchek.htm tests]] [[http://en.wikipedia.org/wiki/Grammar_checker wikipedia]]


Revision [848]

Edited on 2008-05-02 11:00:44 by KlenwellAdmin [adds lazy sampling]
Additions:
http://www.gnu.org/software/diction/ http://www.link.cs.cmu.edu/link/ http://alanhorkan.livejournal.com/16062.html [[http://papyr.com/hypertextbooks/grammar/gramchek.htm tests]] [[http://en.wikipedia.org/wiki/Grammar_checker wikipedia]]


Revision [847]

Edited on 2008-04-30 14:06:29 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://pidgin.im/ pidgin]] (nice home page)


Revision [846]

Edited on 2008-04-30 11:49:14 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.herecomeseverybody.org/2008/04/looking-for-the-mouse.html the sitcom]] [[http://tech.slashdot.org/tech/08/04/27/1422258.shtml (./)]] | [[http://tech.slashdot.org/article.pl?sid=08/04/30/1515229 Berners-Lee on Web]]


Revision [845]

Edited on 2008-04-29 13:35:08 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.shoutcast.com/directory/index.phtml shoutcast streams]] see also [[http://lifehacker.com/384545/superior-alternatives-to-crappy-windows-software vlc]]
Deletions:
[[http://www.shoutcast.com/directory/index.phtml shoutcast streams]]


Revision [844]

Edited on 2008-04-29 12:25:46 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.shoutcast.com/directory/index.phtml shoutcast streams]]


Revision [843]

Edited on 2008-04-29 07:21:43 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://yro.slashdot.org/comments.pl?sid=537280&cid=23231314 /. life lessons: if arrested...]]


Revision [842]

Edited on 2008-04-27 19:21:35 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://politics.slashdot.org/comments.pl?sid=228403&cid=18513137 John McCain ad hominem]]


Revision [841]

Edited on 2008-04-26 14:47:23 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references HTML entities]]


Revision [840]

Edited on 2008-04-25 09:29:07 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://en.wikipedia.org/wiki/Simon-Ehrlich_wager Simon-Ehrlich Wager]] [[http://krugman.blogs.nytimes.com/2008/04/22/limits-to-growth-and-related-stuff/ Krugman]]


Revision [839]

Edited on 2008-04-24 21:28:25 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.selenic.com/pipermail/mercurial/2007-April/012921.html removing a file from a python repo without deleting]] **use hg rm -A** (e.g. hg rm -A dir/*)


Revision [838]

Edited on 2008-04-24 07:36:21 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2008/04/24/books/24garn.html?_r=1&th&emc=th&oref=slogin kleinzahler]]
Deletions:
[http://www.nytimes.com/2008/04/24/books/24garn.html?_r=1&th&emc=th&oref=slogin kleinzahler]]


Revision [837]

Edited on 2008-04-24 07:10:14 by KlenwellAdmin [adds lazy sampling]
Additions:
[http://www.nytimes.com/2008/04/24/books/24garn.html?_r=1&th&emc=th&oref=slogin kleinzahler]]


Revision [836]

Edited on 2008-04-23 15:02:26 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.ocfamily.com/t-FeatureStory_BabyNames_0408.aspx oc baby names]]


Revision [835]

Edited on 2008-04-23 11:52:00 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.activestate.com/Products/komodo_ide/komodo_edit.mhtml komodo edit]] [[http://community.activestate.com/faq/komodo-file-locations saving preference file]]


Revision [834]

Edited on 2008-04-22 07:11:58 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://code.google.com/apis/igoogle/ igoogle API]]


Revision [833]

Edited on 2008-04-21 08:21:58 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://tech.slashdot.org/article.pl?sid=08/04/16/121225&from=rss Yahoo Analytics (IndexTools)]]


Revision [832]

Edited on 2008-04-21 07:55:17 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.pseudocoder.com/archives/2007/02/27/cakephp-cache-performance/ cakephp cache benchmark]]


Revision [831]

Edited on 2008-04-21 07:35:59 by KlenwellAdmin [adds lazy sampling]
Additions:
%%(bash)
# cron.d file
# to activate, link to /etc/cron.d: ln -s <path>/fname.cron /etc/cron.d/link_name
# +---------------- minute (0 - 59)
# | +------------- hour (0 - 23)
# | | +---------- day of month (1 - 31)
# | | | +------- month (1 - 12)
# | | | | +---- day of week (0 - 6) (Sunday=0 or 7)
# | | | | |
# M H DM MO DW USER SCRIPT


Revision [830]

Edited on 2008-04-21 07:05:42 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2008/04/21/opinion/21krugman.html the commodities bubble]]


Revision [829]

Edited on 2008-04-18 07:52:27 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://tech.slashdot.org/comments.pl?sid=526820&cid=23115228 oss binary blobs]]


Revision [828]

Edited on 2008-04-16 09:16:07 by KlenwellAdmin [adds lazy sampling]
Additions:
# fork #2
Deletions:
# put another fork in it


Revision [827]

Edited on 2008-04-16 08:11:57 by KlenwellAdmin [adds lazy sampling]

No Differences

Revision [826]

Edited on 2008-04-16 08:11:44 by KlenwellAdmin [adds lazy sampling]
Additions:
emacs: [[http://www.google.com/search?q=customize+emacs+-scribd.com&hl=en&lr=&as_qdr=all&start=10&sa=N customize]] [[http://www.google.com/search?hl=en&lr=&as_qdr=all&q=+site:www.gnu.org+customize+emacs+-scribd.com manual]] [[http://www.gnu.org/software/emacs/tour/ tour]]


Revision [825]

Edited on 2008-04-16 07:13:19 by KlenwellAdmin [adds lazy sampling]
Additions:
%%(python)
...
# decapitate parent
os.chdir("/")
os.setsid()
os.umask(0)
# put another fork in it
try:
pid = os.fork()
if pid > 0:
print "pid: %d" % pid
sys.exit(0)
except OSError, e:
print >>sys.stderr, "fork #2 failed: %d (%s)" % (e.errno, e.strerror)
sys.exit(1)


# A Mighty Daemon has been spawned. Hail Satan!
# Get pointer to "/dev/null"
if (hasattr(os, "devnull")):
REDIRECT_TO = os.devnull
else:
REDIRECT_TO = "/dev/null"

...
%%


Revision [824]

Edited on 2008-04-15 08:15:44 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://w-shadow.com/blog/2008/04/12/simple-text-summarizer-in-php/ simple text summarizer]] [[http://www.symfony-project.org/askeet/1_0/21 simple search engine]]
Deletions:
[[http://w-shadow.com/blog/2008/04/12/simple-text-summarizer-in-php/ simple text summarizer]]


Revision [823]

Edited on 2008-04-15 08:11:23 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://w-shadow.com/blog/2008/04/12/simple-text-summarizer-in-php/ simple text summarizer]]


Revision [822]

Edited on 2008-04-14 11:16:20 by KlenwellAdmin [adds lazy sampling]
Additions:
ny times: [[http://www.nytimes.com/2008/04/13/business/13cash.html?th=&emc=th&pagewanted=all wall st. sleaze]] [[http://www.nytimes.com/2008/04/14/business/media/14link.html?th=&emc=th&pagewanted=all some guy who wrote a program to write 200,000 books]]
Deletions:
[[http://www.nytimes.com/2008/04/13/business/13cash.html?th=&emc=th&pagewanted=all wall st. sleaze]]


Revision [821]

Edited on 2008-04-14 08:30:15 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2008/04/13/business/13cash.html?th=&emc=th&pagewanted=all wall st. sleaze]]


Revision [820]

Edited on 2008-04-12 11:16:57 by KlenwellAdmin [adds lazy sampling]
Additions:
cakephp: [[http://book.cakephp.org/view/32/installation#advanced-installation-35 shared core setup]] [[http://bakery.cakephp.org/articles/view/maintaining-an-application-independant-code-library app-indy lib]] [[http://manual.cakephp.org/chapter/plugins plugins]]


Revision [819]

Edited on 2008-04-12 10:42:58 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://bakery.cakephp.org/ <a href="http://mushpup.org/">pw</a>: m{d/u}l11]]


Revision [818]

Edited on 2008-04-12 10:01:24 by KlenwellAdmin [adds lazy sampling]
Additions:
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP [[http://dev.mysql.com/doc/refman/4.1/en/timestamp.html mysql.com]]


Revision [817]

Edited on 2008-04-12 09:45:35 by KlenwellAdmin [adds lazy sampling]
Additions:
python encoding: [[http://mail.python.org/pipermail/python-list/2007-May/442985.html nutshell]] [[http://www.reportlab.com/i18n/python_unicode_tutorial.html unicode tutorial]]


Revision [816]

Edited on 2008-04-09 08:24:30 by KlenwellAdmin [adds lazy sampling]
Additions:
python on web: [[http://www.modpython.org/ modpython]] [[http://www.zope.org/ zope]] [[http://code.google.com/appengine/docs/gettingstarted/ google webapp]]


Revision [815]

Edited on 2008-04-08 06:54:30 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://code.google.com/appengine/docs/whatisgoogleappengine.html google app engine]]


Revision [814]

Edited on 2008-04-04 10:17:40 by KlenwellAdmin [adds lazy sampling]
Additions:
vim: [[http://www.linux.com/articles/54159 marks and jumps]]


Revision [812]

Edited on 2008-03-31 08:12:51 by KlenwellAdmin [adds lazy sampling]
Additions:
PHP PCRE Issue: [[http://us3.php.net/manual/en/ref.pcre.php#77790 cause]] [[http://www.phpinsider.com/smarty-forum/viewtopic.php?p=48604 cause]] [[http://bugs.php.net/bug.php?id=40846 bugs.php.net]] [[http://tracker.moodle.org/browse/MDL-11237?focusedCommentId=34538#action_34538 a solution]]
Deletions:
PHP PCRE Issue: [[http://us3.php.net/manual/en/ref.pcre.php#77790 cause]] [[http://www.phpinsider.com/smarty-forum/viewtopic.php?p=48604 cause]] [[http://bugs.php.net/bug.php?id=40846 solution]]


Revision [811]

Edited on 2008-03-31 08:09:51 by KlenwellAdmin [adds lazy sampling]
Additions:
PHP PCRE Issue: [[http://us3.php.net/manual/en/ref.pcre.php#77790 cause]] [[http://www.phpinsider.com/smarty-forum/viewtopic.php?p=48604 cause]] [[http://bugs.php.net/bug.php?id=40846 solution]]
Deletions:
PHP PCRE Issue: [[http://us3.php.net/manual/en/ref.pcre.php#77790 cause]] [[http://www.phpinsider.com/smarty-forum/viewtopic.php?p=48604 cause]] [[http://bugs.php.net/bug.php?id=40624 bugs.php.net]]


Revision [810]

Edited on 2008-03-31 07:35:43 by KlenwellAdmin [adds lazy sampling]
Additions:
PHP PCRE Issue: [[http://us3.php.net/manual/en/ref.pcre.php#77790 cause]] [[http://www.phpinsider.com/smarty-forum/viewtopic.php?p=48604 cause]] [[http://bugs.php.net/bug.php?id=40624 bugs.php.net]]
Deletions:
PHP PCRE Issue: [[http://www.phpinsider.com/smarty-forum/viewtopic.php?p=48604 cause]] [[http://bugs.php.net/bug.php?id=40624 bugs.php.net]]


Revision [809]

Edited on 2008-03-31 07:26:37 by KlenwellAdmin [adds lazy sampling]
Additions:
PHP PCRE Issue: [[http://www.phpinsider.com/smarty-forum/viewtopic.php?p=48604 cause]] [[http://bugs.php.net/bug.php?id=40624 bugs.php.net]]
Deletions:
PCRE Issue: [[http://www.phpinsider.com/smarty-forum/viewtopic.php?p=48604 cause]]


Revision [808]

Edited on 2008-03-31 07:24:21 by KlenwellAdmin [adds lazy sampling]
Additions:
PCRE Issue: [[http://www.phpinsider.com/smarty-forum/viewtopic.php?p=48604 cause]]


Revision [804]

Edited on 2008-03-25 11:14:43 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://en.wikipedia.org/wiki/Moby_Project Moby Project]] [[http://www.nzdl.org/ELKB/download.html Roget's]]


Revision [803]

Edited on 2008-03-23 09:51:27 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://cb.vu/unixtoolbox.xhtml unix cheat sheet]]


Revision [802]

Edited on 2008-03-18 12:09:54 by KlenwellAdmin [adds lazy sampling]
Deletions:
%%(javascript)
<script type="text/javascript">
var Rows = [
'line 1',
'line 2',
'line 3',
'line 4'
];
function cx_prow(id)
{
var P = new Element('p', { 'id': id });
return P;
}
function cx_handle(id)
{
var El = new Element('span', { 'class': 'handle' }).update('•');
return El;
}
function cx_text(ln)
{
title = 'extended output can be put here: ' + ln;
var El = new Element('span', { 'class': 'line_text', 'title': title }).update(ln);
return El;
}
function cx_hide(id)
{
cur = 'this.style.cursor="pointer";';
clik = 'javascript:alert("hide clicked for ' + id + '"); return false;';
var El = new Element('span', {'id': id, 'onmouseover': cur, 'onclick': clik }).update('hide');
return El;
}
Rows.each( function(ln, i){
id = 'smedln_' + i;
Prow = cx_prow(id);
Prow.appendChild(cx_handle(id));
Prow.appendChild(cx_text(ln));
Prow.appendChild(cx_hide(id));
$('smed').appendChild(Prow);
}
);
$('smed').childElements().each( function(Obj){
id = Obj.id;
line = Obj.select('span.line_text')[0].innerHTML;
console.log(id, line);
}
);
</script>
%%


Revision [801]

Edited on 2008-03-18 12:09:07 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.dell.com/content/products/productdetails.aspx/vostronb_1400?c=us&cs=04&l=en&s=bsd&~tab=bundlestab vostro 1400]]


Revision [800]

Edited on 2008-03-16 15:26:38 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.interest.com/content/calculators/rentvsbuy.asp rent v. buy]] [[http://www.bloomberg.com/invest/calculators/mortgage.html bloomberg mortgage calculator]]
Deletions:
[[http://www.interest.com/content/calculators/rentvsbuy.asp rent v. buy]]


Revision [799]

Edited on 2008-03-16 15:22:53 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.interest.com/content/calculators/rentvsbuy.asp rent v. buy]]


Revision [798]

Edited on 2008-03-11 08:47:06 by KlenwellAdmin [adds lazy sampling]
Additions:
var Rows = [
'line 1',
'line 2',
'line 3',
'line 4'
];
title = 'extended output can be put here: ' + ln;
var El = new Element('span', { 'class': 'line_text', 'title': title }).update(ln);
cur = 'this.style.cursor="pointer";';
clik = 'javascript:alert("hide clicked for ' + id + '"); return false;';
var El = new Element('span', {'id': id, 'onmouseover': cur, 'onclick': clik }).update('hide');
Deletions:
var Rows = ['line 1', 'line 2', 'line 3', 'line 4'];
var El = new Element('span', { 'class': 'line_text' }).update(ln);
var El = new Element('span', {'id': id, 'onclick': 'javascript:alert("hide clicked for ' + id + '"); return false;' }).update('hide');


Revision [797]

Edited on 2008-03-11 08:37:30 by KlenwellAdmin [adds lazy sampling]
Additions:
%%(javascript)
<script type="text/javascript">
var Rows = ['line 1', 'line 2', 'line 3', 'line 4'];
function cx_prow(id)
{
var P = new Element('p', { 'id': id });
return P;
}
function cx_handle(id)
{
var El = new Element('span', { 'class': 'handle' }).update('•');
return El;
}
function cx_text(ln)
{
var El = new Element('span', { 'class': 'line_text' }).update(ln);
return El;
}
function cx_hide(id)
{
var El = new Element('span', {'id': id, 'onclick': 'javascript:alert("hide clicked for ' + id + '"); return false;' }).update('hide');
return El;
}
Rows.each( function(ln, i){
id = 'smedln_' + i;
Prow = cx_prow(id);
Prow.appendChild(cx_handle(id));
Prow.appendChild(cx_text(ln));
Prow.appendChild(cx_hide(id));
$('smed').appendChild(Prow);
}
);
$('smed').childElements().each( function(Obj){
id = Obj.id;
line = Obj.select('span.line_text')[0].innerHTML;
console.log(id, line);
}
);
</script>
Deletions:
%%(python)
# imports
import sys, os
from datetime import *
class SimpleTest:

timer_last = 0

def __init__(self):
print 'initializing Simpletest'

def main(self):
print 'it is now: %s' % datetime.now()

def read_file(self, path):
try:
Fso = open(path, 'r')
content = Fso.read()
Fso.close()
content.strip()
return content
except Exception, e:
raise e

def eparse(self, content):
header, body = content.split('\n\n', 1)
print "\n\nheader:\n %s\n\nbody:\n %s" % (header, body)
return header, body

def timer(self):
now = datetime.now()
if ( self.timer_last == 0 ):
self.timer_last = now
return 0
else:
lapse = now - self.timer_last
self.timer_last = now
return lapse

if __name__ == '__main__':
Arch = SimpleTest()
Arch.timer()
fpath = 'C:\\PATHTO\\FILE.txt'
ec = Arch.read_file(fpath)
h, b = Arch.eparse(ec)
print "script time: %s" % Arch.timer()


Revision [796]

Edited on 2008-03-07 19:40:27 by KlenwellAdmin [adds lazy sampling]
Deletions:
import sha, MySQLdb
# download: http://sourceforge.net/project/showfiles.php?group_id=22307
def test():
table = ''
dbname = ''
user = 'root'
pass = 'root'
host = 'localhost'
sql = 'SELECT * FROM %s' % table
try:
Dbo = MySQLdb.connect(host, user, pass, dbname).cursor()
Dbo.execute( sql )
ROWS = Dbo.fetchall()
except Exception, e:
print 'db issue: %s' % str(e)
for each_row as ROWS:
print each_row
test()
# Test Script
# to run: $ python C:\pathto\mysql.py
import datetime
import MySQLdb
class MysqlTest:
Dbo = None
Db1 = ['db_host', 'user', 'pw', 'db_name']
test_table = 'pages'
self.connect(self.Db1)
def connect(self, Host):
self.Dbo = MySQLdb.connect(Host[0], Host[1], Host[2], Host[3])
raise e

def testSelect(self):
sql = """SELECT * FROM %s LIMIT 10""" % self.test_table
Dbc = self.Dbo.cursor()
Dbc.execute(sql)
Rows = Dbc.fetchall()
Dbc.close()
return Rows
try:
Dbo = MysqlTest()
Rows = Dbo.testSelect()
for Row in Rows:
print Row
except Exception, e:
print 'there was an error: %s' % str(e)


Revision [795]

Edited on 2008-03-05 12:43:17 by KlenwellAdmin [adds lazy sampling]
Additions:
from datetime import *
class SimpleTest:
timer_last = 0
print 'initializing Simpletest'
def main(self):
print 'it is now: %s' % datetime.now()
def read_file(self, path):
Fso = open(path, 'r')
content = Fso.read()
Fso.close()
content.strip()
return content
def eparse(self, content):
header, body = content.split('\n\n', 1)
print "\n\nheader:\n %s\n\nbody:\n %s" % (header, body)
return header, body
def timer(self):
now = datetime.now()
if ( self.timer_last == 0 ):
self.timer_last = now
return 0
else:
lapse = now - self.timer_last
self.timer_last = now
return lapse
Arch = SimpleTest()
Arch.timer()
fpath = 'C:\\PATHTO\\FILE.txt'
ec = Arch.read_file(fpath)
h, b = Arch.eparse(ec)
print "script time: %s" % Arch.timer()


Revision [794]

Edited on 2008-03-04 12:04:11 by KlenwellAdmin [adds lazy sampling]
Additions:
%%(python)
%%(python)
# Test Script
# to run: $ python C:\pathto\mysql.py
# imports
import sys, os
import datetime
import MySQLdb
class MysqlTest:
Dbo = None
Db1 = ['db_host', 'user', 'pw', 'db_name']
test_table = 'pages'
def __init__(self):
self.connect(self.Db1)
def connect(self, Host):
try:
self.Dbo = MySQLdb.connect(Host[0], Host[1], Host[2], Host[3])
except Exception, e:
raise e

def testSelect(self):
sql = """SELECT * FROM %s LIMIT 10""" % self.test_table
try:
Dbc = self.Dbo.cursor()
Dbc.execute(sql)
Rows = Dbc.fetchall()
Dbc.close()
return Rows
except Exception, e:
raise e
Dbo = MysqlTest()
Rows = Dbo.testSelect()
for Row in Rows:
print Row
print 'there was an error: %s' % str(e)


Revision [787]

Edited on 2008-03-01 09:31:06 by KlenwellAdmin [adds lazy sampling]
Additions:
[[SpecialBCAA BCAA]]


Revision [786]

Edited on 2008-02-26 15:24:55 by KlenwellAdmin [adds lazy sampling]
Additions:
%%
import sha, MySQLdb
# download: http://sourceforge.net/project/showfiles.php?group_id=22307
def test():
table = ''
dbname = ''
user = 'root'
pass = 'root'
host = 'localhost'

sql = 'SELECT * FROM %s' % table

try:
Dbo = MySQLdb.connect(host, user, pass, dbname).cursor()
Dbo.execute( sql )
ROWS = Dbo.fetchall()

except Exception, e:
print 'db issue: %s' % str(e)

for each_row as ROWS:
print each_row

if __name__ == '__main__':
test()
%%


Revision [785]

Edited on 2008-02-23 10:04:06 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://garfieldminusgarfield.tumblr.com/ Garfield - Garfield = Existential Humor]]
Deletions:
[[http://garfieldminusgarfield.tumblr.com/ Garfield - Garfield = Humor]]


Revision [784]

Edited on 2008-02-23 10:03:40 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://garfieldminusgarfield.tumblr.com/ Garfield - Garfield = Humor]]


Revision [783]

Edited on 2008-02-20 21:49:07 by KlenwellAdmin [adds lazy sampling]
Additions:
Cool Dingbats: [[http://www.bittbox.com/fonts/dingbats-roundup-16-incredibly-detailed-useful-and-free-dingbat-fonts/ bittbox.com]]


Revision [782]

Edited on 2008-02-20 21:37:12 by KlenwellAdmin [adds lazy sampling]
Deletions:
find files by size or data
%%(bash)
# basic (source: http://www.howtogeek.com/howto/ubuntu/delete-files-older-than-x-days-on-linux/)
$ find /path/to/files* -mtime +5 -ls
# delete
$ find /path/to/files* -mtime +5 -exec rm {} \;
# files only (http://www.unix.com/shell-programming-scripting/32816-need-remove-files-older-than-30-days-except-directories.html)
$ find /path/to/files -type f -mtime +90 -exec rm {} \;
# dirs only (http://lowfatlinux.com/linux-find.html)
$ find /path/to/files -type d -ok rmdir {} \;
# find files by size (http://lowfatlinux.com/linux-find.html)
$ find /path/to/files -size +100k -ls
# find files older than 8 hours (http://www.unix.com/shell-programming-scripting/32816-need-remove-files-older-than-30-days-except-directories.html)
$ touch -t `date --date='12 hours ago' +%Y%m%d%H%M` time_marker
$ find . -type f -newer time_marker -ls
# find files by size and age
$ find /path/to/files -type f -mtime +1 -size +5k -ls
# remove files older than 4 hours and larger than 5 kb
$ touch -t `date --date='4 hours ago' +%Y%m%d%H%M` time_marker
$ find /path/to/files -type f -newer time_marker -ls
%%
Scratchpad
%%
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>javascript canvas</title>
<!-- JS: timer -->
<script type="text/javascript">
var tx0 = new Date();
function jstx() { return ( ( new Date() ) - tx0 ) / 1000; }
function l() { if (eval('typeof(console)=="undefined"')) return; var arg=arguments, msg=''; for(i=0; i<arg.length; i++) { msg+=arg[i]+' '; } console.log('[log]', msg); }
function p(message) { document.write(message); }
</script>
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="formState.js"></script>
<!-- JS: dev -->
<script type="text/javascript">
</script>
<!-- External Script -->
<!-- JS: dev -->
<script type="text/javascript">
var EditorApp = Class.create({

version : '0.1',
pre : 'ned_',
c : ' : ',

initialize: function(textarea_id)
{
this.id = this.pre + 'parent_' + textarea_id; // obj id
this.fid = this.id + '_undoable'; // form id
this.tid = textarea_id;
this.class = this.pre + 'block';
this.T = $(this.tid);
this.metabar = {};
this._update_dom();
this._add_observers();
},


_update_dom: function()
{
// get textarea parent and grandparent
this.Tp = this.T.getOffsetParent(this.T);

// create a parent dom element and form append textarea
this.E = new Element('div', { 'id': this.id, 'class': this.class });
this.F = new Element('form', { 'id': this.fid });
this.F.appendChild(this.T);
this.E.appendChild(this.F);
this.Tp.appendChild(this.E);

// append toolbar
this.addToolbar();
this.E.appendChild(this.toolbar);

// get dom obj
l(this.id, ' EditorApp created');
},


_add_observers: function()
{
// buffer
this.T.Buffer = new TextBuffer(20);

// add event listener
new Form.Element.Observer(
this.T.id,
2, // seconds
function(el, value){
el.Buffer.update(value);
}
)
this.T.observe('change', function(event)
{
l('observing changes on', this.T.id, 'for buffer');
El = Event.element(event);

});
},

addToolbar: function()
{
l('building toolbar');
BX = [];
// array: [0]id, [1]label, [2]target id, [3]callback
BX[0] = [this.pre + 'bold', '<b>', this.T.id, this.emboldenText];
BX[1] = [this.pre + 'ital', '<i>', this.T.id, this.testEvent];
BX[2] = [this.pre + 'undo', 'undo', this.T.id, this.undoEvent];

this.toolbar = new Element('div', { 'id': this.pre + 'toolbar' });
for ( var n=0; n<BX.length; n++ )
{
var new_bx = this.cxButton(BX[n][0], BX[n][1], BX[n][2], BX[n][3]);
this.toolbar.appendChild(new_bx);
}
},

cxButton: function(id, label, target, onclick_callback)
{
l('cxButton:',id,'|',label,'|',target);
Bx = new ToolButton(id, label, target, onclick_callback);
return Bx.E;
},

emboldenText: function(event)
{
el = Event.element(event); // element
t = $(el.target); // target
v = t.value; // target value
ins = ''; // insert
nv = v; // new value

ST = EditorApp.getSelectedText(t);
if ( ST[0] != false ) ins = '<strong>' + ST[0] + '</strong>';
nv = v.substring(0, ST[1]) + ins + v.substr(ST[2]);
t.value = nv;
l('event',event,': calling emboldenText on',t,'| insert: "',ins,'"');

EditorApp.selectRange($(t), ST[1] + ins.length, ST[1] + ins.length);
},

testEvent: function(event)
{
s = ' | ';
el = Event.element(event);
l('testEvent:','event=',event,s,'calling element=',el,s,'target=',el.target);
}

});
/*
returns an array holding:
[0]: selected text
[1]: start pos
[2]: end pos
*/
EditorApp.getSelectedText = function(el)
{
l("getting selected text from " + el.id + " : " + el.toString());
selected = [false, 0, 0];

// get start/end
var s1 = 0; var s2 = 0;
if ( typeof document.selection != 'undefined' )
{
var r = document.selection.createRange();
s1 = r.start;
s2 = r.end;
}
else if ( typeof el.selectionStart != 'undefined' )
{
s1 = el.selectionStart;
s2 = el.selectionEnd;
}
else
{
l('getSelectedText handle not found');
return selected;
}
while ( s2 > s1 && el.value.charAt(s2-1) == ' ' )
{
s2--;
}

l('selecting',s1,',',s2,'in',el.id);
if ( s2 - s1 < 1 ) return selected;

sel_text = el.value.substring(s1, s2);
l('selected text:', sel_text);
return [sel_text, s1, s2];
}
EditorApp.selectRange = function(el, p1, p2)
{
if(el.setSelectionRange)
{
el.focus();
el.setSelectionRange(p1,p2);
}
else if(el.createTextRange)
{
range=el.createTextRange();
range.collapse(true);
range.moveEnd('character',p2);
range.moveStart('character',p1);
range.select();
}
}
/*
Each button is an object and should have an action and a target. The target
is another object (or the button itself) upon which the action acts. The
action is a callback function which is called when button is clicked.
*/
var ToolButton = Class.create({

initialize: function(id, label, target_id, click_callback)
{
l('constructing ToolButton: ' + id);

// create button element (as a)
AttList = { 'id': id, 'onmouseover': 'javascript:this.style.cursor="pointer";' };
this.E = new Element('a', AttList).update(label);

// add attributes
this.E.id = id;
this.E.label = label;
this.E.target = target_id;
this.E.action = click_callback;
// add event listener
this.E.observe('click', function(event)
{
calling_el = Event.element(event);
click_callback(event);
$(calling_el.target).focus();
});
}
});
var TextBuffer = Class.create({

initialize: function(target_id, maxlen)
{
this.id = target_id;
this.maxlen = ( maxlen != undefined ) ? maxlen : 20;
this.E = $(target_id);
this.BUFFER = [];
this.ptr = -1;
},


// update buffer (alias of push)
update: function(textarea_value)
{
this.push(textarea_value);
},

// push buffer
push: function(str)
{
var buf_len = this.BUFFER.push(str);
var overflow = buf_len - this.maxlen;
while ( overflow > 0 )
{
overflow--;
this.BUFFER.shift();
buf_len--;
}
this.ptr = this.BUFFER.length - 1;
l("pushing '", str, "' on buffer and setting ptr to", this.ptr);
},

// undo buffer
undo: function()
{
this.ptr--;
if ( this.ptr < 0 ) this.ptr = 0;
var content = this.BUFFER[this.ptr];
l('undo: returning content "', content, "' at ptr", this.ptr);
return content;
},

// redo buffer
redo: function()
{
this.ptr++;
if ( this.ptr >= this.BUFFER.length ) this.ptr = this.BUFFER.length - 1;
var content = this.BUFFER[this.ptr];
l('redo: returning content "', content, "' at ptr", this.ptr);
return content;
}
});
/*
*/
var DomHandler = Class.create({

initialize: function()
{
l('constructing DomHandler ' + id);
}
});
</script>
<!-- External Script -->
<style type="text/css">
body { margin:0; padding:0; font-family:sans-serif; color:#ccf; }
h1 { margin:0 0 10px; padding:1em; border-bottom:1px solid #ccf; background: #f3f3ff; }
#footer {
clear:both; margin-top:12px; padding:4px; font: 11px verdana,sans-serif; border:1px solid #ccf; border-width:1px 0; background: #f3f3ff; text-align:center;
}
/* Editor */
.ned_block { width:300px; margin:0 auto; border:1px solid #ccc; }
.ned_block form, .ned_block textarea { margin:0; }
.ned_block textarea { width:300px; overflow-x:auto; margin:0; }
#ned_toolbar { text-align:center; margin:0; padding:3px; background:#f6f6f6; }
#ned_toolbar a { margin:0px 6px; }
#ned_toolbar a:hover { margin:0px 6px; color:#66d; }
</style>
</head>
<body>
<h1 id="page_title">prototyper</h1>
<div id="canvas">
<textarea id="proto" rows="10" cols="40">this is a textarea in the new prototype js html editor. Enjoy!</textarea>
</div>
<script type="text/javascript">var Editor = new EditorApp('proto');</script>
<!-- Footer -->
<script type="text/javascript">p('<div id="footer">js timer: ' + jstx() + ' s</div>'); l('script complete');</script>
</body>
</html>
%%
cron test
%%(bash)
#!/bin/bash
# Simple bash script to test cron
# COMMAND: $ ~/cron/test.sh
# CRON.D: * * * * 1-5 tatwell ~/cron/test.sh >> ~/cron/test_result.txt 2&>1
#Test Commands
TEST_DATE="date -R"
TEST_PHP="php -v"
TEST_PHP5="php5 -v"
TEST_LYNX="lynx -version"
TEST_WGET="wget -v"
TEST_FIND="find --version"
TEST_TOUCH="touch --version"
#Other Settings
HR="\n----------------------------\n"
echo -e "\n\n** Starting Cron Test **\n"
echo -e "DATE:\n"
$TEST_DATE
echo -e $HR
# Php Tests
echo -e "PHP:\n"
$TEST_PHP
echo -e $HR
echo -e "PHP5:\n"
$TEST_PHP5
echo -e $HR
echo -e "FIND:\n"
$TEST_FIND
echo -e $HR
echo -e "TOUCH:\n"
$TEST_TOUCH
echo -e $HR
echo -e "LYNX:\n"
$TEST_LYNX
echo -e $HR
echo -e "WGET:\n"
$TEST_WGET -V
echo -e "\n** Cron Test Complete **\n\n"
%%


Revision [780]

Edited on 2008-02-20 09:05:17 by KlenwellAdmin [adds lazy sampling]
Additions:
find files by size or data
Deletions:
===find files by size or data===


Revision [779]

Edited on 2008-02-20 09:04:56 by KlenwellAdmin [adds lazy sampling]
Additions:
===find files by size or data===
# basic (source: http://www.howtogeek.com/howto/ubuntu/delete-files-older-than-x-days-on-linux/)
$ find /path/to/files* -mtime +5 -ls
# delete
$ find /path/to/files* -mtime +5 -exec rm {} \;
# files only (http://www.unix.com/shell-programming-scripting/32816-need-remove-files-older-than-30-days-except-directories.html)
$ find /path/to/files -type f -mtime +90 -exec rm {} \;
# dirs only (http://lowfatlinux.com/linux-find.html)
$ find /path/to/files -type d -ok rmdir {} \;
# find files by size (http://lowfatlinux.com/linux-find.html)
$ find /path/to/files -size +100k -ls
# find files older than 8 hours (http://www.unix.com/shell-programming-scripting/32816-need-remove-files-older-than-30-days-except-directories.html)
$ touch -t `date --date='12 hours ago' +%Y%m%d%H%M` time_marker
$ find . -type f -newer time_marker -ls
# find files by size and age
$ find /path/to/files -type f -mtime +1 -size +5k -ls
# remove files older than 4 hours and larger than 5 kb
$ touch -t `date --date='4 hours ago' +%Y%m%d%H%M` time_marker
$ find /path/to/files -type f -newer time_marker -ls


Revision [778]

Edited on 2008-02-20 09:03:32 by KlenwellAdmin [adds lazy sampling]
Additions:
TEST_FIND="find --version"
TEST_TOUCH="touch --version"
echo -e "FIND:\n"
$TEST_FIND
echo -e "TOUCH:\n"
$TEST_TOUCH


Revision [777]

Edited on 2008-02-19 11:03:58 by KlenwellAdmin [adds lazy sampling]
Additions:
cron test
%%(bash)
#!/bin/bash
# Simple bash script to test cron
# COMMAND: $ ~/cron/test.sh
# CRON.D: * * * * 1-5 tatwell ~/cron/test.sh >> ~/cron/test_result.txt 2&>1
#Test Commands
TEST_DATE="date -R"
TEST_PHP="php -v"
TEST_PHP5="php5 -v"
TEST_LYNX="lynx -version"
TEST_WGET="wget -v"
#Other Settings
HR="\n----------------------------\n"
echo -e "\n\n** Starting Cron Test **\n"
echo -e "DATE:\n"
$TEST_DATE
echo -e $HR
# Php Tests
echo -e "PHP:\n"
$TEST_PHP
echo -e $HR
echo -e "PHP5:\n"
$TEST_PHP5
echo -e $HR
echo -e "LYNX:\n"
$TEST_LYNX
echo -e $HR
echo -e "WGET:\n"
$TEST_WGET -V
echo -e "\n** Cron Test Complete **\n\n"


Revision [776]

Edited on 2008-02-15 15:54:33 by KlenwellAdmin [adds lazy sampling]
Additions:
Scratchpad
%%
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>javascript canvas</title>
<!-- JS: timer -->
<script type="text/javascript">
var tx0 = new Date();
function jstx() { return ( ( new Date() ) - tx0 ) / 1000; }
function l() { if (eval('typeof(console)=="undefined"')) return; var arg=arguments, msg=''; for(i=0; i<arg.length; i++) { msg+=arg[i]+' '; } console.log('[log]', msg); }
function p(message) { document.write(message); }
</script>
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="formState.js"></script>
<!-- JS: dev -->
<script type="text/javascript">
</script>
<!-- External Script -->
<!-- JS: dev -->
<script type="text/javascript">
var EditorApp = Class.create({

version : '0.1',
pre : 'ned_',
c : ' : ',

initialize: function(textarea_id)
{
this.id = this.pre + 'parent_' + textarea_id; // obj id
this.fid = this.id + '_undoable'; // form id
this.tid = textarea_id;
this.class = this.pre + 'block';
this.T = $(this.tid);
this.metabar = {};
this._update_dom();
this._add_observers();
},


_update_dom: function()
{
// get textarea parent and grandparent
this.Tp = this.T.getOffsetParent(this.T);

// create a parent dom element and form append textarea
this.E = new Element('div', { 'id': this.id, 'class': this.class });
this.F = new Element('form', { 'id': this.fid });
this.F.appendChild(this.T);
this.E.appendChild(this.F);
this.Tp.appendChild(this.E);

// append toolbar
this.addToolbar();
this.E.appendChild(this.toolbar);

// get dom obj
l(this.id, ' EditorApp created');
},


_add_observers: function()
{
// buffer
this.T.Buffer = new TextBuffer(20);

// add event listener
new Form.Element.Observer(
this.T.id,
2, // seconds
function(el, value){
el.Buffer.update(value);
}
)
this.T.observe('change', function(event)
{
l('observing changes on', this.T.id, 'for buffer');
El = Event.element(event);

});
},

addToolbar: function()
{
l('building toolbar');
BX = [];
// array: [0]id, [1]label, [2]target id, [3]callback
BX[0] = [this.pre + 'bold', '<b>', this.T.id, this.emboldenText];
BX[1] = [this.pre + 'ital', '<i>', this.T.id, this.testEvent];
BX[2] = [this.pre + 'undo', 'undo', this.T.id, this.undoEvent];

this.toolbar = new Element('div', { 'id': this.pre + 'toolbar' });
for ( var n=0; n<BX.length; n++ )
{
var new_bx = this.cxButton(BX[n][0], BX[n][1], BX[n][2], BX[n][3]);
this.toolbar.appendChild(new_bx);
}
},

cxButton: function(id, label, target, onclick_callback)
{
l('cxButton:',id,'|',label,'|',target);
Bx = new ToolButton(id, label, target, onclick_callback);
return Bx.E;
},

emboldenText: function(event)
{
el = Event.element(event); // element
t = $(el.target); // target
v = t.value; // target value
ins = ''; // insert
nv = v; // new value

ST = EditorApp.getSelectedText(t);
if ( ST[0] != false ) ins = '<strong>' + ST[0] + '</strong>';
nv = v.substring(0, ST[1]) + ins + v.substr(ST[2]);
t.value = nv;
l('event',event,': calling emboldenText on',t,'| insert: "',ins,'"');

EditorApp.selectRange($(t), ST[1] + ins.length, ST[1] + ins.length);
},

testEvent: function(event)
{
s = ' | ';
el = Event.element(event);
l('testEvent:','event=',event,s,'calling element=',el,s,'target=',el.target);
}

});
/*
returns an array holding:
[0]: selected text
[1]: start pos
[2]: end pos
*/
EditorApp.getSelectedText = function(el)
{
l("getting selected text from " + el.id + " : " + el.toString());
selected = [false, 0, 0];

// get start/end
var s1 = 0; var s2 = 0;
if ( typeof document.selection != 'undefined' )
{
var r = document.selection.createRange();
s1 = r.start;
s2 = r.end;
}
else if ( typeof el.selectionStart != 'undefined' )
{
s1 = el.selectionStart;
s2 = el.selectionEnd;
}
else
{
l('getSelectedText handle not found');
return selected;
}
while ( s2 > s1 && el.value.charAt(s2-1) == ' ' )
{
s2--;
}

l('selecting',s1,',',s2,'in',el.id);
if ( s2 - s1 < 1 ) return selected;

sel_text = el.value.substring(s1, s2);
l('selected text:', sel_text);
return [sel_text, s1, s2];
}
EditorApp.selectRange = function(el, p1, p2)
{
if(el.setSelectionRange)
{
el.focus();
el.setSelectionRange(p1,p2);
}
else if(el.createTextRange)
{
range=el.createTextRange();
range.collapse(true);
range.moveEnd('character',p2);
range.moveStart('character',p1);
range.select();
}
}
/*
Each button is an object and should have an action and a target. The target
is another object (or the button itself) upon which the action acts. The
action is a callback function which is called when button is clicked.
*/
var ToolButton = Class.create({

initialize: function(id, label, target_id, click_callback)
{
l('constructing ToolButton: ' + id);

// create button element (as a)
AttList = { 'id': id, 'onmouseover': 'javascript:this.style.cursor="pointer";' };
this.E = new Element('a', AttList).update(label);

// add attributes
this.E.id = id;
this.E.label = label;
this.E.target = target_id;
this.E.action = click_callback;
// add event listener
this.E.observe('click', function(event)
{
calling_el = Event.element(event);
click_callback(event);
$(calling_el.target).focus();
});
}
});
var TextBuffer = Class.create({

initialize: function(target_id, maxlen)
{
this.id = target_id;
this.maxlen = ( maxlen != undefined ) ? maxlen : 20;
this.E = $(target_id);
this.BUFFER = [];
this.ptr = -1;
},


// update buffer (alias of push)
update: function(textarea_value)
{
this.push(textarea_value);
},

// push buffer
push: function(str)
{
var buf_len = this.BUFFER.push(str);
var overflow = buf_len - this.maxlen;
while ( overflow > 0 )
{
overflow--;
this.BUFFER.shift();
buf_len--;
}
this.ptr = this.BUFFER.length - 1;
l("pushing '", str, "' on buffer and setting ptr to", this.ptr);
},

// undo buffer
undo: function()
{
this.ptr--;
if ( this.ptr < 0 ) this.ptr = 0;
var content = this.BUFFER[this.ptr];
l('undo: returning content "', content, "' at ptr", this.ptr);
return content;
},

// redo buffer
redo: function()
{
this.ptr++;
if ( this.ptr >= this.BUFFER.length ) this.ptr = this.BUFFER.length - 1;
var content = this.BUFFER[this.ptr];
l('redo: returning content "', content, "' at ptr", this.ptr);
return content;
}
});
/*
*/
var DomHandler = Class.create({

initialize: function()
{
l('constructing DomHandler ' + id);
}
});
</script>
<!-- External Script -->
<style type="text/css">
body { margin:0; padding:0; font-family:sans-serif; color:#ccf; }
h1 { margin:0 0 10px; padding:1em; border-bottom:1px solid #ccf; background: #f3f3ff; }
#footer {
clear:both; margin-top:12px; padding:4px; font: 11px verdana,sans-serif; border:1px solid #ccf; border-width:1px 0; background: #f3f3ff; text-align:center;
}
/* Editor */
.ned_block { width:300px; margin:0 auto; border:1px solid #ccc; }
.ned_block form, .ned_block textarea { margin:0; }
.ned_block textarea { width:300px; overflow-x:auto; margin:0; }
#ned_toolbar { text-align:center; margin:0; padding:3px; background:#f6f6f6; }
#ned_toolbar a { margin:0px 6px; }
#ned_toolbar a:hover { margin:0px 6px; color:#66d; }
</style>
</head>
<body>
<h1 id="page_title">prototyper</h1>
<div id="canvas">
<textarea id="proto" rows="10" cols="40">this is a textarea in the new prototype js html editor. Enjoy!</textarea>
</div>
<script type="text/javascript">var Editor = new EditorApp('proto');</script>
<!-- Footer -->
<script type="text/javascript">p('<div id="footer">js timer: ' + jstx() + ' s</div>'); l('script complete');</script>
</body>
</html>
%%


Revision [771]

Edited on 2008-01-10 10:15:44 by KlenwellAdmin [adds lazy sampling]
Additions:
Tivo for Radio: [[http://www.handcoding.com/archives/2005/03/20/ripping-npr-to-mp3-for-an-ipod/ excellent tutorial]] [[http://streamripper.sourceforge.net/ streamripper]] (windows or linux)


Revision [770]

Edited on 2008-01-09 21:56:08 by KlenwellAdmin [adds lazy sampling]
Additions:
OS Flash Dev: [[http://www.mtasc.org/ MTASC]] [[http://www.flashdevelop.org/community/viewtopic.php?t=305 flashdevelop.org]] [[http://fgpwiki.corewatch.net/index.php/How_do_I_get_Started game dev]]
Deletions:
OS Flash Dev: [[http://www.mtasc.org/ MTASC]] [[http://fgpwiki.corewatch.net/index.php/How_do_I_get_Started game dev]]


Revision [769]

Edited on 2008-01-09 20:56:49 by KlenwellAdmin [adds lazy sampling]
Additions:
OS Flash Dev: [[http://www.mtasc.org/ MTASC]] [[http://fgpwiki.corewatch.net/index.php/How_do_I_get_Started game dev]]
Deletions:
OS Flash Dev: [[http://www.mtasc.org/ MTASC]]


Revision [768]

Edited on 2008-01-09 14:21:06 by KlenwellAdmin [adds lazy sampling]
Additions:
OS Flash Dev: [[http://www.mtasc.org/ MTASC]]
Deletions:
OS Flash Dev: [[MTASC http://www.mtasc.org/]]


Revision [767]

Edited on 2008-01-09 14:20:55 by KlenwellAdmin [adds lazy sampling]
Additions:
OS Flash Dev: [[MTASC http://www.mtasc.org/]]


Revision [766]

Edited on 2008-01-09 10:14:11 by KlenwellAdmin [adds lazy sampling]
Additions:
""CakePhp"" config: [[http://www.virtualapplicationserver.com/CakePHP_MultipleInstallNotes.html multiple apps on single site]] [[http://bakery.cakephp.org/articles/view/hosting-admin-urls-on-a-subdomain admin subdomain]]


Revision [765]

Edited on 2008-01-07 08:27:26 by KlenwellAdmin [adds lazy sampling]
Additions:
SSL on Debian ""Apache2"": [[http://ilovett.com/blog/projects/installing-ssl-on-debian-apache2 ilovett.com]] [[http://www.debian-administration.org/articles/349 debian-administration.org]]
Deletions:
SSL on Debian ""Apache2"": [[http://ilovett.com/blog/projects/installing-ssl-on-debian-apache2 ilovett.com]]


Revision [764]

Edited on 2008-01-07 08:26:18 by KlenwellAdmin [adds lazy sampling]
Additions:
SSL on Debian ""Apache2"": [[http://ilovett.com/blog/projects/installing-ssl-on-debian-apache2 ilovett.com]]
Deletions:
SSL on Debian Apache2: [[http://ilovett.com/blog/projects/installing-ssl-on-debian-apache2 ilovett.com]]


Revision [763]

Edited on 2008-01-07 08:26:07 by KlenwellAdmin [adds lazy sampling]
Additions:
SSL on Debian Apache2: [[http://ilovett.com/blog/projects/installing-ssl-on-debian-apache2 ilovett.com]]


Revision [762]

Edited on 2008-01-06 17:47:03 by KlenwellAdmin [adds lazy sampling]
Additions:
Fun with apache logs: [[http://russell.dyerhouse.com/cgi-bin/article.cgi?article_id=82 set-up]] [[http://www.builderau.com.au/program/unix/soa/Managing-and-parsing-your-Apache-logs/0,339024638,320280756,00.htm parsing]] [[http://crazytoon.com/2007/05/31/apache-how-do-you-set-up-log-rotation-and-archiving-for-apache-logs/ archiving logs]] [[http://www.eos.ncsu.edu/remoteaccess/man/scp.html scp man]]
Deletions:
[[http://crazytoon.com/2007/05/31/apache-how-do-you-set-up-log-rotation-and-archiving-for-apache-logs/ archiving logs]] [[http://www.eos.ncsu.edu/remoteaccess/man/scp.html scp man]]


Revision [760]

Edited on 2008-01-06 17:46:19 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://crazytoon.com/2007/05/31/apache-how-do-you-set-up-log-rotation-and-archiving-for-apache-logs/ archiving logs]] [[http://www.eos.ncsu.edu/remoteaccess/man/scp.html scp man]]
Deletions:
ApacheModRewriteTestOk
Fun with apache logs: [[http://russell.dyerhouse.com/cgi-bin/article.cgi?article_id=82 set-up]] [[http://www.builderau.com.au/program/unix/soa/Managing-and-parsing-your-Apache-logs/0,339024638,320280756,00.htm parsing]] [[http://crazytoon.com/2007/05/31/apache-how-do-you-set-up-log-rotation-and-archiving-for-apache-logs/ archiving logs]] [[http://www.eos.ncsu.edu/remoteaccess/man/scp.html scp man]]
Linux on an old laptop: [[http://www.desktoplinux.com/articles/AT6185716632.html desktoplinux.com]] [[http://www.linuxforums.org/desktop/a_linux_distribution_for_an_old_laptop.html linuxforums.com]] [[http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/install-pre.html freebsd.org]]
[[CategoryCygwin7zip Using 7zip from command line on cygwin]]
Bulwer-Lytton Bad Fiction Contest: [[http://www.bulwer-lytton.com/#The%20rules rules]] [[http://www.bulwer-lytton.com/ home]]
musical grab bag: [[http://www.youtube.com/watch?v=-JQnn1a3CXE Justice with Uffie]] [[http://www.myspace.com/thetingtings Ting Tings]]
[[http://www.smashingmagazine.com/2007/11/08/40-excellent-freefonts-for-professional-design/ nice free fonts]]
vbs scripts: [[http://www.visualbasicscript.com/m_27365/tm.htm AD queries]] [[http://www.rlmueller.net/PingComputers.htm pinging computers]]
php server optimizaton: [[http://discuss.joelonsoftware.com/default.asp?joel.3.550939.7 joelonsoftware forums]] [[http://hudzilla.org/phpwiki/index.php?title=Performance hudzilla.org]]


Revision [759]

Edited on 2008-01-06 17:45:37 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://slashdot.org/article.pl?sid=08/01/06/1731247 Goodbye Cruel Word]]: Hello, [[http://www.lyx.org/ lyx]]!
Deletions:
[[http://www.lyx.org/ lyx]]


Revision [758]

Edited on 2008-01-06 17:45:12 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.lyx.org/ lyx]]


Revision [757]

Edited on 2008-01-03 09:19:25 by KlenwellAdmin [adds lazy sampling]
Additions:
Fun with apache logs: [[http://russell.dyerhouse.com/cgi-bin/article.cgi?article_id=82 set-up]] [[http://www.builderau.com.au/program/unix/soa/Managing-and-parsing-your-Apache-logs/0,339024638,320280756,00.htm parsing]] [[http://crazytoon.com/2007/05/31/apache-how-do-you-set-up-log-rotation-and-archiving-for-apache-logs/ archiving logs]] [[http://www.eos.ncsu.edu/remoteaccess/man/scp.html scp man]]
Deletions:
Fun with apache logs: [[http://russell.dyerhouse.com/cgi-bin/article.cgi?article_id=82 set-up]] [[http://www.builderau.com.au/program/unix/soa/Managing-and-parsing-your-Apache-logs/0,339024638,320280756,00.htm parsing]] [[http://crazytoon.com/2007/05/31/apache-how-do-you-set-up-log-rotation-and-archiving-for-apache-logs/ archiving logs]]
[[http://www.eos.ncsu.edu/remoteaccess/man/scp.html scp man]]


Revision [756]

Edited on 2008-01-03 09:19:08 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.eos.ncsu.edu/remoteaccess/man/scp.html scp man]]


Revision [752]

Edited on 2007-12-30 19:06:40 by KlenwellAdmin [adds lazy sampling]
Additions:
ApacheModRewriteTestOk


Revision [751]

Edited on 2007-12-14 08:21:47 by KlenwellAdmin [adds lazy sampling]
Additions:
Fun with apache logs: [[http://russell.dyerhouse.com/cgi-bin/article.cgi?article_id=82 set-up]] [[http://www.builderau.com.au/program/unix/soa/Managing-and-parsing-your-Apache-logs/0,339024638,320280756,00.htm parsing]] [[http://crazytoon.com/2007/05/31/apache-how-do-you-set-up-log-rotation-and-archiving-for-apache-logs/ archiving logs]]
Deletions:
Fun with apache logs: [[http://russell.dyerhouse.com/cgi-bin/article.cgi?article_id=82 set-up]] [[http://www.builderau.com.au/program/unix/soa/Managing-and-parsing-your-Apache-logs/0,339024638,320280756,00.htm parsing]]


Revision [750]

Edited on 2007-12-14 07:54:37 by KlenwellAdmin [adds lazy sampling]
Additions:
Fun with apache logs: [[http://russell.dyerhouse.com/cgi-bin/article.cgi?article_id=82 set-up]] [[http://www.builderau.com.au/program/unix/soa/Managing-and-parsing-your-Apache-logs/0,339024638,320280756,00.htm parsing]]


Revision [749]

Edited on 2007-12-13 10:58:26 by KlenwellAdmin [adds lazy sampling]
Additions:
Linux on an old laptop: [[http://www.desktoplinux.com/articles/AT6185716632.html desktoplinux.com]] [[http://www.linuxforums.org/desktop/a_linux_distribution_for_an_old_laptop.html linuxforums.com]] [[http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/install-pre.html freebsd.org]]
Deletions:
Linux on an old laptop: [[http://www.desktoplinux.com/articles/AT6185716632.html desktoplinux.com]] [[http://www.linuxforums.org/desktop/a_linux_distribution_for_an_old_laptop.html linuxforums.com]]


Revision [748]

Edited on 2007-12-13 09:27:25 by KlenwellAdmin [adds lazy sampling]
Additions:
Linux on an old laptop: [[http://www.desktoplinux.com/articles/AT6185716632.html desktoplinux.com]] [[http://www.linuxforums.org/desktop/a_linux_distribution_for_an_old_laptop.html linuxforums.com]]


Revision [746]

Edited on 2007-12-08 15:38:13 by KlenwellAdmin [adds lazy sampling]
Additions:
[[CategoryCygwin7zip Using 7zip from command line on cygwin]]


Revision [745]

Edited on 2007-12-02 19:23:33 by KlenwellAdmin [adds lazy sampling]
Additions:
Bulwer-Lytton Bad Fiction Contest: [[http://www.bulwer-lytton.com/#The%20rules rules]] [[http://www.bulwer-lytton.com/ home]]


Revision [743]

Edited on 2007-11-30 22:16:36 by KlenwellAdmin [adds lazy sampling]
Additions:
[[CocktailNapkin2007 2007 Cocktail Napkin]]
Deletions:
406 error? http://urbangiraffe.com/2005/08/20/mysterious-406-error/
[[http://it.slashdot.org/article.pl?sid=07/10/05/1234217&threshold=3 slashdot again on linux security]]
[[http://kwimgs.googlepages.com/ klenwell image site at pages.google]]
email trigger php: [[http://groups.google.com/group/comp.lang.php/browse_frm/thread/bfd6d0781d98a1c4/5d20f271cde37e56?lnk=st&q=Then+reload+service.+Please+note+somePHPfunctions.php&rnum=1#5d20f271cde37e56 gg]] [[http://www.google.com/search?hl=en&q=email+trigger+php+script&btnG=Google+Search google search]] [[http://www.mail-archive.com/php-general@lists.php.net/msg183184.html troubleshooting]]
[[http://www.freefavicon.com/freefavicons/objects/index.php favicons]]
free oss: [[http://www.theopencd.org/programs opencd.org]]
[[http://ask.slashdot.org/comments.pl?sid=236077&threshold=1&commentsort=0&mode=thread&pid=19268133#19268179 free pdf printers]] [[http://sourceforge.net/projects/pdfcreator/ pdfcreator]] (my pick)
[[http://www.phpunit.de/pocket_guide/index.en.php PHPUnit guide]]
[[https://help.ubuntu.com/community/CronHowto ubuntu cron]] [[http://ubuntuforums.org/archive/index.php/t-106270.html more info]] [[http://www.unixgeeks.org/security/newbie/unix/cron-1.html cron docs]]
[[http://developers.facebook.com/documentation.php facebook api documentation]] [[http://www.whenpenguinsattack.com/2006/10/05/how-to-use-the-facebook-api/ quick php tutorial]]
[[http://www.webhostingtalk.com/showthread.php?t=444824&highlight=document+root+linux+where Apache 2, SSL, and Virtual Hosts]]
[[http://it.slashdot.org/comments.pl?sid=276599&cid=20345963 linux forensics]] (slashdot.org)
[[http://flurdy.com/docs/postfix/ ubuntu mailserver]] (flurdy.com)
[[http://www.php.net/manual/en/function.setcookie.php#74401 cookie code]]
[[http://snook.ca/archives/html_and_css/six_keys_to_understanding_css_layouts/ 6 css layout keys]] [[http://www.alistapart.com/articles/sprites/ css sprites]]
[[http://developers.slashdot.org/comments.pl?sid=266713&cid=20187933 jungle disk]]
[[http://it.slashdot.org/comments.pl?sid=264749&cid=20165745 a comment on beautiful code]]
[[http://en.wikipedia.org/wiki/L-system L-system grammars]]
Google Books: [[http://books.google.com/books?id=cB4POeMPE9sC&pg=PA27&ots=9jiUY_-cc3&dq=von+Senden&sig=_3EJn7xXFYhBNHterYvsnnaBxfE Annie Dillard's Tinker Creek]] & [[http://books.google.com/books?id=xvoYAAAAIAAJ&q=von+Senden&dq=von+Senden&pgis=1 von Senden's Space and Sight]]
[[http://en.wikipedia.org/wiki/33_Thomas_Street brutalist]]
drupal dev: [[http://drupal.org/node/132845 to do tutorial]] [[http://api.drupal.org/api/HEAD/file/developer/topics/forms_api.html forms api]]
[[http://www.google-analytics.com/urchin.js google-analytics.com urchin script]]
[[http://www.cs.ualberta.ca/~chinook/play/ lose at checkers]] (www.cs.ualberta.ca)
drupal development: [[http://drupal.org/node/316 home]] [[http://drupal.org/node/79237 benchmarking]] [[http://buytaert.net/drupal-webserver-configurations-compared webserver configs]]
pretty code: [[http://ask.slashdot.org/article.pl?sid=07/07/14/2011208&threshold=3 slashdot]] [[http://www.oreilly.com/catalog/9780596510046/toc.html oreilly book]]
vps security: [[http://www.google.com/search?hl=en&safe=active&q=vps+recommended+firewall&btnG=Search google]] [[http://www.usefuljaja.com/2007/4/ubuntu-setup-page-1 ubuntu setup]] [[http://linux.about.com/od/ubusrv_doc/a/ubusg18t01.htm about.com]] [[http://www.webhostingtalk.com/showthread.php?t=468168 secure vps]] [[http://forums.vpslink.com/showthread.php?t=1580 security settings]] [[http://www.webhostgear.com/61.html install apf]]
googles: [[http://www.google.com/search?hl=en&q=apache+password+protect&btnG=Google+Search apache .htaccess passwords]]
virtual host tutorials: [[http://www.onlamp.com/pub/a/apache/2003/07/24/vhosts.html?page=2 onlamp]] [[http://httpd.apache.org/docs/1.3/vhosts/name-based.html apache]] [[http://johnbokma.com/windows/apache-virtual-hosts-xp.html xp local]] [[http://rimuhosting.com/howto/ftp.jsp ftp]]
[[http://www.chiark.greenend.org.uk/~sgtatham/ Simon Tatham's Home Page]]
hosting issues - [[http://redmonk.com/sogrady/2006/05/22/who-turned-out-the-lights-or-the-straw-that-broke-1and1s-back/feed/ more hosting recs]]
[[http://www1.walthamforest.gov.uk/wmg/free.htm william morris wallpaper]]
[[http://www.afterdawn.com/guides/archive/how_to_play_flv_files.cfm how to play youtube videos offline]]
[[http://www.isbn.org/standards/home/isbn/us/isbn-fees.asp isbn fees]] [[http://www.lulu.com/ lulu]] [[http://www.sfwa.org/beware/printondemand.html print-on-demand caveat]] [[http://www.loc.gov/issn/issnbro.html#how issn]]
potential hosts: [[http://www.mediatemple.net/webhosting/dv/pricing.htm mediatemple.net]] [[http://www.jaguarpc.com/services/hosting/cpdemo.php jaguarpc.com]]
[[http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-branchtag.html#tsvn-dug-branch-1 branch/tag Tortoise SVN]]
[[http://www.mingw.org/ MinGW]] (learned about [[http://developers.slashdot.org/comments.pl?sid=237023&cid=19353345 here]])
ie-conditional stylesheets: [[http://www.quirksmode.org/css/condcom.html ie-conditional comments]]
%%<!--[if IE 6]><link rel="stylesheet" href="ie6.css" media="all" type="text/css" /><![endif]-->%%
[[http://tredosoft.com/Multiple_IE the ie multi-version thingamajig I've been looking for?]] (tredosoft.com)
underwriting: [[http://www.krza.org/underwriting.htm kzra.org]] [[http://www.upr.org/underwriting.html upr.org]]
[[http://advertisers.federatedmedia.net/plan.php?site=boingboing blog advertising]]
[[http://yro.slashdot.org/comments.pl?sid=234609&cid=19108551 "Sufficiently advanced satire is indistinguishable from reality."]] (I like this quote.)
[[http://www.digg.com/design/Over_300_Gorgeous_Icons_they_re_free_licensed_under_creative_commons tango lgpl icon set (see comments for other free icon sets)]] (digg.com)
[[http://www.italatin.com/latin.html latin translators]]
[[http://www.boutell.com/newfaq/creating/scriptpass.html posting data in js]] (boutell.com)
[[http://forums.somethingawful.com/showthread.php?threadid=2419323&perpage=40&pagenumber=1 NSFW = Now Safe For Work]] (somethingawful.com)
[[http://www.itasoftware.com/careers/jlisting.html?jid=6 a coding puzzle]] (itasoftware.com)
[[http://gpsgfaq.googlepages.com/google_page_creator.html google pages faq]]
[[http://www.myfinancialjourney.com/archive/frugal-cure-for-a-sore-throat#comment-1305 cure for the common sore throat?]]
[[http://800notes.com/ 800notes.com]] another one of a growing number of telemarketer logging sites
[[http://www.nytimes.com/2007/03/17/business/17online.html?th&emc=th how many visitors to make $50M?]] (nytimes.com)
[[http://www.digg.com/tech_news/Digg_s_Senior_System_Admin_on_How_to_Handle_Network_Growing_Pains digg senior sysadmin slideshow]]
[[http://www.everystockphoto.com/index.php everystockphoto.com]] [[http://morguefile.com/ morguefile.com]] [[http://www.flickr.com/search/advanced/ flickr photo search]]
[[http://www.nytimes.com/2007/03/11/business/11mortgage.html Crisis Looms]] (or is knocking at the door?) (nytimes.com)
[[http://www.nytimes.com/2007/03/11/books/review/Orr.t.html Annals of Poetry]] (nytimes.com)
[[http://weblogs.com/api.html weblogs.com api]]
[[http://www.codinghorror.com/blog/archives/000807.html reducing bandwidth]] (codinghorror.com)
[[http://www.worldmapper.org/thumbnails/mapindex1-12.html worldmapper]]
[[http://www.nytimes.com/2007/03/05/business/05lender.html hold for the pop]] (nytimes.com)
[[http://www.nytimes.com/2007/03/03/technology/03money.html?th&emc=th online salary reporting]] (New York Times) [[http://slashdot.org/article.pl?sid=07/03/06/0127205&threshold=3 the arts of negotiation]] (/.)
[[http://www.npr.org/templates/story/story.php?storyId=7630138 "Heart to Hang Onto" by Pete Townshend and Ronnie Lane]] (npr.org)
[[http://sourceforge.net/projects/snoopy/ Snoopy PHP Class]]
ubuntu programs: [[http://russellthedigitalninja.com/wordpress/?p=8 russellthedigitalninja.com]] [[http://www.digg.com/linux_unix/10_must_have_programs_for_a_new_Ubuntu_user digg]]
some rss feeds: [[http://rss.slashdot.org/Slashdot/slashdot slashdot]] [[http://www.nytimes.com/services/xml/rss/ NY Times]] [[http://news.yahoo.com/rss Yahoo!]] [[http://news.google.com/intl/en_us/news_feed_terms.html Google]] [[http://feeds.gawker.com/gawker/full Gawker]] [[http://www.digg.com/about-rss Digg]] [[http://en.wikipedia.org/wiki/Wikipedia:Syndication Wikipedia]]
[[http://www.socialtext.net/codev2/index.cgi?four_puzzles_from_cyberspace code v2 (by lawrence lessig) wiki]] (socialtext.net)
[[http://www.alternet.org/story/48278 Maybe We Deserve to Be Ripped Off By Bush's Billionaires]] (altnet.org)
[[http://www.linuxquestions.org/questions/showthread.php?s=9700928ee6fe99f6af8bce0257f2fb37&p=2579656#post2579656 computer on a stick]] [[http://www.puppyos.org/flash-puppy.htm puppy linux]]
[[http://alistapart.com/articles/footers/ footer at bottom of viewport]] (alistapart.com)
[[http://www.nextstudent.com/NextPath/nextPath-Online/Top-Web-Tools-for-College-Students.asp college student web tools]]
shared hosting prospects: [[http://www.servint.net/ servint ($ VPS+)]] [[http://www.webcinch.com/starter_plan.php webcinch.com]] [[http://steadfast.net/services/shared.php steadfast.net]] [[http://precisioneffect.com/web_hosting/ precisioneffect.com]] [[http://www.mediatemple.net/webhosting/gs/ mediatemple.net ($)]]
proxy sites (for when I absolutely, positively need to see it at work): [[http://www.avoidr.com/ avoidr.com]] [[http://www.theproxyfree.com/ theproxyfree.com]]
[[http://en.wikipedia.org/wiki/Logarithm logarithms]] (wikipedia)
slashdot submission of my [[http://slashdot.org/~klenwell/journal/162900 Proposal for User ID API]]
ucop customer service number: 1-800-888-8267
syllabification: [[http://en.wikipedia.org/wiki/English_phonology#Phonotactics English phonotactics]] (wikipedia) [[http://www.ingilish.com/englishsyllablestress.htm structural formula]] (ingilish.com)
[[http://pear.php.net/package/Text_TeXHyphen/docs/0.1.0/Text_TeXHyphen/Text_TeXHyphen_WordCache_SimpleHash.html#methodgetSyllables get syllables]] (pear.php.net) [[http://www.dcs.shef.ac.uk/research/ilash/Moby/ moby wordlists]]
[[http://www.maratz.com/blog/archives/2006/06/11/fancy-checkboxes-and-radio-buttons/ custom radio buttons]]
[[http://en.wikipedia.org/wiki/International_Phonetic_Alphabet IPA]] [[http://en.wikipedia.org/wiki/International_Phonetic_Alphabet_for_English#Consonants IPA English Charts]] [[http://upload.wikimedia.org/wikipedia/en/5/5a/IPA_vowel_chart_2005.png IPA vowel chart]] [[http://en.wikipedia.org/wiki/X-SAMPA X-SAMPA]] (wikipedia)
[[http://www.tobinsprout.net/ tobin sprout home page]]
[[http://forums.fark.com/cgi/fark/comments.pl?IDLink=2572484#c27443690 internet argument!]] (fark.com)
[[http://www.poetrydaily.org/archdate.htm poetrydaily.org archive]]
[[http://sonnetmonkeymanuscripts.blogspot.com/ sonnet monkey manuscripts]] (5130824831237278418)
[[http://www.yisongyue.com/shaney/index.php mark v. shaney]] [[http://www.strout.net/python/shaney.py python code]]
split this expression: **a b | {a} {b|c} d** ([[http://www.phpbuilder.com/board/showthread.php?s=c0850d95d2b286715f8ae2f91d23c06a&p=10739198#post10739198 ex 1]] [[http://www.devnetwork.net/forums/viewtopic.php?t=51706&view=previous&sid=4698979ab287e4ad427517cddd4ec8e5 ex 2]] [[http://72.14.253.104/search?q=cache:H8tM1cTiB-oJ:www.thescripts.com/forum/post16376-6.html+preg_split+%22not+within%22&hl=en&gl=us&ct=clnk&cd=27 ex 3]] [[http://codewalkers.com/forum/index.php?action=displaythread&forum=phpcoding&id=5781&realm=default ex 4]]) **[[http://groups.google.com/group/comp.lang.php/msg/07fa10aed96b2268 solution]]**
simple php spam filter ([[http://groups.google.com/group/comp.lang.php/msg/3a2c3b085f7d19ec source]]): %%(php) if ( substr_count($string, 'http://') > 1 ) $is_spam = 1; %%
[[http://www.faceresearch.org/tech/demos/average the ultimate Afro-Eurasian girl of your dreams]] ([[http://www.digg.com/general_sciences/I_created_a_woman_so_beautiful_she_made_me_melt digg]])
[[http://cutlersoftware.com/ubuntuinstall/ ubuntu installation guide]] ([[http://www.digg.com/linux_unix/How_to_install_ANYTHING_in_Ubuntu_3 digg]])
[[http://www.kilgarriff.co.uk/bnc-readme.html kilgarriff's BNC frequency wordlists]] ([[http://www.kilgarriff.co.uk/BNC_lists/poscodes.html POS codes]])
[[http://www.crummy.com/features/StockSpam/ crummy.com stock spam monitor]]
[[http://groups-beta.google.com/group/bloggerDev/browse_frm/thread/278f9b138c890416 blogger API post uid]] (google groups)
[[https://mv.dmv.ca.gov/nrl/welcome.do Notice of Transfer and Release of Liability]] (dmv.ca.gov)
[[http://groups-beta.google.com/group/comp.lang.php/browse_frm/thread/475095e024649b24/021a0aa935e84ee5#021a0aa935e84ee5 memory_get_usage() for php on windows]] (comp.lang.php)
[[http://en.wikipedia.org/wiki/Kiwifruit kiwifruit is from China and Italy is the biggest producer]] (wikipedia)
[[http://www.eliteskills.com/free_education/ Massive Resource List for All Autodidacts]]
[[http://forums.fark.com/cgi/fark/comments.pl?IDLink=2534916#c26968345 interesting post on recent military recruits]] (fark)
[[http://xoopsdocs.net/modules/docs/en/xu-002/online/ch02.html xoops installation]]
[[http://forums.fark.com/cgi/fark/comments.pl?IDLink=2534916#c26961154 a nice visual summary of the Iraq situation]] (fark)
""  ""/look further down the page for a chilling (though apt) Goehring quote
[[http://aten.adapthost.net/PCRepairSystem.zip pc repair kit]] (via [[http://www.digg.com/software/Carry_a_PC_Repair_System_on_a_USB_Drive digg]])
[[http://forums.fark.com/cgi/fark/comments.pl?IDLink=2529537 owls!]] (fark)
[[http://ocw.mit.edu/OcwWeb/Global/all-courses.htm mit ocw master course list]]
[[http://forums.fark.com/cgi/fark/comments.pl?IDLink=2526573 fark play-by-play of bcs championship game]]
[[http://tsfraser.googlepages.com/index.html a cool googlepages page]] [[SpecialHH hh]]
[[http://imageshack.us/]] (fark image hosting)
[[http://slashdot.org/comments.pl?sid=215492&cid=17498006 cleaning your credit report]] (slashdot)
[[http://www.nytimes.com/2007/01/07/technology/07net.html?_r=1&th&emc=th&oref=slogin Attack of the Zombie Computers Is Growing Threat]] (New York Times)
[[http://forums.fark.com/cgi/fark/comments.pl?IDLink=2518022#c26752565 amusing comment]] (fark)
[[http://photobucket.com/ photobucket.com]] (remote hosting site of choice)
[[http://groups-beta.google.com/group/comp.lang.php/browse_frm/thread/449e128f6dca06d3/ab9fe22174c64f36#ab9fe22174c64f36 spatial searches in php/mysql]] (comp.lang.php)
[[http://softwarefor.org/faq.html software for starving students]] (not anymore, but still feel like one)
[[http://www.utorrent.com/ utorrent]] ([[http://forums.fark.com/cgi/fark/comments.pl?IDLink=2514053#c26711021 rec]])
[[http://forums.fark.com/cgi/fark/comments.pl?IDLink=2497320#c26497988 cool graph]]


Revision [742]

Edited on 2007-11-30 22:10:30 by KlenwellAdmin [adds lazy sampling]
Additions:
musical grab bag: [[http://www.youtube.com/watch?v=-JQnn1a3CXE Justice with Uffie]] [[http://www.myspace.com/thetingtings Ting Tings]]
Deletions:
musical grab bag: [[http://www.youtube.com/watch?v=-JQnn1a3CXE *]] [[http://www.myspace.com/thetingtings $]]


Revision [739]

Edited on 2007-11-09 23:31:17 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.smashingmagazine.com/2007/11/08/40-excellent-freefonts-for-professional-design/ nice free fonts]]


Revision [738]

Edited on 2007-10-17 23:44:30 by KlenwellAdmin [adds lazy sampling]
Additions:
vbs scripts: [[http://www.visualbasicscript.com/m_27365/tm.htm AD queries]] [[http://www.rlmueller.net/PingComputers.htm pinging computers]]
Deletions:
[[http://www.visualbasicscript.com/m_27365/tm.htm vbs script]] (see AD part)


Revision [737]

Edited on 2007-10-17 19:25:18 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.visualbasicscript.com/m_27365/tm.htm vbs script]] (see AD part)


Revision [736]

Edited on 2007-10-11 18:14:41 by KlenwellAdmin [adds lazy sampling]
Additions:
php server optimizaton: [[http://discuss.joelonsoftware.com/default.asp?joel.3.550939.7 joelonsoftware forums]] [[http://hudzilla.org/phpwiki/index.php?title=Performance hudzilla.org]]


Revision [735]

Edited on 2007-10-11 18:14:10 by KlenwellAdmin [adds lazy sampling]
Additions:
406 error? http://urbangiraffe.com/2005/08/20/mysterious-406-error/


Revision [734]

Edited on 2007-10-05 11:50:04 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://it.slashdot.org/article.pl?sid=07/10/05/1234217&threshold=3 slashdot again on linux security]]


Revision [733]

Edited on 2007-09-30 19:52:03 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://kwimgs.googlepages.com/ klenwell image site at pages.google]]


Revision [732]

Edited on 2007-09-30 18:58:09 by KlenwellAdmin [adds lazy sampling]
Additions:
email trigger php: [[http://groups.google.com/group/comp.lang.php/browse_frm/thread/bfd6d0781d98a1c4/5d20f271cde37e56?lnk=st&q=Then+reload+service.+Please+note+somePHPfunctions.php&rnum=1#5d20f271cde37e56 gg]] [[http://www.google.com/search?hl=en&q=email+trigger+php+script&btnG=Google+Search google search]] [[http://www.mail-archive.com/php-general@lists.php.net/msg183184.html troubleshooting]]


Revision [731]

Edited on 2007-09-30 13:37:22 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.freefavicon.com/freefavicons/objects/index.php favicons]]


Revision [730]

Edited on 2007-09-23 22:27:23 by KlenwellAdmin [adds lazy sampling]
Additions:
musical grab bag: [[http://www.youtube.com/watch?v=-JQnn1a3CXE *]] [[http://www.myspace.com/thetingtings $]]
Deletions:
""<small>""musical grab bag: [[http://www.youtube.com/watch?v=-JQnn1a3CXE *]]""</small>""


Revision [729]

Edited on 2007-09-22 14:25:26 by KlenwellAdmin [adds lazy sampling]
Additions:
""<small>links and notes for later organization</small>""
""<small>""musical grab bag: [[http://www.youtube.com/watch?v=-JQnn1a3CXE *]]""</small>""
Deletions:
""<small>links and notes for later organization</small>
musical grab bag: [[http://www.youtube.com/watch?v=-JQnn1a3CXE *]]


Revision [728]

Edited on 2007-09-22 14:24:36 by KlenwellAdmin [adds lazy sampling]
Additions:
musical grab bag: [[http://www.youtube.com/watch?v=-JQnn1a3CXE *]]
Deletions:
""<small>""music: [[http://www.youtube.com/watch?v=-JQnn1a3CXE *]]""</small>""


Revision [727]

Edited on 2007-09-22 14:24:05 by KlenwellAdmin [adds lazy sampling]
Additions:
""<small>links and notes for later organization</small>
""<small>""music: [[http://www.youtube.com/watch?v=-JQnn1a3CXE *]]""</small>""
free oss: [[http://www.theopencd.org/programs opencd.org]]
Deletions:
""<small>links and notes for later organization</small>""
music: [[http://www.youtube.com/watch?v=-JQnn1a3CXE *]]


Revision [726]

Edited on 2007-09-20 19:19:47 by KlenwellAdmin [adds lazy sampling]
Additions:
music: [[http://www.youtube.com/watch?v=-JQnn1a3CXE *]]


Revision [725]

Edited on 2007-09-18 19:25:58 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://ask.slashdot.org/comments.pl?sid=236077&threshold=1&commentsort=0&mode=thread&pid=19268133#19268179 free pdf printers]] [[http://sourceforge.net/projects/pdfcreator/ pdfcreator]] (my pick)
Deletions:
[[http://ask.slashdot.org/comments.pl?sid=236077&threshold=1&commentsort=0&mode=thread&pid=19268133#19268179 free pdf printers]]


Revision [724]

Edited on 2007-09-18 19:24:00 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://ask.slashdot.org/comments.pl?sid=236077&threshold=1&commentsort=0&mode=thread&pid=19268133#19268179 free pdf printers]]


Revision [723]

Edited on 2007-09-17 13:27:54 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.phpunit.de/pocket_guide/index.en.php PHPUnit guide]]


Revision [722]

Edited on 2007-09-17 11:59:10 by KlenwellAdmin [adds lazy sampling]
Additions:
[[https://help.ubuntu.com/community/CronHowto ubuntu cron]] [[http://ubuntuforums.org/archive/index.php/t-106270.html more info]] [[http://www.unixgeeks.org/security/newbie/unix/cron-1.html cron docs]]
Deletions:
[[https://help.ubuntu.com/community/CronHowto ubuntu cron]] [[http://ubuntuforums.org/archive/index.php/t-106270.html more info]]


Revision [721]

Edited on 2007-09-17 11:57:49 by KlenwellAdmin [adds lazy sampling]
Additions:
[[https://help.ubuntu.com/community/CronHowto ubuntu cron]] [[http://ubuntuforums.org/archive/index.php/t-106270.html more info]]


Revision [720]

Edited on 2007-09-14 14:14:11 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://developers.facebook.com/documentation.php facebook api documentation]] [[http://www.whenpenguinsattack.com/2006/10/05/how-to-use-the-facebook-api/ quick php tutorial]]


Revision [718]

Edited on 2007-09-05 11:21:13 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.webhostingtalk.com/showthread.php?t=444824&highlight=document+root+linux+where Apache 2, SSL, and Virtual Hosts]]


Revision [717]

Edited on 2007-08-24 12:58:43 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://it.slashdot.org/comments.pl?sid=276599&cid=20345963 linux forensics]] (slashdot.org)


Revision [716]

Edited on 2007-08-17 12:06:31 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://flurdy.com/docs/postfix/ ubuntu mailserver]] (flurdy.com)


Revision [715]

Edited on 2007-08-10 22:22:53 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.php.net/manual/en/function.setcookie.php#74401 cookie code]]


Revision [714]

Edited on 2007-08-10 20:17:19 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://snook.ca/archives/html_and_css/six_keys_to_understanding_css_layouts/ 6 css layout keys]] [[http://www.alistapart.com/articles/sprites/ css sprites]]


Revision [713]

Edited on 2007-08-10 20:05:37 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://developers.slashdot.org/comments.pl?sid=266713&cid=20187933 jungle disk]]


Revision [712]

Edited on 2007-08-08 23:00:07 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://it.slashdot.org/comments.pl?sid=264749&cid=20165745 a comment on beautiful code]]


Revision [710]

Edited on 2007-08-05 22:37:17 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://en.wikipedia.org/wiki/L-system L-system grammars]]


Revision [707]

Edited on 2007-07-28 11:52:40 by KlenwellAdmin [adds lazy sampling]
Additions:
Google Books: [[http://books.google.com/books?id=cB4POeMPE9sC&pg=PA27&ots=9jiUY_-cc3&dq=von+Senden&sig=_3EJn7xXFYhBNHterYvsnnaBxfE Annie Dillard's Tinker Creek]] & [[http://books.google.com/books?id=xvoYAAAAIAAJ&q=von+Senden&dq=von+Senden&pgis=1 von Senden's Space and Sight]]
Deletions:
[[http://books.google.com/books?id=cB4POeMPE9sC&pg=PA27&ots=9jiUY_-cc3&dq=von+Senden&sig=_3EJn7xXFYhBNHterYvsnnaBxfE Annie Dillard's Tinker Creek]] [[http://books.google.com/books?id=xvoYAAAAIAAJ&q=von+Senden&dq=von+Senden&pgis=1 von Senden's Space and Sight]]


Revision [706]

Edited on 2007-07-28 11:52:19 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://books.google.com/books?id=cB4POeMPE9sC&pg=PA27&ots=9jiUY_-cc3&dq=von+Senden&sig=_3EJn7xXFYhBNHterYvsnnaBxfE Annie Dillard's Tinker Creek]] [[http://books.google.com/books?id=xvoYAAAAIAAJ&q=von+Senden&dq=von+Senden&pgis=1 von Senden's Space and Sight]]
Deletions:
[[http://books.google.com/books?id=cB4POeMPE9sC&pg=PA27&ots=9jiUY_-cc3&dq=von+Senden&sig=_3EJn7xXFYhBNHterYvsnnaBxfE Annie Dillard's //Tinker Creek//]] [[http://books.google.com/books?id=xvoYAAAAIAAJ&q=von+Senden&dq=von+Senden&pgis=1 von Senden's //Space and Sight//]]


Revision [705]

Edited on 2007-07-28 11:51:59 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://books.google.com/books?id=cB4POeMPE9sC&pg=PA27&ots=9jiUY_-cc3&dq=von+Senden&sig=_3EJn7xXFYhBNHterYvsnnaBxfE Annie Dillard's //Tinker Creek//]] [[http://books.google.com/books?id=xvoYAAAAIAAJ&q=von+Senden&dq=von+Senden&pgis=1 von Senden's //Space and Sight//]]


Revision [704]

Edited on 2007-07-27 12:46:09 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://en.wikipedia.org/wiki/33_Thomas_Street brutalist]]


Revision [703]

Edited on 2007-07-25 11:26:32 by KlenwellAdmin [adds lazy sampling]
Additions:
drupal dev: [[http://drupal.org/node/132845 to do tutorial]] [[http://api.drupal.org/api/HEAD/file/developer/topics/forms_api.html forms api]]


Revision [699]

Edited on 2007-07-23 23:25:18 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://tsfraser.googlepages.com/index.html a cool googlepages page]] [[SpecialHH hh]]
Deletions:
[[http://tsfraser.googlepages.com/index.html a cool googlepages page]]


Revision [698]

Edited on 2007-07-22 18:34:54 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.google-analytics.com/urchin.js google-analytics.com urchin script]]


Revision [697]

Edited on 2007-07-21 10:39:05 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.cs.ualberta.ca/~chinook/play/ lose at checkers]] (www.cs.ualberta.ca)


Revision [694]

Edited on 2007-07-18 12:16:20 by KlenwellAdmin [adds lazy sampling]
Additions:
potential hosts: [[http://www.mediatemple.net/webhosting/dv/pricing.htm mediatemple.net]] [[http://www.jaguarpc.com/services/hosting/cpdemo.php jaguarpc.com]]
Deletions:
[[http://www.jaguarpc.com/services/hosting/cpdemo.php potential host: jaguarpc.com]]


Revision [693]

Edited on 2007-07-18 11:33:10 by KlenwellAdmin [adds lazy sampling]
Additions:
drupal development: [[http://drupal.org/node/316 home]] [[http://drupal.org/node/79237 benchmarking]] [[http://buytaert.net/drupal-webserver-configurations-compared webserver configs]]


Revision [691]

Edited on 2007-07-15 13:32:06 by KlenwellAdmin [adds lazy sampling]
Additions:
pretty code: [[http://ask.slashdot.org/article.pl?sid=07/07/14/2011208&threshold=3 slashdot]] [[http://www.oreilly.com/catalog/9780596510046/toc.html oreilly book]]


Revision [674]

Edited on 2007-07-09 12:35:08 by KlenwellAdmin [adds lazy sampling]
Additions:
vps security: [[http://www.google.com/search?hl=en&safe=active&q=vps+recommended+firewall&btnG=Search google]] [[http://www.usefuljaja.com/2007/4/ubuntu-setup-page-1 ubuntu setup]] [[http://linux.about.com/od/ubusrv_doc/a/ubusg18t01.htm about.com]] [[http://www.webhostingtalk.com/showthread.php?t=468168 secure vps]] [[http://forums.vpslink.com/showthread.php?t=1580 security settings]] [[http://www.webhostgear.com/61.html install apf]]
Deletions:
vps security: [[http://www.google.com/search?hl=en&safe=active&q=vps+recommended+firewall&btnG=Search google]] [[http://linux.about.com/od/ubusrv_doc/a/ubusg18t01.htm about.com]] [[http://www.webhostingtalk.com/showthread.php?t=468168 secure vps]] [[http://forums.vpslink.com/showthread.php?t=1580 security settings]] [[http://www.webhostgear.com/61.html install apf]]


Revision [673]

Edited on 2007-07-09 11:54:24 by KlenwellAdmin [adds lazy sampling]
Additions:
vps security: [[http://www.google.com/search?hl=en&safe=active&q=vps+recommended+firewall&btnG=Search google]] [[http://linux.about.com/od/ubusrv_doc/a/ubusg18t01.htm about.com]] [[http://www.webhostingtalk.com/showthread.php?t=468168 secure vps]] [[http://forums.vpslink.com/showthread.php?t=1580 security settings]] [[http://www.webhostgear.com/61.html install apf]]
Deletions:
vps security: [[http://www.google.com/search?hl=en&safe=active&q=vps+recommended+firewall&btnG=Search google]] [[http://www.webhostingtalk.com/showthread.php?t=468168 secure vps]] [[http://forums.vpslink.com/showthread.php?t=1580 security settings]] [[http://www.webhostgear.com/61.html install apf]]


Revision [672]

Edited on 2007-07-09 11:53:08 by KlenwellAdmin [adds lazy sampling]
Additions:
vps security: [[http://www.google.com/search?hl=en&safe=active&q=vps+recommended+firewall&btnG=Search google]] [[http://www.webhostingtalk.com/showthread.php?t=468168 secure vps]] [[http://forums.vpslink.com/showthread.php?t=1580 security settings]] [[http://www.webhostgear.com/61.html install apf]]
Deletions:
vps security: [[http://www.google.com/search?hl=en&safe=active&q=vps+recommended+firewall&btnG=Search google]]
[[http://www.webhostingtalk.com/showthread.php?t=468168 secure vps]]
[[http://forums.vpslink.com/showthread.php?t=1580 security settings]] [[http://www.webhostgear.com/61.html install apf]]


Revision [671]

Edited on 2007-07-09 11:52:37 by KlenwellAdmin [adds lazy sampling]
Additions:
vps security: [[http://www.google.com/search?hl=en&safe=active&q=vps+recommended+firewall&btnG=Search google]]
[[http://www.webhostingtalk.com/showthread.php?t=468168 secure vps]]
[[http://forums.vpslink.com/showthread.php?t=1580 security settings]] [[http://www.webhostgear.com/61.html install apf]]
Deletions:
vps security: [[http://www.google.com/search?hl=en&safe=active&q=vps+recommended+firewall&btnG=Search google]] [[http://forums.vpslink.com/showthread.php?t=1580 security settings]] [[http://www.webhostgear.com/61.html install apf]]


Revision [670]

Edited on 2007-07-09 11:41:08 by KlenwellAdmin [adds lazy sampling]
Additions:
vps security: [[http://www.google.com/search?hl=en&safe=active&q=vps+recommended+firewall&btnG=Search google]] [[http://forums.vpslink.com/showthread.php?t=1580 security settings]] [[http://www.webhostgear.com/61.html install apf]]
virtual host tutorials: [[http://www.onlamp.com/pub/a/apache/2003/07/24/vhosts.html?page=2 onlamp]] [[http://httpd.apache.org/docs/1.3/vhosts/name-based.html apache]] [[http://johnbokma.com/windows/apache-virtual-hosts-xp.html xp local]] [[http://rimuhosting.com/howto/ftp.jsp ftp]]
Deletions:
ftp tutorials: [[http://rimuhosting.com/howto/ftp.jsp 1]]
virtual host tutorials: [[http://www.onlamp.com/pub/a/apache/2003/07/24/vhosts.html?page=2 onlamp]] [[http://httpd.apache.org/docs/1.3/vhosts/name-based.html apache]] [[http://johnbokma.com/windows/apache-virtual-hosts-xp.html xp local]]


Revision [655]

Edited on 2007-07-06 14:19:51 by KlenwellAdmin [adds lazy sampling]
Deletions:
SpamTrap


Revision [649]

Edited on 2007-07-06 14:10:32 by KlenwellAdmin [adds lazy sampling]
Additions:
SpamTrap


Revision [648]

Edited on 2007-07-06 13:57:49 by KlenwellAdmin [adds lazy sampling]
Additions:
googles: [[http://www.google.com/search?hl=en&q=apache+password+protect&btnG=Google+Search apache .htaccess passwords]]


Revision [647]

Edited on 2007-07-06 13:36:55 by KlenwellAdmin [adds lazy sampling]
Additions:
virtual host tutorials: [[http://www.onlamp.com/pub/a/apache/2003/07/24/vhosts.html?page=2 onlamp]] [[http://httpd.apache.org/docs/1.3/vhosts/name-based.html apache]] [[http://johnbokma.com/windows/apache-virtual-hosts-xp.html xp local]]


Revision [646]

Edited on 2007-07-06 11:29:51 by KlenwellAdmin [adds lazy sampling]
Additions:
ftp tutorials: [[http://rimuhosting.com/howto/ftp.jsp 1]]


Revision [619]

Edited on 2007-06-28 13:43:22 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.chiark.greenend.org.uk/~sgtatham/ Simon Tatham's Home Page]]


Revision [616]

Edited on 2007-06-27 11:17:47 by KlenwellAdmin [adds lazy sampling]
Additions:
hosting issues - [[http://redmonk.com/sogrady/2006/05/22/who-turned-out-the-lights-or-the-straw-that-broke-1and1s-back/feed/ more hosting recs]]


Revision [613]

Edited on 2007-06-25 18:46:13 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www1.walthamforest.gov.uk/wmg/free.htm william morris wallpaper]]


Revision [558]

Edited on 2007-06-14 10:17:40 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.afterdawn.com/guides/archive/how_to_play_flv_files.cfm how to play youtube videos offline]]


Revision [557]

Edited on 2007-06-13 15:30:22 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.isbn.org/standards/home/isbn/us/isbn-fees.asp isbn fees]] [[http://www.lulu.com/ lulu]] [[http://www.sfwa.org/beware/printondemand.html print-on-demand caveat]] [[http://www.loc.gov/issn/issnbro.html#how issn]]
Deletions:
[[http://www.isbn.org/standards/home/isbn/us/isbn-fees.asp isbn fees]] [[http://www.lulu.com/ lulu]] [[http://www.sfwa.org/beware/printondemand.html print-on-demand caveat]]


Revision [555]

Edited on 2007-06-12 11:18:29 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.isbn.org/standards/home/isbn/us/isbn-fees.asp isbn fees]] [[http://www.lulu.com/ lulu]] [[http://www.sfwa.org/beware/printondemand.html print-on-demand caveat]]
Deletions:
[[http://www.isbn.org/standards/home/isbn/us/isbn-fees.asp isbn fees]] [[http://www.lulu.com/ lulu]]


Revision [554]

Edited on 2007-06-12 10:54:03 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.isbn.org/standards/home/isbn/us/isbn-fees.asp isbn fees]] [[http://www.lulu.com/ lulu]]


Revision [542]

Edited on 2007-06-06 21:07:50 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.jaguarpc.com/services/hosting/cpdemo.php potential host: jaguarpc.com]]


Revision [534]

Edited on 2007-06-04 19:44:48 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://advertisers.federatedmedia.net/plan.php?site=boingboing blog advertising]]


Revision [533]

Edited on 2007-06-04 18:23:44 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-branchtag.html#tsvn-dug-branch-1 branch/tag Tortoise SVN]]


Revision [532]

Edited on 2007-06-01 12:18:10 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.mingw.org/ MinGW]] (learned about [[http://developers.slashdot.org/comments.pl?sid=237023&cid=19353345 here]])


Revision [531]

Edited on 2007-06-01 10:43:34 by KlenwellAdmin [adds lazy sampling]
Additions:
ie-conditional stylesheets: [[http://www.quirksmode.org/css/condcom.html ie-conditional comments]]
%%<!--[if IE 6]><link rel="stylesheet" href="ie6.css" media="all" type="text/css" /><![endif]-->%%
Deletions:
ie-conditional stylesheets: [[http://www.quirksmode.org/css/condcom.html ie-conditional comments]] e.g. <!--[if IE 6]><link rel="stylesheet" href="ie6.css" media="all" type="text/css" /><![endif]-->


Revision [530]

Edited on 2007-06-01 10:43:18 by KlenwellAdmin [adds lazy sampling]
Additions:
ie-conditional stylesheets: [[http://www.quirksmode.org/css/condcom.html ie-conditional comments]] e.g. <!--[if IE 6]><link rel="stylesheet" href="ie6.css" media="all" type="text/css" /><![endif]-->


Revision [529]

Edited on 2007-06-01 10:37:19 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://tredosoft.com/Multiple_IE the ie multi-version thingamajig I've been looking for?]] (tredosoft.com)


Revision [518]

Edited on 2007-05-23 13:33:56 by KlenwellAdmin [adds lazy sampling]
Additions:
underwriting: [[http://www.krza.org/underwriting.htm kzra.org]] [[http://www.upr.org/underwriting.html upr.org]]


Revision [496]

Edited on 2007-05-14 11:03:37 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://yro.slashdot.org/comments.pl?sid=234609&cid=19108551 "Sufficiently advanced satire is indistinguishable from reality."]] (I like this quote.)


Revision [462]

Edited on 2007-04-28 12:42:08 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.digg.com/design/Over_300_Gorgeous_Icons_they_re_free_licensed_under_creative_commons tango lgpl icon set (see comments for other free icon sets)]] (digg.com)


Revision [451]

Edited on 2007-04-26 20:13:15 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.italatin.com/latin.html latin translators]]


Revision [422]

Edited on 2007-04-19 11:06:54 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.boutell.com/newfaq/creating/scriptpass.html posting data in js]] (boutell.com)


Revision [400]

Edited on 2007-04-13 11:41:51 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://forums.somethingawful.com/showthread.php?threadid=2419323&perpage=40&pagenumber=1 NSFW = Now Safe For Work]] (somethingawful.com)


Revision [399]

Edited on 2007-04-12 16:15:48 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.itasoftware.com/careers/jlisting.html?jid=6 a coding puzzle]] (itasoftware.com)


Revision [372]

Edited on 2007-04-03 17:46:47 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://gpsgfaq.googlepages.com/google_page_creator.html google pages faq]]


Revision [340]

Edited on 2007-03-21 10:45:15 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.myfinancialjourney.com/archive/frugal-cure-for-a-sore-throat#comment-1305 cure for the common sore throat?]]


Revision [335]

Edited on 2007-03-19 14:21:07 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://800notes.com/ 800notes.com]] another one of a growing number of telemarketer logging sites


Revision [309]

Edited on 2007-03-17 12:37:27 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2007/03/17/business/17online.html?th&emc=th how many visitors to make $50M?]] (nytimes.com)
Deletions:
[[http://www.nytimes.com/2007/03/17/business/17online.html?th&emc=th how many visitors to make $50M?] (nytimes.com)


Revision [308]

Edited on 2007-03-17 12:37:17 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2007/03/17/business/17online.html?th&emc=th how many visitors to make $50M?] (nytimes.com)


Revision [302]

Edited on 2007-03-15 12:19:04 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.digg.com/tech_news/Digg_s_Senior_System_Admin_on_How_to_Handle_Network_Growing_Pains digg senior sysadmin slideshow]]


Revision [285]

Edited on 2007-03-13 18:10:36 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.everystockphoto.com/index.php everystockphoto.com]] [[http://morguefile.com/ morguefile.com]] [[http://www.flickr.com/search/advanced/ flickr photo search]]
Deletions:
[[http://www.everystockphoto.com/index.php everystockphoto.com]] [[http://www.flickr.com/search/advanced/ flickr photo search]]


Revision [284]

Edited on 2007-03-13 18:06:27 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.everystockphoto.com/index.php everystockphoto.com]] [[http://www.flickr.com/search/advanced/ flickr photo search]]
Deletions:
[[http://www.everystockphoto.com/index.php everystockphoto.com]]


Revision [283]

Edited on 2007-03-13 18:01:45 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.everystockphoto.com/index.php everystockphoto.com]]


Revision [276]

Edited on 2007-03-11 14:36:15 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2007/03/11/business/11mortgage.html Crisis Looms]] (or is knocking at the door?) (nytimes.com)
Deletions:
[[http://www.nytimes.com/2007/03/11/business/11mortgage.html Crisis Looms]] (or knocks?) (nytimes.com)


Revision [275]

Edited on 2007-03-11 12:26:50 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2007/03/11/business/11mortgage.html Crisis Looms]] (or knocks?) (nytimes.com)


Revision [274]

Edited on 2007-03-11 12:22:45 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2007/03/11/books/review/Orr.t.html Annals of Poetry]] (nytimes.com)


Revision [266]

Edited on 2007-03-07 12:40:29 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://weblogs.com/api.html weblogs.com api]]


Revision [265]

Edited on 2007-03-07 11:35:18 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.codinghorror.com/blog/archives/000807.html reducing bandwidth]] (codinghorror.com)


Revision [264]

Edited on 2007-03-06 16:05:04 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.worldmapper.org/thumbnails/mapindex1-12.html worldmapper]]


Revision [263]

Edited on 2007-03-06 12:45:57 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2007/03/05/business/05lender.html hold for the pop]] (nytimes.com)


Revision [262]

Edited on 2007-03-06 12:30:23 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2007/03/03/technology/03money.html?th&emc=th online salary reporting]] (New York Times) [[http://slashdot.org/article.pl?sid=07/03/06/0127205&threshold=3 the arts of negotiation]] (/.)
Deletions:
[[http://www.nytimes.com/2007/03/03/technology/03money.html?th&emc=th online salary reporting]] (New York Times) [[http://slashdot.org/article.pl?sid=07/03/06/0127205&threshold=3 avoiding the number]] (/.)


Revision [261]

Edited on 2007-03-06 12:18:25 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2007/03/03/technology/03money.html?th&emc=th online salary reporting]] (New York Times) [[http://slashdot.org/article.pl?sid=07/03/06/0127205&threshold=3 avoiding the number]] (/.)
Deletions:
[[http://www.nytimes.com/2007/03/03/technology/03money.html?th&emc=th online salary reporting]] (New York Times)


Revision [241]

Edited on 2007-03-03 12:23:12 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nytimes.com/2007/03/03/technology/03money.html?th&emc=th online salary reporting]] (New York Times)


Revision [240]

Edited on 2007-02-28 19:54:57 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.npr.org/templates/story/story.php?storyId=7630138 "Heart to Hang Onto" by Pete Townshend and Ronnie Lane]] (npr.org)
Deletions:
[[http://www.npr.org/templates/story/story.php?storyId=7630138 "Heart to Hang Onto" by Peter Townsend and Ronnie Lane]] (npr.org)


Revision [239]

Edited on 2007-02-28 19:54:15 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.npr.org/templates/story/story.php?storyId=7630138 "Heart to Hang Onto" by Peter Townsend and Ronnie Lane]] (npr.org)
Deletions:
[[http://www.npr.org/templates/story/story.php?storyId=7630138 "Heart to Hang Onto" by Peter Townsend and Ronnie Lane]]


Revision [238]

Edited on 2007-02-28 19:54:00 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.npr.org/templates/story/story.php?storyId=7630138 "Heart to Hang Onto" by Peter Townsend and Ronnie Lane]]


Revision [237]

Edited on 2007-02-27 19:48:40 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://sourceforge.net/projects/snoopy/ Snoopy PHP Class]]


Revision [236]

Edited on 2007-02-23 14:26:26 by KlenwellAdmin [adds lazy sampling]
Additions:
ubuntu programs: [[http://russellthedigitalninja.com/wordpress/?p=8 russellthedigitalninja.com]] [[http://www.digg.com/linux_unix/10_must_have_programs_for_a_new_Ubuntu_user digg]]


Revision [235]

Edited on 2007-02-23 14:24:05 by KlenwellAdmin [adds lazy sampling]
Additions:
some rss feeds: [[http://rss.slashdot.org/Slashdot/slashdot slashdot]] [[http://www.nytimes.com/services/xml/rss/ NY Times]] [[http://news.yahoo.com/rss Yahoo!]] [[http://news.google.com/intl/en_us/news_feed_terms.html Google]] [[http://feeds.gawker.com/gawker/full Gawker]] [[http://www.digg.com/about-rss Digg]] [[http://en.wikipedia.org/wiki/Wikipedia:Syndication Wikipedia]]
Deletions:
some rss feeds: [[http://rss.slashdot.org/Slashdot/slashdot slashdot]] [[http://www.nytimes.com/services/xml/rss/ NY Times]] [[http://news.yahoo.com/rss Yahoo!]] [[http://news.google.com/intl/en_us/news_feed_terms.html Google]] [[http://feeds.gawker.com/gawker/full Gawker]] [[http://en.wikipedia.org/wiki/Wikipedia:Syndication wikipedia]]


Revision [234]

Edited on 2007-02-23 14:20:07 by KlenwellAdmin [adds lazy sampling]
Additions:
some rss feeds: [[http://rss.slashdot.org/Slashdot/slashdot slashdot]] [[http://www.nytimes.com/services/xml/rss/ NY Times]] [[http://news.yahoo.com/rss Yahoo!]] [[http://news.google.com/intl/en_us/news_feed_terms.html Google]] [[http://feeds.gawker.com/gawker/full Gawker]] [[http://en.wikipedia.org/wiki/Wikipedia:Syndication wikipedia]]


Revision [228]

Edited on 2007-02-22 12:42:32 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.socialtext.net/codev2/index.cgi?four_puzzles_from_cyberspace code v2 (by lawrence lessig) wiki]] (socialtext.net)


Revision [227]

Edited on 2007-02-21 19:38:50 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.alternet.org/story/48278 Maybe We Deserve to Be Ripped Off By Bush's Billionaires]] (altnet.org)


Revision [214]

Edited on 2007-02-20 20:05:44 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.linuxquestions.org/questions/showthread.php?s=9700928ee6fe99f6af8bce0257f2fb37&p=2579656#post2579656 computer on a stick]] [[http://www.puppyos.org/flash-puppy.htm puppy linux]]


Revision [202]

Edited on 2007-02-16 16:57:09 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://alistapart.com/articles/footers/ footer at bottom of viewport]] (alistapart.com)


Revision [200]

Edited on 2007-02-16 11:23:41 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.nextstudent.com/NextPath/nextPath-Online/Top-Web-Tools-for-College-Students.asp college student web tools]]


Revision [194]

Edited on 2007-02-15 14:00:09 by KlenwellAdmin [adds lazy sampling]
Additions:
shared hosting prospects: [[http://www.servint.net/ servint ($ VPS+)]] [[http://www.webcinch.com/starter_plan.php webcinch.com]] [[http://steadfast.net/services/shared.php steadfast.net]] [[http://precisioneffect.com/web_hosting/ precisioneffect.com]] [[http://www.mediatemple.net/webhosting/gs/ mediatemple.net ($)]]
Deletions:
shared hosting prospects: [[http://www.servint.net/ servint (VPS+)]] [[http://www.webcinch.com/starter_plan.php webcinch.com]] [[http://steadfast.net/services/shared.php steadfast.net]]


Revision [193]

Edited on 2007-02-15 13:40:47 by KlenwellAdmin [adds lazy sampling]
Additions:
shared hosting prospects: [[http://www.servint.net/ servint (VPS+)]] [[http://www.webcinch.com/starter_plan.php webcinch.com]] [[http://steadfast.net/services/shared.php steadfast.net]]
Deletions:
shared hosting prospects: [[http://www.servint.net/ servint]] [[http://www.webcinch.com/starter_plan.php webcinch]]


Revision [192]

Edited on 2007-02-15 13:19:19 by KlenwellAdmin [adds lazy sampling]
Additions:
shared hosting prospects: [[http://www.servint.net/ servint]] [[http://www.webcinch.com/starter_plan.php webcinch]]
Deletions:
hosting: [[http://www.servint.net/ servint]]


Revision [191]

Edited on 2007-02-15 13:06:02 by KlenwellAdmin [adds lazy sampling]
Additions:
hosting: [[http://www.servint.net/ servint]]


Revision [182]

Edited on 2007-02-09 20:05:47 by KlenwellAdmin [adds lazy sampling]
Additions:
proxy sites (for when I absolutely, positively need to see it at work): [[http://www.avoidr.com/ avoidr.com]] [[http://www.theproxyfree.com/ theproxyfree.com]]


Revision [181]

Edited on 2007-02-08 13:49:19 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://en.wikipedia.org/wiki/Logarithm logarithms]] (wikipedia)
slashdot submission of my [[http://slashdot.org/~klenwell/journal/162900 Proposal for User ID API]]


Revision [180]

Edited on 2007-02-07 13:46:28 by KlenwellAdmin [adds lazy sampling]
Additions:
ucop customer service number: 1-800-888-8267


Revision [179]

Edited on 2007-02-06 14:52:02 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://en.wikipedia.org/wiki/International_Phonetic_Alphabet IPA]] [[http://en.wikipedia.org/wiki/International_Phonetic_Alphabet_for_English#Consonants IPA English Charts]] [[http://upload.wikimedia.org/wikipedia/en/5/5a/IPA_vowel_chart_2005.png IPA vowel chart]] [[http://en.wikipedia.org/wiki/X-SAMPA X-SAMPA]] (wikipedia)
Deletions:
[[http://en.wikipedia.org/wiki/International_Phonetic_Alphabet IPA]] [[http://upload.wikimedia.org/wikipedia/en/5/5a/IPA_vowel_chart_2005.png IPA vowel chart]] [[http://en.wikipedia.org/wiki/X-SAMPA X-SAMPA]] (wikipedia)


Revision [172]

Edited on 2007-02-02 13:19:58 by KlenwellAdmin [adds lazy sampling]
Additions:
syllabification: [[http://en.wikipedia.org/wiki/English_phonology#Phonotactics English phonotactics]] (wikipedia) [[http://www.ingilish.com/englishsyllablestress.htm structural formula]] (ingilish.com)
Deletions:
syllabification: [[http://en.wikipedia.org/wiki/English_phonology#Phonotactics English phonotactics]] (wikipedia)


Revision [171]

Edited on 2007-02-02 13:14:12 by KlenwellAdmin [adds lazy sampling]
Additions:
syllabification: [[http://en.wikipedia.org/wiki/English_phonology#Phonotactics English phonotactics]] (wikipedia)
Deletions:
syllabifications: [[http://en.wikipedia.org/wiki/English_phonology#Phonotactics English phonotactics]] (wikipedia)


Revision [170]

Edited on 2007-02-02 13:14:02 by KlenwellAdmin [adds lazy sampling]
Additions:
syllabifications: [[http://en.wikipedia.org/wiki/English_phonology#Phonotactics English phonotactics]] (wikipedia)


Revision [169]

Edited on 2007-02-01 13:21:28 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://pear.php.net/package/Text_TeXHyphen/docs/0.1.0/Text_TeXHyphen/Text_TeXHyphen_WordCache_SimpleHash.html#methodgetSyllables get syllables]] (pear.php.net) [[http://www.dcs.shef.ac.uk/research/ilash/Moby/ moby wordlists]]
Deletions:
[[http://pear.php.net/package/Text_TeXHyphen/docs/0.1.0/Text_TeXHyphen/Text_TeXHyphen_WordCache_SimpleHash.html#methodgetSyllables get syllables]] (pear.php.net)


Revision [168]

Edited on 2007-02-01 13:02:18 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://pear.php.net/package/Text_TeXHyphen/docs/0.1.0/Text_TeXHyphen/Text_TeXHyphen_WordCache_SimpleHash.html#methodgetSyllables get syllables]] (pear.php.net)


Revision [167]

Edited on 2007-02-01 12:32:44 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.maratz.com/blog/archives/2006/06/11/fancy-checkboxes-and-radio-buttons/ custom radio buttons]]


Revision [166]

Edited on 2007-01-30 12:25:18 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://en.wikipedia.org/wiki/International_Phonetic_Alphabet IPA]] [[http://upload.wikimedia.org/wikipedia/en/5/5a/IPA_vowel_chart_2005.png IPA vowel chart]] [[http://en.wikipedia.org/wiki/X-SAMPA X-SAMPA]] (wikipedia)
Deletions:
[[http://en.wikipedia.org/wiki/International_Phonetic_Alphabet IPA]] [[http://upload.wikimedia.org/wikipedia/en/5/5a/IPA_vowel_chart_2005.png IPA vowel chart]] (wikipedia)


Revision [165]

Edited on 2007-01-30 11:51:05 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://en.wikipedia.org/wiki/International_Phonetic_Alphabet IPA]] [[http://upload.wikimedia.org/wikipedia/en/5/5a/IPA_vowel_chart_2005.png IPA vowel chart]] (wikipedia)


Revision [164]

Edited on 2007-01-30 11:47:45 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.tobinsprout.net/ tobin sprout home page]]


Revision [163]

Edited on 2007-01-29 18:05:50 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://forums.fark.com/cgi/fark/comments.pl?IDLink=2572484#c27443690 internet argument!]] (fark.com)


Revision [162]

Edited on 2007-01-29 16:42:41 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.poetrydaily.org/archdate.htm poetrydaily.org archive]]


Revision [161]

Edited on 2007-01-29 13:21:12 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://sonnetmonkeymanuscripts.blogspot.com/ sonnet monkey manuscripts]] (5130824831237278418)


Revision [160]

Edited on 2007-01-25 19:19:33 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.yisongyue.com/shaney/index.php mark v. shaney]] [[http://www.strout.net/python/shaney.py python code]]
Deletions:
[[http://www.yisongyue.com/shaney/index.php mark v. shaney]]


Revision [147]

Edited on 2007-01-25 12:48:57 by KlenwellAdmin [adds lazy sampling]
Additions:
simple php spam filter ([[http://groups.google.com/group/comp.lang.php/msg/3a2c3b085f7d19ec source]]): %%(php) if ( substr_count($string, 'http://') > 1 ) $is_spam = 1; %%
Deletions:
simple php spam filter: %%(php) if ( substr_count($string, 'http://') > 1 ) $is_spam = 1; %% ([[http://groups.google.com/group/comp.lang.php/msg/3a2c3b085f7d19ec source]])


Revision [146]

Edited on 2007-01-25 12:48:22 by KlenwellAdmin [adds lazy sampling]
Additions:
split this expression: **a b | {a} {b|c} d** ([[http://www.phpbuilder.com/board/showthread.php?s=c0850d95d2b286715f8ae2f91d23c06a&p=10739198#post10739198 ex 1]] [[http://www.devnetwork.net/forums/viewtopic.php?t=51706&view=previous&sid=4698979ab287e4ad427517cddd4ec8e5 ex 2]] [[http://72.14.253.104/search?q=cache:H8tM1cTiB-oJ:www.thescripts.com/forum/post16376-6.html+preg_split+%22not+within%22&hl=en&gl=us&ct=clnk&cd=27 ex 3]] [[http://codewalkers.com/forum/index.php?action=displaythread&forum=phpcoding&id=5781&realm=default ex 4]]) **[[http://groups.google.com/group/comp.lang.php/msg/07fa10aed96b2268 solution]]**
Deletions:
split this expression: **a b | {a} {b|c} d** ([[http://www.phpbuilder.com/board/showthread.php?s=c0850d95d2b286715f8ae2f91d23c06a&p=10739198#post10739198 ex 1]] [[http://www.devnetwork.net/forums/viewtopic.php?t=51706&view=previous&sid=4698979ab287e4ad427517cddd4ec8e5 ex 2]] [[http://72.14.253.104/search?q=cache:H8tM1cTiB-oJ:www.thescripts.com/forum/post16376-6.html+preg_split+%22not+within%22&hl=en&gl=us&ct=clnk&cd=27 ex 3]]
[[http://codewalkers.com/forum/index.php?action=displaythread&forum=phpcoding&id=5781&realm=default ex 4]]) **[[http://groups.google.com/group/comp.lang.php/msg/07fa10aed96b2268 solution]]**


Revision [145]

Edited on 2007-01-25 12:48:07 by KlenwellAdmin [adds lazy sampling]
Additions:
[[http://www.yisongyue.com/shaney/index.php mark v. shaney]]
split this expression: **a b | {a} {b|c} d** ([[http://www.phpbuilder.com/board/showthread.php?s=c0850d95d2b286715f8ae2f91d23c06a&p=10739198#post10739198 ex 1]] [[http://www.devnetwork.net/forums/viewtopic.php?t=51706&view=previous&sid=4698979ab287e4ad427517cddd4ec8e5 ex 2]] [[http://72.14.253.104/search?q=cache:H8tM1cTiB-oJ:www.thescripts.com/forum/post16376-6.html+preg_split+%22not+within%22&hl=en&gl=us&ct=clnk&cd=27 ex 3]]
[[http://codewalkers.com/forum/index.php?action=displaythread&forum=phpcoding&id=5781&realm=default ex 4]]) **[[http://groups.google.com/group/comp.lang.php/msg/07fa10aed96b2268 solution]]**
Deletions:
split this expression: **a b | {a} {b|c} d** ([[http://codewalkers.com/forum/index.php?action=displaythread&forum=phpcoding&id=5781&realm=default ex 1]] [[http://www.phpbuilder.com/board/showthread.php?s=c0850d95d2b286715f8ae2f91d23c06a&p=10739198#post10739198 ex 2]] [[http://www.devnetwork.net/forums/viewtopic.php?t=51706&view=previous&sid=4698979ab287e4ad427517cddd4ec8e5 ex 3]] [[http://72.14.253.104/search?q=cache:H8tM1cTiB-oJ:www.thescripts.com/forum/post16376-6.html+preg_split+%22not+within%22&hl=en&gl=us&ct=clnk&cd=27 ex 4]])


Revision [144]

Edited on 2007-01-24 19:39:00 by KlenwellAdmin [adds lazy sampling]
Additions:
split this expression: **a b | {a} {b|c} d** ([[http://codewalkers.com/forum/index.php?action=displaythread&forum=phpcoding&id=5781&realm=default ex 1]] [[http://www.phpbuilder.com/board/showthread.php?s=c0850d95d2b286715f8ae2f91d23c06a&p=10739198#post10739198 ex 2]] [[http://www.devnetwork.net/forums/viewtopic.php?t=51706&view=previous&sid=4698979ab287e4ad427517cddd4ec8e5 ex 3]] [[http://72.14.253.104/search?q=cache:H8tM1cTiB-oJ:www.thescripts.com/forum/post16376-6.html+preg_split+%22not+within%22&hl=en&gl=us&ct=clnk&cd=27 ex 4]])
Deletions:
split this expression: **a b | {a} {b|c} d** ([[http://codewalkers.com/forum/index.php?action=displaythread&forum=phpcoding&id=5781&realm=default ex 1]] [[http://www.phpbuilder.com/board/showthread.php?s=c0850d95d2b286715f8ae2f91d23c06a&p=10739198#post10739198 ex 2]] [[http://www.devnetwork.net/forums/viewtopic.php?t=51706&view=previous&sid=4698979ab287e4ad427517cddd4ec8e5 ex 3]])


Revision [143]

Edited on 2007-01-24 19:34:08 by KlenwellAdmin [adds lazy sampling]
Additions:
split this expression: **a b | {a} {b|c} d** ([[http://codewalkers.com/forum/index.php?action=displaythread&forum=phpcoding&id=5781&realm=default ex 1]] [[http://www.phpbuilder.com/board/showthread.php?s=c0850d95d2b286715f8ae2f91d23c06a&p=10739198#post10739198 ex 2]] [[http://www.devnetwork.net/forums/viewtopic.php?t=51706&view=previous&sid=4698979ab287e4ad427517cddd4ec8e5 ex 3]])
Deletions:
split this expression: **a b | {a} {b|c} d** ([[http://codewalkers.com/forum/index.php?action=displaythread&forum=phpcoding&id=5781&realm=default ex 1]] [[http://www.phpbuilder.com/board/showthread.php?s=c0850d95d2b286715f8ae2f91d23c06a&p=10739198#post10739198 ex 2]])


Revision [142]

Edited on 2007-01-24 19:32:06 by KlenwellAdmin [adds lazy sampling]
Additions:
split this expression: **a b | {a} {b|c} d** ([[http://codewalkers.com/forum/index.php?action=displaythread&forum=phpcoding&id=5781&realm=default ex 1]] [[http://www.phpbuilder.com/board/showthread.php?s=c0850d95d2b286715f8ae2f91d23c06a&p=10739198#post10739198 ex 2]])
Deletions:
split this expression: **a b | {a} {b|c} d** ([[http://codewalkers.com/forum/index.php?action=displaythread&forum=phpcoding&id=5781&realm=default sol 1?]])


Revision [141]

Edited on 2007-01-24 19:00:42 by KlenwellAdmin [adds lazy sampling]
Additions:
split this expression: **a b | {a} {b|c} d** ([[http://codewalkers.com/forum/index.php?action=displaythread&forum=phpcoding&id=5781&realm=default sol 1?]])
Deletions:
split this expression: **a b | {a} {b|c} d**


Revision [140]

Edited on 2007-01-24 18:50:59 by KlenwellAdmin [adds lazy sampling]
Additions:
split this expression: **a b | {a} {b|c} d**
Deletions:
split this expression: *a b | {a} {b|c} d**


Revision [139]

Edited on 2007-01-24 18:50:49 by KlenwellAdmin [adds lazy sampling]
Additions:
split this expression: *a b | {a} {b|c} d**
Deletions:
split this expression: **^SM_GET_PREP() ^BNC_GET_NOUN(1,1) | {prep_phrase} {`and`|`or`} ^SM_GET_PREP() ^BNC_GET_NOUN(1,1)**


Revision [138]

Edited on 2007-01-24 18:42:14 by KlenwellAdmin [adds lazy sampling]
Additions:
split this expression: **^SM_GET_PREP() ^BNC_GET_NOUN(1,1) | {prep_phrase} {`and`|`