Archive for April, 2010

An ignoramus’s look at the p2p cloud

Friday, April 23rd, 2010

For the past four years, I’ve been asking myself, “Why aren’t you working on making a p2p cloud social network thing instead of letting users’ information be in the control of humongous corporations?”  Well, why aren’t I?  Hmm.  Well, anyway, here are what I view as the components to a nice p2p cloud.  Please be charitable and realize that I’m writing this from a position of complete ignorance of a lot of things.

A Source of Personal Identity

One major reason Facebook is scary is that it wants the ability to control your ability to log in to other sites.  You can log in with Facebook connect!  This gives Facebook control over your ability to log in.  It tells Facebook what sites you’re visiting.  It tells other sites about your use of Facebook.  We’d like logging in to be easy, and we’d like it not to happen through Facebook connect, or some similar feature under the control of some other group of shareholders.

A solution might be an “auto-login” feature built into web browsers, and built into the language of the web.  (If this is in HTML 5, I wouldn’t know, and I’m sorry if my ignorance makes you feel that you’re wasting your time reading the blog of somebody who is suddenly ashamed of how ignorant he is of an important upcoming standard.)  If browsers had the ability to say, “Submit user account info,” and submit the information needed to set up a user account in a regular fashion, with a profile picture, a username, and a human name, that would be nice.  It would also be nice if a user could then supply proof that they’re such-and-such user on another site.

Client-side Scriptability

We’d like to be able to safely run programs on client computers.  The web has this with Javascript.  If clients could open requests to things other than the originating web server, that would be nice, too.  If we could open up background apps and have them run in the background, that would be nice.  Having a language that is faster than Basically, we’d need Javascript, but with more power.  There are, of course, issues with this — we don’t want folks to be able to send viruses around.  Yeah, there are issues to figure out.  Anyway, this is a nature of the p2p cloud that web browsers have partially implemented.  I need to study my HTML 5.

Firewall Busting

We need some Skype-like thing that lets clients connect to one another by punching through firewalls.  Essentially, we need some kind of “Magic Socket Service,” that figures out some way to route data from one client to another.  You might also need some way to identify which peer you’d want to talk to, which we might have talked about above.  We might also need some flexible, adaptive ways of pretending to communicate under the pretense of existing protocols, depending on how firewalls are these days and in the future.

A Lookup Table

A p2p cloud would need a lookup table.  You’d need a mechanism for “pointing at resources.”  It would be nice if the elements of the table were immutable.  Take Tahoe-LAFS or some similar thing, minus any pretense of encryption, and that would be part of the deal.  Of course, an http URL is a valid thing that can be looked up.  Do you the person controlling the http server to be able to modify the contents of the value there?  Maybe you want some kind of “http url plus a series of hashes of successive prefixes of the content attached,” so that clients can try the server first, but then fall back to the peer-to-peer lookup table.

A Way to Transfer Personal Identity Between Computers

One problem with making a secure version of Dropbox (secure in the Tarsnap sense) is that you need a way for multiple computers to access the same data.  You need two computers to be able to securely say, “I am the same John Smith.”   Generally speaking, this can either be done by having some central service that controls your identity, where you log in using a password, or it can be done by moving secret keys (or whatever) through the sneakernet.  You can’t just email the secret keys or send them on some TLS socket without trusting some central authority.  Maybe you can verify key fingerprints, or something, I’m not a pro cryptography engineer, but whatever you do, to actually be secure about this would require some knowledge and self-protection on the user’s behalf.

And remember that client computers are generally much more insecure than some central server.  Who do you trust more to manage your grandma’s ability to log in to places: Facebook, or your grandma’s computer?  Unless your grandma doesn’t download any malware and uses a perfectly secure operating system, I’d say the probability of grandma having her credentials stolen is way higher than the probability of Facebook being evil about your ability to log in to places.  Of course, the malware could grab granny’s Facebook credentials anyway.  What can you do?

So, let’s put security aside.  We need some way to transfer identity between computers.  Maybe, for some users, that involves being ultra-paranoid and walking flash drives around.  And for other users, they can just type a password.

The Synchronization of State Between Computers

