trim() function for ActionScript and JavaScript
Strangely ActionScript doesn’t have trim() function, JavaScript doesn’t have it either.
I needed the one lately and googled it but a few solutions that came up looked weird (using several for() cycles for example). So I came up with this one — if you know how to make it simpler or shorter, l’d be very interested to hear your solution.
Old school style:
function trim(s) {
return s.match(/^s*(.*?)s*$/)[1];
}
var s = trim(" well done "); // s = "well done"
Modern style:
String.prototype.trim = function() {
return this.match(/^s*(.*?)s*$/)[1];
}
var s = " even better ".trim(); // s = "even better"
Enjoy!
How to be stupid
“Never underestimate the power of human stupidity” Robert A. Heinlein
You are smart. You know it. People around do notice. You must be doing great, but somehow you are not. You are stuck and not sure what to do. It’s probably time to be stupid. Let me bring up some well-known examples first.
1. Sergey and Larry launched yet another search engine in 1996. With no business model and the market apparently dominated by behemoths like Yahoo.
2. Andy wrote a check for $100,000 to the guys he barely knew, before they even had a company.
3. Stanford drop off Steve persuaded his friend Woz to build personal computers in a garage. Woz later said that “All the best things I did at Apple came from (a) not having money, (b) not having done it before ever.”
At the time, when it was happening, all that would be considered very stupid by most of us.
As heretic as it sounds you can’t avoid being stupid if you want to succeed. The Heinlein’s quote above might be deeper than most people think. I’m going to use a little computer science example to explain how it works.
Continue reading…
Posting the old stuff
It’s been a long time since I wrote here something. As things keep on being crazy (and exciting) with Loudtalks, it’s not going to change any time soon. Yet, I found some old text on my HDD, which I wrote while the life was easy but never posted them since they were not quite complete yet. I’ll publish them now (as is) and will finally cross these long overdue items in my never ending to do.
The Magic
What do you want to be when you grow up?
In a kindergarten I wanted to be Fantomas but nobody asked. Then – an astronaut. Then – an archeologist (yup, if you meet Harrison Ford please tell him). Then – a geologist. Then… strangely I don’t remember what was my target in the high school.
Astronaut, archeologist, geologist – this is what I was telling adults when asked. I never told them the truth because they wouldn’t understand. What I wanted to be the most was a magician. I wanted that magic wand and the power to make wonderful and impossible things. At different times people, who wanted to be magicians, selected different professions. In XVIII century’s magic was alchemy, in XIX – chemistry and in XX – physics. Software and computer science are the magic of our time.
I’m a happy man because I’m living the dream. You are probably too. But here is the question. Is software the last magic ever? I guess it isn’t. Then, what’s the next?
What do you think?
P.S.
Current magic typically fails to deliver, what was expected, however the next magic delivers something valuable and quite unexpected instead.
Alchemy failed to turn lead into gold, but gave us Newton laws.
Physics failed in nuclear fusion power, flying cars, teleportation and space travel. We’ve got the internet, mobile phones, pocket-sized computers and Moore’s law instead.
Computer science will probably fail in thinking computers (aka Artificial Intelligence), natural language processing and transparent real-time machine translation (Babel fish).
What will be the next magic? What surprises will it bring to us?
Cloudy day at Loudtalks
No, it’s not as sad as the title sounds. In fact it’s opposite. After two weeks of heavy development and testing we released the first SaaS push-to-talk network solution called Loudtalks Cloud.
Now with just few clicks you can create your own secure push-to-talk network accessible from Windows and Linux PCs and Windows Mobile devices.
Give it a try and let us know, what you think!
You don’t have to prove
A form for a project executive summary within Russian state seed funding program application website (START 2009) states:
“You don’t have to prove anything in the executive summary”
That’s nonsense. If you don’t prove anything, why bother writing?
TechCrunch50 list announced
TechCrunch50 conference opens today in San Francisco.
The list of 50 finalists, which will present during 3 days event has just been published. All companies look good but I already sold on one of them — GoodRec, which offers twitter-digg style reviews service (via web or mobile) looks like the brilliant idea, and if execution is good they certainly going to be the winner.
Chrome. Wow!
Today Google released its web browser, called Chrome. Go and get it. Really.
It’s fantastic with the great user experience, wicked fast JavaScript (3x faster than Firefox and 75% faster than Safari based on Bubblemark test) and supports both ActiveX and Firefox plugins! Even Silverlight works although there is a minor issue with canvas updates.
Bubblemark update
Silverlight 2
I’ve been a out of this little project for a while, busy with things at Loudtalks and Metalink. I even haven’t had a chance to check out Silverlight 2.
Few people asked for it and I was about to go all the way through installing VS2008 but today I received a Silverlight 2 bubblemark port, implemented by Kevin Yang. On my machine it gets ~280 fps, which is 40% increase over 1.1. You can try it yourself here.
Bubblemark validity (correctly) questioned
I’m glad to see that more cross-RIA benchmarks appear these days.
Sean Christmann made the one, which is geared towards measuring complex UI performance. You can check it out here along with an explanation on why bubblemark is not particularly relevant for the task.
For me the value of bubblemark is actually more in education, than in measuring. You can take it and see, how things could be implemented in different platforms. Consider it a rich “hello world” for RIA, which shows the basics — text, graphics, animation, and interaction with the app from a webpage.
Some stats
Finally, I checked out website stats and here are some interesting numbers:
- The site was visited 105,000 times by 81,000 visitors
- Most users are from US and China
- The most requested demo is Silverlight 1.0 closely followed by Silverlight 1.1
- Microsoft was the most active “corporate user” of the site with over 2000 visits originating there
Be nice to yourself
Google Blog Search offers an easy way to subscribe to search notifications in Google Reader. Very simple and nice.
However, there is a problem. Here is how the feed looks in Reader’s list:

