Categories
Life Thinking

The Lean Startup of Me

Recently I have read Eric Ries’ The Lean Startup, and it got me thinking on multiple levels. It had so many interesting insights and counter-intuitive results, that it really inspired me to take a good look at so many things I’ve been doing. I’m not running a startup (yet) by the common definition as in running a company, but take a look at his definition:

A startup is a human institution designed to deliver a new product or service under conditions of extreme uncertainty.

First, this pretty much applies to the physics lab I’m working in as a post-doc at the moment: team, uncertainty, novelty. Most definitely have to take a big look how can I that group better using the lean lessons (in another post).

On the other hand, could this definition apply to quite different but just as important thing: myself? I do aim at creating something new, making a person like no-one else in the history; I am extremely uncertain; and I’m a human as well (though not sure how many humans one needs for an “institution”).

The Lean Startup book cover
The Lean Startup book cover

Could these lessons somehow adapted to one’s own development as a person? Can the observations be far-fetching enough to encompass this much?

Startup lessions applied to a person

Here I’ll be picking out some points that stood out for me, and see if I can use them to be more successful – whatever that means (getting there in a minute).

Stop wasting people’s time

This is probably the number one thing he brought up. Stop wasting people’s – and your own – precious time. Don’t build a product that nobody wants (if you are a company), don’t make things unnecessarily troublesome for others. If discussing something, get to the point. If want something, use your voice. Don’t promise something then underdeliver. Make things transparent, whether it’s about good or bad things, since then others can make up their own mind with complete information and minimal distortion.

Make it clear to others that you expect the same from them as well.

When it is about myself, I should really figure out what is wasting time, and what is valuable. It is not always obvious, playing games, reading, watching a movie, checking things on the ‘net, writing emails can be just as much be a growing experience as total, utter timesink. I know already I have a lot of timesinks, now have to eliminate them so I can spend more time with the things I value. But it’s only me who can decide it, since everyone’s values are different.

I do feel that if there’s only one advice from the book to take, this would be it.

Learning

The second major thing that got to me, that the aim of the startup is actually learning. One has to learn what are the good things to do, how to handle different situations, what do people react positively, or even just how people react to different changes one makes in the startup setting. Success is then the amount of validated learning.

But this is the same thing for people: I should set up hypotheses, and learn about them, try to prove and disprove the fastest way possible, so I can improve my attitude and behaviour towards the world. By gaining more understanding, success is then now all that knowledge that I can put to use to achieve the goals I’ve set out to reach.

This learning for myself can be very many, all different kinds of stuff:

  • Could waking up earlier make me more productive during the day?
  • How can I make myself wake up ealier if I constantly oversleep 5 alarm clocks?
  • How to work together with people with the least amount of effort?
  • What is the setting I can enjoy my books the most?
  • What steps to take to become a better writer?
  • Would I improve my work environment if I applied some lean principles to our lab?
  • What’s the best way to start new projects?
  • Would delegating in some important side projects make them work better?
  • What techniques work best for me to learn new languages?
  • Would running, swimming, cycling, hiking or something else make me feel (and be) healthier?

These are not all good questions, not all actionable ones. Just all the things that I have brainstormed here, but it’s a start. Would have to take actual things to try and learn from. There are plenty of questions. Now just take the time to formulate plans and learning goals.

How to measure success

This is connected to the learning goals, in a way, that I would have to have some meaningful metrics whether I’m getting closer or not. The idea of “vanity metrics” and “actionable metrics” from the book are really fundamental things as well – way too easy to get useless (and even worse: misleading) vanity metrics of a process (such as total visitor count for a website) instead of actionable metrics (like income from products that didn’t exist in the company X years ago).

This is much harder to apply to people, as a person’s learning goals are probably more qualitative than quantitative, and quantitative things could feel quite awkward or unusual. But still:

  • How big part of  income is from projects that I have started in the last X years?
  • What fraction of my projects are still alive (even if not managed by me) after X years?
  • What fraction of people I worked together with started their projects on their own?
  • How big part of my communication is with my important long term friends? How many is with new friends? How big portion of my new friends are dropping out of touch within a year?
  • What fraction of books I’ve read inspired me in one way or another?
  • What fraction of new places I’ve visited, within the country or abroad, are such that I’ve haven’t heard about them X years ago?
  • How many new techniques, tools, languages I know and could use / use regularly that I couldn’t X years ago?
  • What fraction of ideas I come up with I could turn into working projects?
  • What fraction of my expenses I consider “well spent”?