Along with personal identity comes the need to copy other information.  For example, recently I’ve been working on an iPhone Hacker News reader that keeps track of which posts you’ve read and highlights unread posts.  The one problem with that app is that, once you get home, you do your browsing on your regular computer, and any browsing you do on the different devices is unknown to one another.  We need some way for the state of the app to be shared, so that you get a smooth experience across computers.  One way is for the centralized server to have the feature of keeping track of unread posts.  Some forums have this feature.  Since we’re generally working in a decentralized environment, however, we don’t have that option.  We’d like applications to be written to live on multiple devices, to have little sense of an individual computer.  And we’d like to do it seamlessly.  Hahahahaha!  I bet there are some old codgers laughing at my naivety for suggesting that this could ever be done without creating an overcomplicated disaster.  Anyway, this sharing mechanism might be done over the lookup table mentioned above, or it might be done through a more optimized mechanism.  Or maybe it’s just the case the lookup table has features built in that makes it efficient for computers to find other computers interested in the same information, instead of being a completely dumb key-value store.  It really depends on how you define the boundaries between different things.

So maybe we want something fancier than a mere lookup table.

A Standard Library of p2p Social Networking Interfaces

If you have stuff like this, you could implement a peer-to-peer social network.  So we’d want a set of standard interfaces, for doing common ways of sharing information.  We’d want a standard way to represent data structures amid the p2p lookup table, and we’d want standard ways for updating and mutating values, and a whole bunch of other fun stuff.  But then, some applications might have problems of synchronization and maintaining coherent state.

So maybe we want something fancier than a mere lookup table.

An Anonymity Network

I don’t think the p2p cloud would be an anonymity network, but it would be nice if you could be anonymous.  Or at least somewhat anonymous.

So.

So you’ll notice that these features don’t need to be intertwined into one magic platform.  Really, if you just added these features one-by-one, you’d find a good improvement to the state of the web.  And, you know, a lot of these exist already, in some form or another.

Update! Fib has told me to read cortesi and DesktopCouch and told me the post is 100% fluff and reads as “you know what would be awesome” and “I haven’t done any research at all.”  All of that is correct, obviously.

A New Project

Thursday, April 22nd, 2010

I’ve started working on a new app, this one being an app designed to build one’s skills with basic arithmetic problems, like addition, subtraction, rationalization, complex multiplication, factoring, prime factorization, etcetera.  I’m wondering how one would go making this an enjoyable app to use.

My sleeping schedule, despite a much, much, much lower rate of Coca-Cola consumption, has been pushed to the point where I can’t sleep before dawn.  I’m going to push the schedule a day forward.  We’ll see if I get a car tomorrow.

Getting Snow Leopard

Thursday, April 22nd, 2010

I’m basically finished the Hacker News app, but in order to test it on my phone, I need to get Snow Leopard, which costs $29.99.  Okay then.  I don’t want to order it from the Apple site, because then I’d have to pay for shipping.  There’s an Apple store within driving distance, so I could get it there.  But I don’t have a car.  So I think I’m going to finally get a car, instead of being incapable of going places.

I got my first instance where an HTML change caused my fragile code to fail to parse.  I’ve reimplemented my code so that it doesn’t wait for unnecessary milestones that it could gracefully skip.  If the way in which the milestones get recognized changes, then certain features of the reader regarding styling or voting would be lost, until the app got updated.  This is better than complete immediate failure.

Also, I got word break insertion going.

UIWebView, NSURLProtocol

Thursday, April 15th, 2010

For a while I was thinking about how I was going to display comments for my little HN newsreader, while having convenience and support for the things I want to make convenient. But what a fool I am! Why not do the following:

1. Create a new NSURLProtocol with the prefix “hn:” whose responses get passed through a content-annotating proxy.
2. Point a UIWebView at <hn://news.ycombinator.com/>. Note the scheme.

Done!

And now the problem is reduced to something I’m comfortable with: manipulating streams of bytes :-)

Past tense of alloc

Wednesday, April 14th, 2010

Suppose you do this:

    [NSString alloc]

Did you alloc an NSString? Yes, you did. You “alloced” the string? Or is it that you “allocked” the string?