The actual search term is represented by the first letter only. Interestingly Google’s Russian rival Yandex makes the very same mistake (the line above Google’s).
Search term alerts feed name should start from the term itself:
Fixing that is easier than writing this post.
Big news: Silverlight 2.0 is around the corner
The beta will be released soon and it’s going to set Microsoft a clear leader in RIA battle. Here are some features:
- WPF controls
- Cross-domain network requests and built-in support for REST, WS*/SOAP, POX, RSS and plain HTTP
- Sockets
- LINQ and LINQ to XML
- HTML DOM access
- 4.3MB runtime for Windows / Mac / Linux (planned) and IE, Firefox and Safari
Details are here — check it out!
Top 10 Application Design Mistakes
Jakob Nielsen writes about some frequent mistakes in application design.
Here is his list (with my comments)
1. Non-Standard GUI Controls (sometimes you have to use non-standard controls, if they can do the job better; otherwise we would stop the GUI design evolution in 60-ties)
2. Inconsistency (inconsistency is bad, but in the context vs consistency battle context wins)
3. No Perceived Affordance (agreed)
4. No Feedback (agreed)
5. Bad Error Messages (I would generalize this to include bad copy in general)
6. Asking for the Same Info Twice (who does that after all?)
7. No Default Values (agreed)
8. Dumping Users into the App (I didn’t understand this one)
9. Not Indicating How Info Will Be Used (hmm… I don’t suppose explaining everything is a good idea; it’s better to let user correct the mistake easily, when necessary)
10. System-Centric Features (I would call them useless features — pretty obvious)
The complete article, while being a bit on a linkbait side, worth checking out too.
Sex and a product development
Here are my rules for the new product development:
- Start from something interesting and intriguing. Ignore usual expectations at that point
- Develop your vision fully before starting to think about standard features
- Keep it fun, keep on trying new things. Otherwise they’ll stand up and go
- At some point they’ll start crying about the missing standard features and asking to add them. Don’t!
- Announce you will do that, but make yet another new and cool thing instead
- That will make them really want it
- Go ahead and add the standard stuff… wow
Apple executed it perfectly with the iPhone (and its SDK), why don’t you try it at home?
Happy Valentine’s day everyone!
MessageBox’s death
“Are you sure you want to delete this item?”
Sounds familiar, does it? Just a couple of years ago every application had dozens of message boxes and confirmation dialogs popping up here and there. Now it’s changing. In Loudtalks we decided we won’t use any.
So how do you handle the above mentioned situation without throwing a message box?
Implement Undo for any action the user may regret a moment later. Sometimes it could be tricky but most applications don’t have to do anything irreversible.
There are several caveats of course:
1) Sometimes you really have to do something, which can’t be reversed (like format the hdd).
2) Blind users accessibility should be taken into account.
Even if the action does require re-confirmation, you could do it in more elegant way. For example, use in-place confirmation button. Probably the best way to address accessibility issue is to implement a handler, which will announce the undo keyboard shortcut along with the fact that the action is completed, when screen reader software is detected.
Do you still use MessageBox in your software?
GoogleTalk now offers translation bots!
Released yesterday they allow you to translate from and to dozen of languages using any XMPP client (including GTalk of course).
Add [src language]2[dest language]@bot.talk.google.com
to your GTalk contacts and bingo — you’ve got your personal machine interpreter. For example en2zh@bot.talk.google.com will translate from English to Chinese.
The quality of translation looks pretty good in simple tests (I tried English to Deutsch and English to 中文).
The following language pairs are supported:
ar2en, bg2en, de2en, de2fr, el2en, en2ar, en2de, en2el, en2es, en2fr, en2it, en2ja, en2ko, en2nl, en2ru, en2zh, es2en, fi2en, fr2de, fr2en, hi2en, hr2en, it2en, ja2en, ko2en, nl2en, ru2en, uk2en, ur2en, zh2en.
[via TechCrunch]
How to win in China
Last week I stumbled upon an interesting article, which is a translation of a blog post by Gong Wenxiang (龚文祥) — a marketing specialist from Shenzhen, China. Gong analyzes top 10 mistakes US internet companies make in China. Based on his analysis I put together this list of what might be the winning strategies on that interesting market.
1. Beware of internet cafes and shared computers
Large percentage of China’s internet users access it from the public or shared PCs. It means some techniques, which worked great in US (like lazy profiles) shouldn’t be used in China
2. Be hated but never be forgotten
There is no such thing as a bad PR. It’s even more important in China.
3. Move fast
Long term strategies might never work out so try to reduce the risks by setting short term goals. If something doesn’t work, drop it fast and try the other approach.
4. Be a gang, use simple metrics
Set the goals and let your team in China achieve it using all means necessary. Define a good performance-based reward and give them a license to kill (be prepared that they’ll be using things like porn traffic, pop-ups, redirects or spyware).
5. Use a separate brand
You don’t want all the things listed in 4) to happen under your much praised name.
6. Don’t assume users care about something
Do only what they actually ask for.
7. Get the cheapest traffic possible. Lots of it
Targeting worth nothing so don’t mess with it.
8. Use Chinese
The majority of internet users in China don’t understand English. All your copy should be localized.
9. Use monster homepages
Tell all cool things right on the homepage. Crazy colors, blinking banners and all the things, which would cause a heart attack to a western designer, are must have.
10. Monetize!
Don’t assume users in China are not rich enough to generate a revenue. Just don’t try to sell things, which they don’t want or can’t afford.
What’s your name?
It’s been a month since we have launched Loudtalks and we are approaching 2,000 registered users mark. It’s still a very little number and practically it means that almost all user names are available.
For example, as I write this, such names as bruce, jason, jennifer, jesus, michael are all available.
Still we are getting a lot of registrations with fancy names like jones331 or _ktr1954 (these are not real but you got the idea). The reason is simple. Once you picked the name — it’s yours. Most people will stick with it even though it was a random choice.
It’s an interesting effect and I’m wondering what would happen in 20 years. If the trend will go on we will have people naming their children AlexG_2047_12 or JulieF_A23045 (and check them in Google Names before they do to assure uniqueness).
iPhone performance in Bubblemark
From all benchmarks at bubblemark.com iPhone is only capable to complete dhtml one.
Here are the results compared to Safari 3.0.3 (Windows) running on my laptop.

