hackysack with generators!
I've re-written an example of a simple program included in the new Stackless Python Tutorial (see Chapter 4) to use generators for task switching between multiple processes in plain python. The example in the tutorial was written once using threads and once using Stackless. My version uses neither and relies only on the included random library module and generators (the yield statement) which are built in to standard CPython (as of 2.4.3).
The code performs the same tasks as the given examples and does it way quicker than the threaded version but about half as fast as stackless. Most of the time spent is in preparing the micro threads. With 10000 processes, it takes almost as long to play a game of 10 turns as a game of 1000 turns. I've been working on it away from my home machine, so I haven't had access to the beautiful top (linux command line based system monitor) and I'm not able to see what the memory usage is, but I'm guessing if I didn't use classes, it'd be smaller. My goal (for tomorrow) is to move over to a functional implementation and see how that pans out.
I'm psyched because I'm actually starting to get some of the concurrency related concepts I hear thrown around at the higher levels. Things like switching, blocking, starvation, and continuations are kind of making sense. In the next few days I also hope together some "what did I learn?" type of thoughts on a separate projects page. Way way in the future I'll be applying some of this "micro-threads-with-generators" stuff to a kinda functional python web server I'm noodling with.
current version: haystack.py
last updated 1 year ago # history
Another Simple Wiki
I've posted a link to my simple wiki engine on the web.py wiki and my programming projects page.
Originally I was using a tool I'd written that took up three or four files and about 400 lines of code. I got sick of browsing through all that to make simple changes so I wanted to see how tight I could get, while not skimping on my favorite features. The result is less than 75 lines of my own code and two simple templates, rather than 300+ lines and at least 4 templates. 80% of the features are still in and I've even managed to add some nice text preprocessing.
It's VERY easy to create and edit pages, and very easy to link and combine them in interesting ways. The include feature was a recent addition, taken from infogami's own page includes.
I've learned a ton about regular expressions and simplifying code so I figure it's been well worth it to create my own wiki. Web.py worries about the web, all I have to worry about is function.
Inspirations include infogami, the first web.py simple wiki, and TinyWiki, a one hundred line perl based wiki. My goal is not to stick to a certian size, and certianly not to re-write TinyWiki. I want to have a tool I can KNOW. Something I've made that I can actually use. For me, this is a much bigger programming step than just creating something that WORKS. It's useful, it has actual utility. Some efficiency friendly text-editing would be nice, but isn't really neccessary. I can track information, create documents, and "think out loud" without having to worry about files, archives and text-editors. Everything I need is in the browser.
In less than 80 lines I have something that is useful and I enjoy using, and that's more inspiring to me than all the programming puzzles in the world.
last updated 2 years ago # history
moves
How do we decide where we want to live?
We have to first ask what it is we are looking for.
- FUN is a valuable feature of location, but fun will fade.
- People are a good reason to move to or from a place but people go away.
- Job is a decent reason,even though jobs lose their glamour.
Well Adam is there any good reason? Maybe not, maybe that's the point. My location is transient and the things I will experience in this life are transient, it's not really deeply important where my life happens.
last updated 3 years ago # history
works now?
I left off the .value attribute of the "username" field when changing the form's "action" attribute. Fixed it, works now, eat it up.
last updated 3 years ago # history
another test?
Yeah, not accessible, but custom forms would be nice.
Previews don't really work (it'll need to parse at least basic markdown in javascript) and it's NOT accessible since there are no labels. So it's really just my "learn javascript" toy. The form won't submit right unless I plug a specific address into the action attribute of the form element (ex. http://foobar.infogami.com/_edit/blog/_add ) but other than those little issues, not bad for a first gadget. Maybe someone with more design sense could slap some pretty on it and make something useful? Whatev, the default is pretty nice, and the preview already works with markdown.
last updated 3 years ago # history
This was posted from elsewhere.
If I can create my own forms, maybe I can make them prettier?
last updated 3 years ago # history
Why do you work so hard?
email to author of "Why do you work so hard?":
Mark,
I really appreciate the article, it helps my optimism to know there's more in store for my life than 9 to 5 + overtime--once I've finished school, finished having kids, found the better job, .... It hurts to see my peers (20 - 30 yrs) positioning themselves for a secure retirement (35 years from now!) at the cost of sadness, stress and familial neglect right now.
My wife and I are intending to unschool our 2 (or more) in a big part to keep them free to think and work however they choose. I think a lot of other homeschoolers are catching on as well. There's hope for giving kids a chance at finding their own way; I believe they'll do a lot better than I did if they're never told how to do it.
To grow up without believing grades and achievement matter...? My son is one year old, and knowing what's in store--the possiblities, the time to persue, the freedom to choose--I am humbled and intimidated by what he could do someday. Maybe that's the optimism of a parent rambling, but it'd be nice if it's not.
thanks for your words,
Adam Bachman Baltimore, MD
I responded because I felt like it, because I'm kind of finding that it's fun to respond to things.
I did leave out an important part of my unschooling philosophy stump speech, however. We're concerned about our kids' life--how they will grow up, who they will grow to be--but our concern for them is bigger than that. Society likes achievement; measurable, gradeable acheivement. We don't really care about acheivement in the same way. I don't care if my son learns to read early, I don't care if he gets a high paying job, and I especially don't care whether he's smarter than everyone or not. I do care about his heart, though. I care about his ability to love. I care most about helping him understand that he is loved by a lot of people. There is more to life than doing stuff well. All the works in the world will impress your friends and neighboors, but they won't get you any closer to eternal love.
We intend to raise our kids in a Christian household. This doesn't include indoctrination and infliction of punishment and fear, just the opposite, in fact. There is no part of my faith that will transfer unchanged from inside of me to inside my kids. That's true for anyone looking to pass on any piece of themselves, I think. There are things like laws, and the actual words used that should remain the same but these are concrete. What I'm talking about is the abstract part of faith. The best I can do, I think, is tell my children as often as I can that they are loved and show them the same through my words and actions.
Our Father loves us and has provided more than we could ever need. The author of the article recognized that much, even if he didn't recognize it in all the same ways as me. Through His Son, I believe he provided for me beyond this life. That's worth more than all the homeschooler braniac points in the world if my son "gets it".
last updated 3 years ago # history
reddit does homeschooling
I've been browsing homeschooling / education articles on reddit so they're starting to show more frequently in my rankings.
There's an interesting discussion going at reddit in regards to a John Taylor Gatto article, "The Psycopathic School" from Dumbing Us Down. Interesting to me, anyways. The atmosphere is ripening for unschooling and homeschooling to make a huge difference. The smart are joining the conservative in recognizing that school is not "doing the right thing" by our kids.
What better way to raise a geek than to give your child the freedom to learn what they want, when they want?
There are a lot of people who "got their education" and are now just burning up their lives, hoping and waiting for retirement to come quicker. Is this the fulfillment of the promise of schooling? No, thanks, I'll take door number two.
If by unschooling my kids I let them taste freedom for a few years, and they end up serving burgers in a McDonald's somewhere, have I done worse than anyone who gives the system control of their child's mind? There are too few people in our generation who don't carry the taint of institutionalized thought. For me, homeschooling is NOT about making sure my kids believe what I want them to belive. It's more about making sure the state doesn't have the chance to tell them what they have to believe.
There is no standard body of knowledge anyone needs just to live. Sure there's things like hygine, anger management and basic morality (do unto others...) but if those aren't imparted in childhood, you've got more problems than what level of math they're at. Schools excercise their authority by making sure they determine what everyone--regardless of gender, class, race, religion, etc--needs to know, and then pushing all people through the steps of learning those things. I truly believe that if my child wants to be a carpenter, they don't need to have read "To Kill A Mockingbird". It's a good book, and I hope they'll want to read it, but they will not be less of a citizen because they haven't.
Once we can get over the belief that we can make a list of everything a person "needs to know" we can accept that maybe, just maybe, by giving our children the freedom to grow we'll give them more of what they need than any school.
UPDATE: Continued discussion
ntoshev: I think a not-for-profit community effort similar to Wikipedia has better odds to change things for good.
adbachman: Why do we need something similar to Wikipedia when we already have wikipedia?
All the info is there, searchable and accessible, for anyone who wants it. The change away from institutions is already happening in the way the web has opened communication between people who have information and people who want/need it.
ntoshev: While I like Wikipedia and I think it is already helpful, it follows the format of encyclopedia. A textbook is different in that it presents related concepts from a certain field in a linear way, ordered to be easy to understand without prior knowledge, and ensuring certain coverage of that field.
Maybe this can be achieved if Wikipedia is augmented with "learning guides".
right on, I was just having a conversation about this yesterday.
The big step from top-down education to bottom-up learning (learner directed) I think comes in the difference between curriculums and courses of study.
The way I define it, a curriculum says, "you must know these pieces of information and you must learn them in this order using this learning style". A course of study, on the other hand, says, "so you'd like to know about (c)? Well, to get there you should learn about (a) and (b)."
I also think of it like: a year in public school follows a curriculum, a jagged line tracing subject matter vs. time, whereas a "course of study" is an ideal college career in which I touch many subjects but on the way to something concrete. Many colleges though, have fallen back on curriculums and are now a list of check boxes that have to be filled in before receiving a diploma (see Teacher ed. for an extreme example).
"Learning guides" could turn wikipedia into an incredibly powerful tool for self-directed learning. A community dedicated to providing them wouldn't be too hard to create, either, most interesting careers have some form of guide floating around already. The hard work is distilling the guides and pruning the generalities. It doesn't have much of a buisness model, but does helping people really need a business model?
Thinking smaller, nobody can walk up to a school and say, "I want to be a biologist" and have someone lead them down the path to biology. Every step we take in learning, whether in school or on our own, is in chunks. That's what wikipedia (and the web in general) already does very well: provide the chunks and the connections between them. If my children want to become actors, I don't need to know every step they'll have to take right now, I just need to know that an actor has to be able to read, so we work on that. Maybe tomorrow we'll get to stage directions, but right now, where we go in the next five weeks isn't critical.
last updated 3 years ago # history
John Holt Quote
from Instead of Education:
In this book I feel myself speaking mostly to that minority of people, including parents, teachers, would-be teachers, and students themselves, who believe that children (like all people) will live better, learn more, and grow more able to cope with the world if they are not constantly bribed, wheedled, bullied, threatened, humiliated, and hurt; if they are not set endlessly against each other in a race which all but a few must lose; if they are not constantly made to feel incompetent, stupid, untrustworthy, guilty, fearful, and ashamed; if their interests, concerns, and enthusiasms are not ignored or scorned; and if instead they are allowed, encouraged, and (if they wish) helped to work with and help each other, to learn from each other, and to think, talk, write, and read abnout the things that most excite and interest them. In short, if they are able to explore the world in their own way, and in as many areas as possible direct and control their own lives.
last updated 3 years ago # history
Do Blogs Hinder Learning?
Thanks bloggers, I really appreciate the writing you've done and the links you've posted. I've heard interesting words from a lot of interesting folks, but it's time to step back.
In time I'll return and read what you've got to say, but for now I'm going to head off on my own. You've taught me a lot about what it means to stay interested and never stop learning, but it's getting too hard to filter signal from noise and I can't tell whether I'm getting anything out of it.
Peace,
Adam
It's time to make a change. But what does change mean for a serial reader?
When we read what others have written we can begin to think we understand. Enough articles and enough time to read them and maybe I can understand everything. That's obviously not true, so maybe I should narrow my focus. I'll only read articles that address topics I'm interested in. The nature of feeds says I have to sift unless I search, so that . The nature of search says I have to know part of what I want before I can find it, destroying spontaneity.
Essentially, to answer a very simple question about the Erlang source code, I now have to spend who knows how many hours becoming familiar with the guts of Erlang's runtime. And while that's kind of fun, it isn't helping me get Couch built. It's a big distraction.
"Typical Open Source Software Moment", Damien Katz Link
How often have I started digging a hole I couldn't fill? How often have I started a journey I didn't finish? How will removing distractions contribute to improvements in productivity? What's the first step?
notes: essays instead of posts. simplify development. reduce the ground noise.
last updated 3 years ago # history
a first post.
Questions:
- There's a lot of things you could do, but are you ready to do any of them?
What do you mean, "are you ready"? Of course I'm ready; I went to school, I got my degree, there's nothing stopping me. Here, I can prove it, I'm certified. Expert, is what that rubber stamp says. Now you know you can trust me.
- There's a lot of things you want to do, but is there time for it?
Time, who needs it. I'm doing as much as I want right now. I'll have plenty of time to have fun when I retire at 45.
- If everyone's involved, is everyone responsible?
Hell no, I'm not responsible. I'm not responsible for this stuff here and I'm certianly not responsible for them other people.
- What's next? The market's ready for another mash-up like it's ready for another...
What differentiates? Why would you aim at an ever dwindling percentage of the geeky? How can this be brought to the next circle out on the target? Who will be your advocate, your warrior? Find your people and reach them. Bring hope along with you.
"Giving users the freedom to use data and services they way they want gives them a sense of ownership and freedom that few companies offer. It helps to build some of the most loyal, passionate, and vocal supporters. And some of them will put your data to work in ways you never dreamed of." - Zawodny
"Don't ever put yourself in the position where you can take from these men." - Band of Brothers