I think allocked is the past tense form of alloc. Otherwise, you’d be pronouncing the word “allo-sed,” which would be dumb.

Also, mallocked and callocked and reallocked.

Tribes – Legacy

Tuesday, April 13th, 2010

EYE

Tuesday, April 13th, 2010

It’s really annoying on the internet when you want to be a flagrantly egotistical person and talk about YOUR opinion and what YOU think about things. And the reason that is so is that you have to talk about not what “YOU” think about things, but what “I” think about things.

And since “I” is already capitalized, you can’t shout it. You have to emphasize it through other means. Italicizing it doesn’t really help, since it’s a single letter, and embolding it doesn’t really work either, it just makes it look like some kind of monolith from Space Odyssey 2000. You can’t give it external underscores or asterisks, as in _I_ or *I*, because the former looks like a perpendicular or “bottom” symbol and the latter looks like some kind of mechanical diagram with gears and such. You can’t use /I/ either, because that’s sort of like a l33t-speek N.

So, what do you do? What do you do?

Perhaps you should say “EYE” to shout the word “I”. Well EYE think that’s a horrible idea. Aye. Maybe we should adopt the practice of using lowercase “eye” in place of “I” or “i” when chatting in IRC. When people ask why, you could point them to this blog post. Make a link.

A brief excursion

Saturday, April 10th, 2010

I hate to pre-announce what I’m doing, but in the spirit of regular blogging, I’ll tell you that right now I’m working on a free Hacker News iPhone app. There are two non-free apps that cost $2.99. So instead, I’m making a free one. And maybe it will be open source.

This somewhat ties into the other project I’m working on. It’s sort of a practice project.

in-labeled-groups

Thursday, April 8th, 2010

So I found myself needing to group a sequence by two different ways of grouping it without iterating through it multiple times.