Note that iPhone framerate is capped at 27 fps, which is probably reasonable to keep it stable. iPhone JavaScript performance in this test is roughly equivalent to Pentium M running at 66 MHz and approximately 1/10 of the laptop running in a power saving mode. Developers beware!
Here are the numbers used in the chart:
Pentium M 1.7 GHz
Safari 3.0.3 (Windows)
1 - 96 fps
8 - 93 fps
16 - 92 fps
32 - 62 fps
64 - 30 fps
128 — 10 fps
Pentium M 1.7 GHz @ 600 MHz
Safari 3.0.3 (Windows)
1 - 96 fps
8 - 90 fps
16 - 65 fps
32 - 26 fps
64 - 10 fps
128 — 3 fps
Apple iPhone (ver. 1.0.2)
1 - 27 fps
8 - 22 fps
16 - 9 fps
32 - 3 fps
64 - 1 fps
128 - <1 fps
Loudtalks launched at TechCrunch40 today
Loudtalks was among 39 startups selected to present at TechCrunch40 conference in San Francisco. We launched the product on the stage today. I encourage you to try it and share your experience.
More in the Loudtalks blog. Thanks everyone in the team for making it happen!
Idea: Launch feed
A splash page with an edit box for an email address — this is how most of yet to be launched websites look. I suggest to use “disposable” RSS-feeds instead. Disposable means it only delivers a single message — launch announcement and keeps silent before that. Such feed could be marked by a special icon (I tried to make the one by laying a rocket icon from KDE Crystal theme over standard RSS icon). You can see a live example here or embedded below.
Launch feed has few important advantages over email box:
- RSS is pull technology so there is no spam concerns. User identity is not disclosed.
- It’s easy to track for the user, what she has subscribed for.
- RSS is perfect for aggregation so it would be possible to build the website (your next start up?), where users can subscribe to a single feed and get notified about product launches (all or belonging to a specific category) even before TechCrunch writes about them.
Meanwhile you may subscribe to the one below to get notified about availability of Loudtalks — a secret project of Metalink, which we’re launching this month.
Quick starts for AIR, Silverlight, and JavaFX
Yesterday DevX.com published my article Crash Course in Next-Gen RIA: AIR, Silverlight, and JavaFX. It provides a quick introduction to these technologies by showing how to build a simple stopwatch gadget with each if them (see the screenshot below).

