29 September 2010

Fun with regex: shrinking indentation

Sometimes you get source code from people who believe in 4 spaces. Or 8, imagine! Or tabs ... well that's just *so* 20th century ...


    function($) {
        $("#blah").toto(function(event) {
            $(this).click(function(event2) {
               $(this).goes(WAY.off(2, the("right")));
            });
        });
    };

Too much indentation! 2 is enough! Let's suppose that for whatever reason, you can't or won't use your text editor's re-indent or reformat function, or you just really dig regular expressions ... here's what to do: replace ^( +)\1 with $1.

^( +)\1 means "any nonzero-length sequence of spaces at the start of the line, followed by the same sequence of spaces. The \1 in the pattern, and the $1 in the replacement, are both back-references to the initial sequence of spaces. Result: indentation halved.


  function($) {
    $("#blah").toto(function(event) {
      $(this).click(function(event2) {
        $(this).goes(WAY.off(2, the("right"))); // Not.
      });
    });
  };

There you go. Readable code.

Don't tell anyone I said this, but if you want to do the opposite (increase indentation), replace ^( +) with $1$1 ...

28 September 2010

Stuck for an idea?

If you're a developer with an entrepreneurial bent and don't have access to a real flesh-and-blood business/marketing type, don't worry, these kinds of resources are becoming progressively more and more automated. Here are two to get you started:

The Startup Idea Generator will give you great, buzzword-compliant mission statements such as "Synthesize wireless bandwidth consistently through peer-to-peer AJAX-tagging communities," "Harness robust users in conjunction with crowdsourced android tagging sites," "Implement global infrastructures using venture-backed social media-tracking relationships." You can't possibly lose!

Wait, what does your startup do? will help you hone your elevator pitch and optimize your marketing strategy by leveraging your next-generation wireless browser investments. "So, Basically, it's like a ..."

  • Database Abstraction Layer For The Army!
  • Eco-Friendly Marketplace For Social Outcasts!
  • iPhone App For Ex-Girlfriends!
  • Match.com for Pets!

But don't take my word for it, go see for yourself. It's like an optimizer for your spare time!

Thanks @peignoir for sharing itsthisforthat

15 September 2010

Start In Paris #3

Last night was the third Start In Paris. At La Cantine, as usual, 5 startups presented themselves, so for those of you who couldn't make it, here you are:

Wizme

This is a way of seeking and making recommendations from/to your personal social network. The goal is to make recommendations relevant because they're from people you trust, instead of from random strangers on the internet whose opinions are possibly biased in one direction or another.

The plan for now is to rely on networks you've already established in facebook and twitter. Here's a challenge though: if someone asks you what you think of your new telephone / jeans / dentist over beer, you're generally delighted to expound wisely and wittily on the subject. If you get the same request through facebook, won't it feel a little bit like work? Or am I just old-fashioned?

The concept could be très très cool if it works. No amount of marketing will sell me the latest hot Apple product or hollywood movie if the people I know and respect are telling me it sucks. If this kind of site can successfully undermine the mass marketers, we could be moving to a better kind of world. Of at least, a better kind of France - the site is only in French so far ...

Hop-cube

Hop-cube aims to exploit the growing market of environmentally- and ecologically-aware consumers. Their three services are (1) The "Hop-Badge" that you can show on your site to illustrate how eco-friendly your product is; (2) hop-score.com, which lists zillions of products along with their environmental-impact information; and (3) Special marketing tools based on sustainable development concepts.

Prices and affiliate links to sellers are available immediately on a hop-score.com product page; environmental details require an extra click. Of course they have to make their money somehow, but the way information is prioritised here is surprising given their declared mission. The environmental details page shows the usual stuff - energy use, greenhouse gas emissions, and also information about the manufacturer such as their global gas emissions, water use, ISO14001 certification.

It could be interesting to push this further to understand, for example, how much energy was used to manufacture this product, how much gas emissions, what kind of resources are mined for raw materials for this product, how many rivers are polluted, hectares of forest destroyed for this product, and how many Chinese factory slaves died for this beautiful sleek slender unibody laptop I so enjoy typing on while its mercury-free battery warms my thighs?

On "Sustainable Development Tools", from their site (http://www.hop-cube.com/services/outils-marketing-durables.html, roughly translated), "[our] simulators take into account each of your visitor's specific behaviour and data" ... "besides, the simulators give you a mine of information about your visitors". Well, well. Environment++, maybe; privacy--- ...

In any case, I'll be sure to take a peek the next time I'm buying a great lump of electricity-sucking metal for my home. And delete all my cookies afterwards :)

Dress-Me

Your problem is, you have no sense of style. And you have a major romantic dinner coming up at the end of the week. Or an interview. Or something ... something that causes you, even involuntarily, to think about what you will wear. You have the clothes, even though the few decent ones are musty from disuse. But your sense of style, your finger on the pulse of Parisien fashion, where is it? It's not where you are, and that's your problem.

Dress-Me is a whole platform for whatever you might want to do with your clothes. Buy/sell/exchange/borrow; seek and offer fashion advice; and most useful for someone like me: hire a personal shopper who can expertly tell me what I ought to wear, because, honestly, I haven't a clue.

I can see Dress-Me grow into an awesome community of clothing and fashion geeks, the kind of place where ideas germinate and influence the world outside. Not so sure about popular appeal to jeans-and-tshirt types. But it looks like a lot of fun.

Super Marmite

If you're hungry but can't/won't cook, and you're fed up with the local macjunk, and you simply *know* your neighbours are cooking something delicious, Super-Marmite is where you need to go!

This is a social network for foodies, whatever side of the kitchen you're on. Buy meals, sell meals, meet your neighbours, and eat authentic, genuine, and (hopefully) wholesome food. Especially if your neighbours are Korean, or Japanese, or something like that. Or Senegalese, or Moroccan, or Mexican. Or Italian. You get the idea.

They're planning for two kinds of cook: the casual, occasional kind who's in it for society and fun; and the professional kind, who sees a way to make substantial revenue from their kitchen.

They're still in beta, but I'm sure that won't stop you, go request an invitation

scrumers

If you're unfortunate enough to know what scrum is (hint: nothing to do with rugby), this site deserves a look. One of its features is a "Rich User Interface", and the ability to move tasks around just like post-it notes on a wall!

You might be cynical and argue that you can do that with post-it notes and a wall, but since when did your wall automatically generate burn-down charts, huh? And what do you do when the wall is in another continent? Answer me that you cynical so-and-so.

Comes with obligatory i-phone app. And, unlike every other startup presenting this evening, the folks at scrumers seem to think that somewhere in the world, hiding in a corner on the other side of the planet perhaps, there might be some customers who speak Ze English!! Radical stuff here. Here we are, in the middle of Paris, and the site's entirely in English. Do they think the internet is global or something?

06 September 2010

Discussion

I met a software project manager once who argued that a team of good software developers would be a disaster:

"they would spend the whole time arguing with one another."

Ouch. If they spend whe whole time arguing with one another instead of delivering your project, they're not good software developers. They're crap, in fact. How interesting that this particular manager was unable even to imagine the qualities of a team of good developers, having never experienced one, perhaps!

There's a time to lead, and a time to follow, and an expert (in any profession) knows which time it is. If you find everyone else is talking to much, remember that it might be better to do the wrong thing than to do nothing. It will surely be a learning experience for somebody.

Discuss.