;; (in-labeled-groups `((a . ,f) (b . ,g)) seq) returns a sequence that's the
;; interleaving of (in-map (curry cons 'a) (in-groups f seq)) and (in-map
;; (curry cons 'b) (in-groups g seq)), except that seq is only consumed once.
;; (Mapping and grouping separately would try to consume the sequence twice,
;; which doesn't actually work.)  This can be generalized to any number of
;; labeled predicates, of course.
;;
;; (sequence->list (in-labeled-groups `((eq . ,equal?) (lte . ,<=)) '(1 2 2 2 3 2 2 3 4 5)))
;; ((eq 1)
;;  (eq 2 2 2)
;;  (eq 3)
;;  (lte 1 2 2 2 3)
;;  (eq 2 2)
;;  (eq 3)
;;  (eq 4)
;;  (eq 5)
;;  (lte 2 2 3 4 5))
(define (in-labeled-groups binary-pred-assocs seq)
  (in-once (let-values ([(has-next? next!) (sequence-generate seq)])
             (when (has-next?)
               (let loop ([current-lists-reversed (let ([x (next!)])
                                                    (make-list (length binary-pred-assocs) (list x)))])
                 (if (has-next?)
                     (let ([next (next!)])
                       (loop (for/list ([reversed-group current-lists-reversed]
                                        [labeled-binary-pred binary-pred-assocs])
                               (if ((cdr labeled-binary-pred) (car reversed-group) next)
                                   (cons next reversed-group)
                                   (begin
                                     (yield (cons (car labeled-binary-pred) (reverse reversed-group)))
                                     (list next))))))
                     (for ([reversed-group current-lists-reversed]
                           [labeled-binary-pred binary-pred-assocs])
                       (yield (cons (car labeled-binary-pred) (reverse reversed-group))))))))))

So that was very ugly.

One nice thing about this function is that it’s an example of one where I’d feel pretty uncomfortable writing it in Haskell. What would its type signature be? How convenient would it be to use? This implementation here scales well with respect to the number of ways in which I’m grouping the sequence, since it’s just another label.

One question is: how am I going to like splitting the sequence of groups up later? I’m starting to feel the call of reactive programming. How good is PLT Scheme at having lots of tiny threads? I might need to look into that. I’m having one of those moments where you recognize threads as a tool for making cleaner code, instead of as a tool for doing two things at the same time. But this is a moment of insanity.

Holy Moley There’s So Much Stuff To Learn

Wednesday, April 7th, 2010

Every once in a while, I realize that there’s so much stuff I need to learn.  I need to learn how to generate code for the x86 instruction set.  How to make music on the computer.  How to do computational geometry.  Materials science.  Quantum physics.  How can I not know quantum physics?  Honestly, I barely even know multivariable calculus.  And I’m not comfortable with tensors.  I never have been!

I’m terrible at learning, but I’m good at remembering.

There’s just so much stuff I haven’t learned.  The only math I know is the kind useful for high school math contests.  I really know my 30-60-90 triangles and will never forget them.  I’m good at thinking carefully under brief spurts of high pressure not lasting more than 3 hours.  However, I’ve lately been developing into a panic because of how little I know, and how little I’ve learned, despite meaning to learn it for several years.

When I look at my interests, there is the difference between what I want my interests to be versus what they are.  In my 6th semester of college, I took a lighter courseload so that I could spend more time on personal projects.  And what did I do?  I muddled around with Haskell.  But what I wanted to do was to muddle around with math and compilers.  But I didn’t!  I muddled around with type systems.  Blah!

I barely know how to write software.  Oh hey, I want to make a software project…. and how do I do that?  I worked for 1.5 years as a programmer and I’m still fuddling along, going at a snail’s pace.  Why don’t I have the energy for this?

Do I need more exercise?  I’m going to go out and exercise right now.  I’ll be right back.  And then we’ll see how my attitude has changed.

Well!  It’s amazing how far you can run when you haven’t run for the past week and a half and you have all that stamina built up.  It’s amazing how much heavier you feel when you’ve been eating a fair bit in that period of time.  Well I’m going to take a quick shower.  And then we’ll see how my attitude has changed.

What I’ve found is that when exercising, particularly when running, that after exercising, my thoughts tend to get scattered and that they tend to go testing themselves in all sorts of different tangents.  It’s as if all sorts of different whimsical departments of the brain have all gotten reactivated and decided to call up the center of consciousness and decided to tell it what it might want to think about.  And then the center of consciousness has to cut them off and listen to other upshoots of ideas, and then cut them off.

While running, I started to think about what causes me to have opinions about things and what causes certain opinions to be written down.  You see, back when I was a teenager (I’m 23 now), I used to freely publish my opinions online.  But then, as I turned 17 or 18, I started to notice that I wasn’t a fan of my previous opinions, because my opinions had changed.  They had gotten older and more mature.  And so I got a sort of Vulcan-like persona online.  I became all logical and restricted my thoughts to matters of fact.  You see, I couldn’t leak dumb thoughts online that my older and more mature self would feel embarrassed about, when it remembers their leakage in the future.  But then, later, I felt embarrassed about how I had somewhat bottled my online self up in the past, and how this must have been a mark of immaturity, or something, and so I spent some time feeling that way.  And lately, with this blog, I’ve decided to become unbottled, and reveal my true opinions.

But what are my true opinions?  What does that even mean?  Presumably, it means that somewhere inside myself, there’s a person that has opinions, and that I just have suppressed them and have decided not to leak them.  And so my “outer” layer of consciousness has operated under the rules of, “take the inner consciousness’s opinions, and filter them.”  Lately, with this latest blog, though, have I simply let the inner consciousness’s opinions out, or have I encouraged the inner consciousness to develop ridiculous opinions and let those out?  Or has my outer consciousness decided to embellish the inner consciousness’s opinions and satirize them to an absurd extent, and write those down?

I’ve recognized, in the act of writing this blog, that to some extent, this blog has been a satire of why my true opinions are.  (And there we are back again to that central question: what are my “true” opinions?  When I’ve just drank a lot of soda, I resolve to drink only tea.  When I have refrained from soda for a while, I feel that one or two or six sodas would be a tolerable indulgence.  What is my true opinion?)  That is, I recognized, as I wrote the opinions down, that they are to some extent a satire of what my true opinions are.  Or are they a satire of what I imagined my true opinions to be?

The trouble with having opinions and memories of opinions is that you can never really tell what the true cause of your opinions are.  Often, when you come up with opinions or reasons for your opinions, you’re just telling yourself rationalizations for why you have certain opinions.  Or at least I think that’s the case for you — I know it’s the case for me, and since you seem to be human, I’m assuming you’re similar to me.  For example, when deciding not to go to grad school, I came up with all sorts of rationalizations.  And I don’t know which are the real ones.  If any of them are real.

So, when talking about the notion of “true opinion,” I mentioned that there might be some “inner consciousness” that had opinions on things.  And I mentioned that when cooling down after exercise, all sorts of departments in the brain would chime in to the center of consciousness about things they’d like to blog about.

What I’d like to know is: how do the different departments of the brain know that it’s time to think about certain things?  Like what to blog about?  It seems to me like the center of consciousness sort of broadcasts to other parts of the brain “Hey, I’m thinking about this, would you please send me ideas if you have them?”  And then the other parts respond.  Some parts are particularly specialized.  Reading, writing, face recognition, are fairly well-hardwired.  Back in high school, when I was spending a lot of time with RPN calculators, I got really good at mentally simplifying complex expressions, because I would just keep a stack of numbers in my head and pipe the argument through some parellized RPN version of the expression I was evaluating, or some near-RPN version that was more like a direct expression tree computed in parallel.  I have definite memories of deciding to compute x*(y+z) into x*y + x*z in parallel, rather than sequentially.  So anyway my point is that the brain obviously does stuff in parallel, and we can learn to do multiple things at the same time, like piping numbers through equations while listening to and parsing the words of a person speaking and pushing a buzzer.

And it seems to me like that if there’s an “inner consciousness,” located somewhere in my brain, that has its own opinions of things that my “outer consciousness” filters or exaggerates or whatever, then there’s a separate center of consciousness operating there.  And so there’s a person there — a mind! — that would like to do and say things and that always gets frustrated because its opinions and decisions never get acted upon.

And I think I’m that mind, and that there’s some outer center of consciousness that filters things.  And I think the outer center of consciousness, and me, the inner center of consciousness, both can manipulate memory.  And so the inner and outer centers of consciousness, looking back on their own memories, think that it’s their decisions that caused them to do the things they did.  And so they have no direct evidence of one another.  So there’s no way to tell whether your mind is the inner or outer center of consciousness.  They are only slightly out of synchronization.  So my decision that “I’m the inner center of consciousness” is a complete contrivance of opinion, and isn’t based on any observation.  And of course, the outer center of consciousness has let this opinion through, and so apparently it thinks it’s the inner center of consciousness.  Or maybe the outer consciousness decided that it would add this sentence about a complete contrivance of opinion.  Or maybe the inner center of consciousness managed to flip the controls and outmuster the outer.  I of course can only remember having thought of writing that, since my memories are mixed in with the other center of consciousness.

And of course, why are there only two?  If anything, there should be as many centers of consciousness as there are points in space.  Each of them is a product of an infinitesimal neighborhood of the brain receiving and sending information.  Some are smarter or duller than others, and all of them have a separate center of consciousness, or “mind,” arising out of them.  And so there are minds formed everywhere in the brain that all have opinions on things, and some of them are minds formed out of parts of the brain that get to control things, and maybe others are minds formed out of parts of the brain that are dead ends.  That are mostly overlooked.  That don’t really matter.  And so you get minds that have opinions on what to do but then immediately forget that they had such an opinion (since new information is coming in that didn’t depend on the production of that opinion) and then have new irrelevant opinions.

So there’s a good chance that my mind is completely irrelevant, and that there’s a mind a micron away that is really the master of everything.   But what about these memories?  If the same memories of thought are getting pumped through every part of the brain, it seems like every center of consciousness would end up being more or less equals.  Since they’re all mixed together, they’re virtually identical.  Of course, many parts of the brain do specialized things.  So it seems like they would have separate, duller centers of consciousness.  Somewhere there’s a 3D imagination center of the brain that imagines 3D things and calculates accelerations and frisbee trajectories.  It has a jolly good time, when it gets some use, and doesn’t concern itself with worldly problems.

Well, I hope you enjoyed this silly blog post.  It’s stuff like this that makes me a panprotoexperientialist.