This is my first experience writing for a magazine (right, it’s online only but still a very different genre from blogging) and overall I think it was the great exercise. I learned JavaFX basics while working on it, and built JavaFX version of the bubblemark consequently.
Worldwide Lexicon takes off
I wrote on language barrier few times but today’s post is different.
I’m happy to announce that now we have a part of what could be the solution to this very big and very sophisticated problem. We have been working together with Brian McConnell on it for the last 4 months and today you can see the result. The system we built is up and running at www.worldwidelexicon.org.
Here is what you can do.
First go to downloads page and install Firelex — the Firefox plug-in, which enables human translations in your browser. It’s alpha but it’s pretty cool already. Normally you wouldn’t notice it.

The plug-in displays a tiny WWL icon in your status bar. That’s all. Until you hit the page, for which WWL has a translation. When you do you’ll see a list of languages available and can open the translation in the new tab with one click.

Now that’s fun
Last December I wrote a post where shared some of mysterious New Year greetings cards I received. One of them was from FortRoss (which I lamely mixed up with RUSSOFT). But that’s not the point. Here is what I wrote then:
This one is from FortRoss — the Russian Software Developers association. The footprints leading through the FortRoss logo to the frozen forest and the title “See you next year”… Hmm, what did they mean? I assume this is the allegory to the well known Ivan Susanin story.
Now the fun part. We have been looking for a friendly company to share our gigantic office space for some time and finally found the one. This week FortRoss is moving in to our offices.
Welcome aboard guys, now I know what you meant in that e-card!
Five secrets of a great GUI (stolen from Mac OS X)
Mac user interface looks fantastic.
Even if you’re not Mac addict, you’d agree, that it has something beyond the look — it feels good too. How did Apple do it? Can you do the same with your application?
These concepts will help you to accomplish that.
1. Continuity
Mac OS X plays the continuity game nicely in its windows manager and it makes a huge difference to user experience. In the real world, things don’t appear from nowhere. They don’t vanish suddenly either. Alice felt uncomfortable, when Cheshire Cat was suddenly appearing and disappearing, so do the users.
Continuity could be very hard to implement but it worth the effort. Ideally the screen should transform between different states seamlessly yet fast. iPhone user interface is a great example of how much you can do despite the lack of computational power. You have the power of a desktop, WPF, Silverlight, Flex and JavaFX — sure you can do better!
Continue reading…
JavaFX — very cool, very slow
JavaFX has been the only RIA technology missing from the set included in Bubblemark. Not any longer. I built JavaFX version of the test, which uses JavaFX markup (i.e. vectors not bitmaps) for balls rendering and therefore compares directly to WPF, Silverlight and Flex.
Check out the JavaFX demo, deployed using Java Web Start here.
Here is the source code.
The first thing you’ll notice is that it’s very slow. The demo takes a very long time to load and start, and real time performance is disappointing. Here is how it compares:
JavaFX — 14 fps
Firefox + Silverlight (JavaScript) — 56 fps
Firefox + Flex — 62 fps
Adobe AIR — 62 fps
Firefox + Silverlight (CLR) — 99 202 fps (update: 202 fps after fixing main timer’s latency)
(All tests were performed on Pentium M 1.7 machine under Windows XP SP2)
It is 4.4x slower than Flash and 7x 14x slower than Silverlight (CLR-based variant).
On a positive side, development with JavaFX is fun, the language is very compact and efficient for building complex dynamic layouts. There is a great converter to JavaFX from SVG format and JavaFXPad is done nicely too.
If only it were 5x faster!
Chris Oliver’s early benchmarking results of JavaFX compiler suggest that there is a hope it could.
(update 08/27/07: Chris Oliver responds in his blog showing how you can make JavaFX bubblemark 5x faster! Here is his version and the source code.)
More valuable than oil and natural gas
Did you know that there is an unrecoverable natural resource, which is more valuable than oil and gas? There is a very limited supply of it, and I can safely say that it will run out in no longer than 90 years or, if we are not lucky, maybe even tomorrow. It’s your time. Yes, I mean your. Spend wisely.
RUSSOFT Forum 2007
Back from RUSSOFT Forum 2007, which happened this week in St. Petersburg. Some quick observations:
- Most people agree that services business sucks yet all but few are doing exactly this
- The reason for this controversy (in my opinion) is that product business is way riskier and there is no venture and seed capital culture in Russia to back up that risk
- Product Engineering services (ie build the products for others) are accepted as a nice compromise — you do the product and don’t risk that much
- The biggest Russian software companies have around 2500 employees, while Indian ones — 100000
- The quality of marketing of even the biggest Russian software companies leaves much to be desired — brochures are lousy (even though paper quality is good) and most powerpoints are to be nominated for “The Worse PowerPoint” contest
- The following things are proudly made in Russia: voice codecs or/and audio processing code in Apple iPod, Adobe Flash player and ~100M mobile phones (by SpiritDSP); BlueCat Linux (by Auriga); TrustedOpinion.com (by Reksoft); comapping.com (by Lanit-Tepkom); HotWire (by Luxoft)
- All people in the forum could be divided into two categories: those, who think how to compete with India, and those, who think how NOT to compete with India. I belong to the second group (if you are a software developer from India I would be interested to hear your opinion regarding Russia)
Reality check
I had an extremely realistic dream last night. It was so life-alike that I thought it was real. Then something strange started happening, some things went different than they should and I started questioning myself — “if this reality or a dream?”. I couldn’t wake up so it was an important question. I decided I should perform a series of reality tests… and all of them passed. It was the reality.
“Wow”, I thought, “I could write a nice movie plot based on this experience”. The very same moment I awoke.
If you want to challenge your dream, try to monetize it.
Safari @ Windows: Apple shot itself in the foot
I tried Safari for Windows, which was one of the news at WWDC yesterday. I must say I was deeply disappointed. It’s not that the browser is bad. It’s ok for the first public alpha. The problem is mismanaged expectations.
Download page says not less than “The world’s best browser. Now on Windows, too“. The press-release screams “the world’s fastest and easiest-to-use web browser“. That promises for something. I would suggest Apple PR people to try the product first.
Continue reading…
Worldwide Lexicon WordPress plug-in is out
We have been working on it for a while and I’m glad to announce that we released the first public beta of human translation plug-in for WordPress. The plug-in allows blog visitors contributing translations to their language of content they like. AJAX interface is used to display translation without reloading the page or making visitor leaving the site. I installed the plug-in on this blog so you can try it now. If you want to try it on your WordPress blog, post a comment here and I’ll send you instructions.
Thanks Brian for such an interesting project and Alexander for the hard work.
We have lots of features lined up to make it really useful tool for community-driven content translations. If you are interested in this topic the best way to keep track of the latest updates is to grab the RSS of Worldwide Lexicon blog.
-
- Categories:
- Technology
- Life
- Solutions box
- Usability
- Vista
- Recent posts:
- trim() function for ActionScript and JavaScript
- How to be stupid
- Posting the old stuff
- The Magic
- Cloudy day at Loudtalks
- You don’t have to prove
- TechCrunch50 list announced
- Recent translations:
- Recent comments:
- Cardin: I believe with optimisation all of these technologies, Java, Flash, Silverlight, Javascript can achieve much...
- Alexey Gavrilov: @Tunc: Tell them to send with USPS and you should be fine. Non-dutiable limit for incoming mail has...
- Tunc: I bought a running shoe and a watch that record some of your data(heart rate, speed, gps coordinates of places...
- Alexey Gavrilov: Sharing a recent good experience. A Blackberry phone (0.7 kg, under $300 value = non-dutiable if you...
- Alexey Gavrilov: Tracking on Russian Post website may include more information than provided by USPS:...
-
September 2010 M T W T F S S « Feb 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 - Archives:
- February 2010
- December 2009
- January 2009
- October 2008
- September 2008
- April 2008
- March 2008
- February 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- Feeds:
RSS
Comments RSS

Loudtalks Launch Feed