This X years ago seems to be a convenient shortcut (also taken from the book), and there might be a better way of looking at things, though since we are talking about temporal change (getting better over time), it might be a good one.

5 Whys

The 5 whys is a very powerful management technique to figure out the root causes of things: whenever something bad happens, ask (and figure out) what was the immediate cause (the first why), then figure out the cause of that (the second), and go back at least 5 layers until you get to the root cause. Here’s an explanation video by Eric Ries how to use that in the startup setting.

It is useful to see beyond the obvious and fix the real issues. Can guide what should one put effort into, and how much. This technique would work right away with myself:

  • “I’ve broken an expensive PC card in the lab” (true story)
  • Why? – I connected the power supply wrong
  • Why? – I had a fleeting thought that it might not work, but didn’t pay enough attention
  • Why? – I was too sleepy that day
  • Why? – Stayed up too late for too many days in a row
  • Why? – Been on Facebook, checking things out

Here you go: cut down on Facebook, sleep better, don’t do anything critical when tired, do stop to think even if I know what should be done, and finally get my electronics knowledge in shape (and check out that power supply).

Outlook

Of course I wasn’t the only one coming up with similar ideas, there’s also for example The Startup of You, that seem to be a bit more focused how you achieve a startup, instead of the things I mentioned here of how to be a better/more successful person using the lean startup principles. Still there might be plenty to learn there. And here’s an infographic about that from Imagethink (picture #2 on their site).

Infographics
The Start-up of You from http://imagethink.net

All in all, I want to see how this works out in the long run. Will definitely be a lot of work, but there’s so much to gain, that it worth it. One doesn’t become an Elon Musk, a Salman Khan, Richard Branson or Richard Feynman by sitting around.

And to get there, you can leave me some useful or useless advice in the comments.

 

Categories
Computers Startups

A different smart dressing up

I was out with a few friends the other day, they were forming a team to go to StartupWeekend Taiwan Hardware next month. I have been to one or two previous StartupWeeekends and they are good fun. Haven’t made up my mind about the hardware one, but since they asked me could they prepare for it, since it’s their first experience, I did try to gather some advice. Not sure how better they are off with it, but I hope at least a little. Looking at the previous events, a little bit of experience and knowledge can put people way ahead, because Taiwan is just learning startups, every experience is golden.

Later, though I started to think what I have told them. One particular advice I had to examine: don’t start with a tech that you find interesting, start with a story instead and choose your tech for that.

Now I’m not that sure that this is a good advice for every occasion, especially because I was brainstorming about one particular tech that really excites me, and if I was right earlier, then I’m wrong now. And the more I thought about it, the more I felt, that there can be a case (especially for StartupWeekends) for starting with a tech, even if it is probably the harder way to get something awesome out of the process. Still, given that limitations make one more creative, it worth doing at least some proper brainstorming about it.

Lilypad Arduino

The tech I was thinking about that time was the Lilypad Arduino. I haven’t got one (it’s sitting in my Sparkfun basket, ready to be ordered), but really want to make a project using it.

Lilypad Arduino Ebroidery
Lilypad Arduino Ebroidery by Bekathwia (click picture for Flickr link)

The Lilypad Arduino is a microcontroller (a very tiny computer) that you can stitch (using conductive thread),  and people most often use it for wearable computing / smart clothes. It has a lot of periferials, could use it with LEDs, accelerometers, buzzers, buttons, light sensors, temperature sensors, wireless communication, vibration motors, and whatnot… Really the imagination is the limit.

So now the question is, what kind of projects I could come up with that could use this. In the last few days of brainstorming (and now writing this), I came up with a couple of opportunities, not sure if any of them has been done. Not sure about the quality either.

Project ideas

Smart bag: figure out how to make some simple/small way of communicating with a little sensor that can be attached to items that one does want to always bring along: keys, wallet, phone…. The bag would sense it if they are out of its range and warn the user. Never leave stuff behind at home or at a cafe.

Visual turn-by-turn navigation for cycles: use a smartphone to get navigation directions to where you want to go with your bicycle or motorcycle. A jacket is outfitted with lights on both arm, and would have a Lilypad to communicate with the smartphone, signaling which way to turn and when.

Movement direction clothes:  smart clothes that would detect the position and posture of the person wearing them, and use light or vibration to signal what movement is the next one. Could maybe correct choreography or teach karate katas.

Communicating clothes: this could be done in multiple ways, wireless, infrared (like the TV remote control, just two way), consciously controlled or in the background. Ultimate spy clothes, send messages between people in the crowd without them actually doing anything. Could local business send out signals that are received the clothes could prompt you with a deal or order ahead your favorite if you are a regular (though, this can really easily be very spammy). Also, the different units can synchronize with each other – cue super visual flashmob.

Smart bedding: what if your bed could monitor your sleep and  wake you up when the morning comes? Bit like Wakemate, but for the bed.

People tracking: build into work clothes for a factory and can log in and out people just by sensing them. Make it part of the ticket in an amusement park, and can see which rides are too popular, can communicate back to advise about waiting time and suggest other ways to pass the time. Finding people in a crowded place in emergency, see if anyone’s left behind. Though these can be very 1984 if done badly….

Health sensing: monitor vital body functions for people who are somehow at risk: older people, partying in town (drink responsively), doing sports…. Warn them when some critical situation is predicted.

Style guide: clothes having smart tags with “style” and “colour” and “pattern”, and either all of them collectively, or a central piece of clothing would check whether these thing you wear do match with each other. Could also make recommendations what to wear. “I have this trousers, shoes, and so on – which shirt should I wear to that?” – press a button, the right choice lights up or vibrates in the closet.

Well, that’s for now. Most of these, I realize, are quite a bit tentative, many of them seem to miss some key ingredient, or have a (technical) problem to solve before it would work. Which one would I bring to a StartupWeekend if I’d go, which one is ready to be made and could be made in 54 hours? Tough one…

Found anything interesting here, or have some more ideas? I’d love to hear them, let me know in the comments!

Categories
Learning

Online learning in the 2012 Spring semester

The 2011 Autumn semester brought a handful of online classes, and it worked out pretty well for me, as I finished 3 courses and learned a lot. After that success, arguably spearheaded by Stanford, I think everyone was expecting big things to come, and the the number of offered courses, also the number of course offering entities multiplied. I was looking forward to it as well, planning to dig into all different topics, and had to start choosing between all those classes, since I was interested in so many but definitely didn’t have time for all. In the end, the new semester was mostly a failure for me. Fortunately that doesn’t mean a complete failure of things.

First  of all, Stanford offered a lot of new courses, as more and more of their faculty wanted on, but then those courses were delayed by weeks, then months. It was pretty underwhelming and took some wind out of my sails. While I was waiting, I was looking around for other offerings, and fortunately there were some interesting stuff.

MITx 6.002x

MIT’s first offering (that I’ve seen) launched with quite the style, slick new website, corny promo video of two students preparing for and doing their MITx course, and so on. Nevertheless, the topic was interesting, 6.002x Circuits and Electronics. It’s right into the things I like to learn, and it’s engineering perspective (more practical) felt great to match my gaps in electronics education from the physicist point of view (more theoretical). It started great, and evolved a lot during the 14 weeks or running.

When it was new material, it was presented pretty well by Prof Anant Agarwal, it had great tools like interactive circuit design built right into the site, good quizzes, interesting questions. It was going all well, up until almost the end. Here’s the result of my course, ending in a grade C:

Results of the MITx 6.002x course

It all comes down to that I didn’t do the final exam. I could have. I had a whole weekend to do that, or about 4 days. Just it somehow didn’t happen, had “other things to do”, or something.

Right now it feels that all the things that went wrong with this course, can be traced back to handling it as the online version of the offline course (which is actually pretty explicit, denoting the course 6.002x, after the offline courss 6.002). If it was just about the content, it’s okay, but it was also about the teaching methods.

In the beginning I didn’t notice it a lot, but as the weeks progressed, one thing stood out is the number of reviews. Let’s review what you have just seen in the previous video. Then two videos later review it again. That got insanely boring in the end, and while I was managing it by skipping videos that were just reviews, my interest did take a little hit. It’s an online course, if someone wants to review a topic, can just watch the same video again, can’t they? Why not just refer to the previous material via a link or something?

The other thing is that for exams (the midterm and the final) they only left a weekend for, with 24h limitation after you opened the test. For an online course that seems to me again as a mistake, people are from all over the world, indeed they wanted to have a great variety of students from all different backgrounds, why to expect that people are available in a given 4 day interval? Let’s go a step further, why is there even a semester limit? I was doing multiple weeks in one go, then falling behind because not checking the site for a while. In the end, the whole 14 weeks of coursework, with exams and all, could be done in about 6 weeks if I wanted to, beside my daytime job. As soon as people go online, semesters make just as much sense as trying to stick to the same time zones for all the students – not much.

Of course, I’m very grateful for the whole course, even without taking the final exam I learned a lot, that I’m already using in the lab, and it helps me every time I do electronics (which is pretty much all the time). Just thinking that online education in this form is just faster horses, not automobiles, as Henry Ford would say.

It was a successful enough course, though, that it seems now they have extended the experiment into edX, an distance learning initiative. Let’s see what happens!

 Venture Lab

From the new Stanford bunch, Venture Lab (originally Venture Class) was one I was really looking forward to, since there is so much entrepreneurial influence from others in my life at the moment, looks like half of my friends are up to something. It was pretty delayed, I guess partly because they were changing base idea of the course, and partly because they were building a brand new site from scratch for that. Originally it was to teach people about technology ventures (and I had the matching book called Technology Ventures earlier anyway) in the usual online class way. When it launched it became a “lab”, where people form teams and collaborate and actually create new stuff. It was going to be really exciting!

Then when it started, after a first week or two, or maybe even less, it turned out that managing a team, even 4 people, remotely is not such an easy thing. If we were in the same place, and we got together because of the same vision, it might have worked. This way, fragmented both in ideas, in space, available time, skills and everything, it wasn’t working that much. Which is a really big shame, because I really liked the people on the team. I really hope to get back in touch with them again and do something else, though that is unlikely.

Venture Lab class interface

In the end I was just watching it from the sidelines (or still watching because due to the delay its semester hasn’t finished yet), and admiring the people who step by step built up something tangible. I heard multiple teams actually starting companies upon the ideas they came up with for the course. Now that’s some achievement! I feel a little bit that I missed a great opportunity to learn something, learn a lesson in an unusual way.

On the other hand, I did learn something actually: don’t throw good time after the bad one, if it feels it’s time to quit, then just do it. The sooner it’s done, the better everyone can move on to bigger and better things. So this course is not a total writeoff. And I’m still going to watch the videos, read the book, and get on with technology.

Udacity

This one was also something I was looking forward to, since Udacity was co-founded by Sebastian Thrun, who was an instructor in last semester’s AI Class. Looks like after last semester, he have seen the potential of online communities in learning environment, left Stanford (as far as I know) and came onto this project. They had and will have a lot of different classes, mostly IT related, from robotic cars to building website and programming languages.

I looked at a couple of different courses, and the most amazing thing was, that my friends, one of them programmer but in different area, another one not really a programmer at all, were already taking one of them – CS253 Web Application Engineering, no less! Of course I wanted to join them, collaborate and also challenge each other. Well, in the end, didn’t happen. By the time I got there, it was all over for the semester, and they both kinda dropped it, or procrastinated out of it along the way. That doesn’t smell like success to me, but as long as they are not discouraged, hope we can do something similar next time together, and if I get in on time, would do everything in my power to get every one of us through.

Udacity CS253 interface

It looked good, Reddit and Hipmunk founder Steve Huffman showing you how to build some real stuff for the web? There should be one or two things to learn. If they keep it online, I’ll probably go back and check it some other time.

Next up

Looks like I failed this semester for a couple of reasons. Being busy with real life projects like Ignite Taipei and Future Shorts, as well as actually building stuff, I didn’t have that much time to study anymore. The teaching methods eroded my motivation sometimes. The peer pressure went on, but gone out too quickly as well. Now these things might be fixed next time

By now there are online classes everywhere, and universities are lining up to put online their classes. Can look around on Class Central to see what else is new. This time I looked up some humanities courses for the autumn and maybe check a bit more, cannot be without science, though definitely will try not to overcommit myself.

Now just have to see how this online learning experience will work out, whether the universities and knowledge providers will be able to fix the current deficiencies stemming from not using the Web to its full potential, just as “another medium”. But I think online learning / anywhere learning is here to stay, and the ball is on our court, the prospective life long students.

Categories
Programming

Let’s talk about humidity

It is very much summer now here in Taiwan, and if one thing the Tropics is good at, then it’s being hot and humid. That’s sometimes fun, when there’s enough chance to hang out by a pool or on the seaside, but most of the time not that much. That’s why there are so many air conditioners, and other clima controls.

As I really like data, and this place is great for electronics, I thought I can just combine the two things, and try to learn more about my environment. Temperature is relatively easy, but for a long time I was looking for a humidity sensor. At the local electronics market I found a few different models the other day, and got one of them – pretty much the cheapest one, because all the manuals were in Chinese anyway (which I don’t yet read), and they were also all packed up, so there was not much peeking anyway. There was a combined temperature/humidity sensor board (two sensors already packed up together), but at 450NT it felt pricey and needed to buy some connectors for it as well. There was a larger round capacitive sensor, but it was too large for my liking.

I ended up with a “CM-R Resistive Humidity Sensor” (here’s an English spec scheet for it). It was 250NT (~5 quid or 8 bucks) which makes it relatively expensive equipment for me, though maybe because I was saving my cash in my wallet for going to Mobile Monday Taipei later that night. Still, if it works then it does worth it, and might get a few more pieces.

Wiring it up

I never actually knew how the electronic humidity sensors work, so this is a good primer for that.  Nevertheless, the plan was afoot to hook it up to an Arduino and measure some RH% (relative humidity). It was quite tricky for me to figure out the wiring, though, because I never worked with resistive element that could handle only AC voltage, and gets destroyed by DC.

That white rectangle with black spots, the humidity sensor at work, all plugged in with Arduino

Fortunately there were a couple of people (indeed just 2 or 3 that I could find) who were working with this, and had some good information. The one I went with was this post from the Arduino forums. Was quite informative, though I think the final formula is faulty – not because I understand it completely (my electronics theory is spotty at best) but because experimentally I figured out what works instead (being an experimental physicist, that’s pretty much what I do all day anyway).

Finally it is hooked up something like what is shown in this hideous schematics (really got to find some better way to draw this):

Humidity sensor schematics, done with Fritzing

After this wiring, I have to switch the digital output (DO) pin between High and Low at about 1kHz with 50% duty cycle. When the pin is on High value, every now and then I measure the voltage with the analog input pin. From the measured voltage I can deduce the resistance of the humidity sensor as

RH = R1 / ((Vref - Vm) / (Vin - Vm) - 1)

where Vref is the reference voltage (5V of the digital pin), Vin is the measured voltage, Vm is in this case Vref/2=2.5V, the voltage that the capacitors are charged to during all this switching, and R1 is the reference resistance. It works very well, I tried to measure some fixed resistances, and the results are pretty accurate.

When we have the resistance value, the spec sheet has a look-up table for translating the resistance into relative humidity (RH%). It’s quite cumbersome, because will have to interpolate between values, and it’s also not that accurate if the temperature is not known. On the other hand, the values from 25℃ can be used pretty well for all normal temperature ranges here in the summer (let’s say air conditioned 21℃ to outside summery 33℃) with maybe ±5% error in the humidity measurement, that’s not that bad.

The sensor itself feels really sensitive, just having it in the lab, could sense changes in RH as others were doing water-related things the next room. Even if reading is not that accurate, it is still quite precise, and for most of the things it is still okay. I could try in different environments, like our “dry box”, which maintains ~20% humidity, but that means quite high resistance of the sensor, MOhm instead of tens of kOhm, so the voltage reading just moving around near 5V, making it not that precise and noisy as well. For 30-90% humidity it works pretty well, though.

To monitor the readings, I wrote up a quick web-app from some reused code with NodeJS, Express, Socket.io, node-serialport2 and Flot. There’s no kill like overkill, but at least I can already monitor it from any other computer as well, it’s real-time, and the GUI is much easier to adapt than most other ways I know.

All the code for the Arduino and the monitoring server is in my Weatherstation repo on Github. It’s pretty buggy and not documented, will clean that up later when I’ll have a good working version.

Deployment

Now let’s get down to some real action. Being at home, I often feel that my flat is way too humid. Firing this circuit up, I got a reading of 80-85% relative humidity, that’s not something to sneeze at. Then turned on the air conditioning in dehumidifier mode, and watched what happened.

First there was an increase of the relative humidity, because the drop in temperature is quicker and the drop in water content. After chilling for a while, this is how it looked like.

Humidity logging while running the AC’s built in dehumidifier (RH% vs time in minutes)

Looks like some funky periodic behaviour, but empirically I felt much better, even if the humidity didn’t drop much. Maybe the extra comfort comes from the temperature drop as well, so will try to do the same thing in the usual temperature-control-only mode as well, see what does that one look like? I haven’t had neither my laptop battery charger, nor a spare battery with me, so I couldn’t run this too long, I wonder what level it would reach over a longer time. Looks like it has a downward slope, but it’s hard to tell.

Also, the wobbles are likely because of some feedback control that is turning the dehumidifier inside the AC on and off, and that controller has a huge hysteresis. It is not totally surprising, though: as much as I know, dehumidifiers are just big cold surfaces and the water condenses on them from the passing air. For that you have to keep a large surface pretty cold, and it is likely some time to cool a surface or let it warm back up again, thus the controller likely overshoots in both the de- and the re-humidifying parts of the process.

From what I have tried, it feels like a pretty good sensitive sensor, and coupled with

Plans

I’ve seen another way to wire up the sensor in a tutorial, which is basically a resonant circuit and the chance of the sensor’s resistance will change the output frequency. That frequency can be readily measured with Arduino already, so if I get the few extra components, might give it a try. It seems that potentially it can have better noise characteristics then the method I’m using.

Want to add some real logging function to it, maybe saving readings and timestamps into an SQLite database, which I can analyze properly later with Numpy. Or maybe store it in MongoDB, on which I can still interface and do some concurrent analytics even when the sensor is running. Or maybe I consider that just because I use Mongo for Friendcare?

Would like to add a 10-LED light bar, which could display the humidity decades without any computer, thus making the whole setup so much more portable. Though for that I will definitely have to revive a 74HC595 STP16C596 Serial-in/Parallel-out shift register, because then I’ll need one resistor and a single DO channel to control those LEDs, instead of 10 DO channels and 10 resistors.

Could also add an LCD screen like this SparkFun SerLCD. The only problem is that it interferes with the serial connection, so might not be able to use it together with the computer monitoring. Might worth it, though, that LCD I have (white-on-black with backlight) looks pretty darn funky.

Could also add some long-term monitoring and some other sensors, to build up a real home weather station. I have my eyes on a barometric pressure sensor, but that’s quite expensive.

Update (2012/11/6): 

  • Been using this in our laboratory for almost two months now, it works quite well, though still thinking of there’s any better way to measure the resistance of the sensor. Brushing up on RC circuits is in order?
  • Looks like I’m not the only one thinking about humidity sensors and data logging: there’s also another post from the awesome Tom Igoe.
Categories
Programming

Frindcare, some improvements

After getting to a working level with Friendcare, my web app to track friending and defriending on Facebook, I was still doing some tweaks. Some of the tweaks is to improve functionality, some of them to fix some broken behaviour by the services I use (especially Facebook). This is a little summary of what I have learned in this short time.

Changes

Heroku

The very day of my last blogpost, when I actually had others sign up as well, Heroku had a few hour long outage. That was quite unfortunate, and it was annoying to see the “Application Error” page, which pretty much hides what really happened. In real production environment probably I would have to run things on multiple independent platforms so if the platform itself is the one that crashes, the site could be just switched over. This time I’m just taking it simple, make a personalized maintenance page, which I can turn on in this case, or when I’ll really need some maintenance time. Also, played around Google Web Fonts, so can have the good old school Press Start 2P on this one.

Friendcare is offline for maintenance
Friendcare maintenance screen

It would be nice if in case of trouble I could use a web interface to trigger maintenance mode. Might build a service for that, though now that I think of it, that will have to be hosted outside of Heroku. Also, later might do an application error page as well, just in case. Might even choose a mascot for that. Though probably not.

Fonts

Besides the error page, I was playing around with other fonts for the main interface as well. In the end the current one is Crimson Text, which should be quite readable even with very different font size. It is mostly good, though it doesn’t play completely well with Twitter Bootstrap, the button texts for example are not totally well aligned vertically. Might have to look around the fonts a little bit more.

Friendcare header layout
Tweaked layout, and it actually already has results

Facebook

Facebook has so many weird things going on, that I can barely wrap my head around it. One of my impression, which probably shouldn’t surprise me, that they are most likely not using their own APIs, otherwise it wouldn’t have such huge bugs in it. Another impression is, that somehow they manage make everything almost good, but in some way completely bad.

Graph API reliability

Since the entire site relies on regularly polling the user’s friend list, getting that list consistently is a must. Somehow the Graph API occasionally misses some friends: they don’t appear in the list and I mistakenly assume as lost connections. An hour later, when polling again they are back in the list, so they show up as friendship gain. That doesn’t work very well. This happens a lot, so I had some algorithms in place for that and sometimes had to manually clean up the database (which I really shouldn’t do if it can be avoided).

FQL

I can also use the Facebook Query Language to get the information I want. It is quite straightforward, they even have the expression among their examples:

SELECT uid2 FROM friend WHERE uid1=me()

This is pretty fast as well, maybe half the time of the Graph API request. There’s one problem, though: it returns wrong results. Not entirely wrong, just wrong enough. The list I receive seem to have a bunch of invalid user IDs, such that it doesn’t belong to anyone. They just don’t exists, but I still receive them. So while Graph API suffered from false negatives, FQL suffers from false positives. Fortunately there seems to be a workaround, in the form of a deeper query such that

SELECT name, uid FROM user WHERE uid in (SELECT uid2 FROM friend WHERE uid1=me())

Here I will actually throw away the ‘name’ part, but at least I know that the IDs that I receive do belong to actual people. So far this seems to be the most reliable, though it takes as much time as the Graph API request, or maybe a bit more.

In the end, currently I query both the Graph and FQL in sequence, compare the results, note if they differ (for debugging purposes) and use the FQL result since that seems to be more reliable. Will check back later to this part, when I have more information to go on.

Offline access

Offline access is pretty important for this kind of service, because it’s not that useful if we can only check the results when the user comes to the page. Unfortunately, the ‘offline_access’ permission has just been removed. Instead the access token lives for 60 days, after which one has to get a new one by logging the user in again. I’m not saying it’s unreasonable, maybe even better since I don’t have to ask for any extended permission over the ones that are granted to every app automatically, but have to keep in mind. It might complicate things. Also reminds me that other apps that I’m using with Facebook (e.g. ifttt) will have some problem because of this thus I will have problem with this. Better check with them.

Send message prompt dialog

I kinda understood when they have removed the ability to send message to others on the user’s behalf without their interaction, that’s such a tempting spam delivery system for most, I presume. On the other hand, for a long time at least they had (or I seem to remember they had) a send dialog, where I could prompt a user to send a message to someone else: they write the actual message and they click send. On the other hand, the current Send Dialog has a required parameter ‘link’, this it is no longer possible to send “just a message”. This must be a relatively new chance, since the dialog’s page describes it as:

The Send Dialog lets people to send content to specific friends.

Fair enough, that’s exactly how does it work. On the other hand, just one level up, the Dialogs Overview says this:

The Send Dialog allows a user to send a Facebook Message to one or more of their friends.

Content vs. message, subtle but crucial difference. Thus in my app I cannot have a “send message to this user” button, unless I attach some kind of link to the message. Now this feels really spammy to me.

Overall

It is good to add a few more features, because I can use it better as well, and I learned a lot too. Might add a proper dashboard, a deregister option, notification to email or (if I can figure out how) Facebook message, stats, better layout. Or whatever suggestion I receive.

Finally, the most important thing that it works. In the last week I found two people who defriended me for whatever reason, and I wouldn’t have known about otherwise. They were not close ones, so not going to pursue them, but it could have been otherwise, so at least it’s good to know.