Script.aculo.us show/hide combinations (toggle function)
Sunday, October 28, 2007
I use script.aculo.us sporadically in different applications. Of course, too much of a good thing can ruin the essence of an application, and too much animation or thoughtless AJAXification can do this to a web site. We've all seen them: the ones that make everything disappear and appear at the blink of an eye without any user control. If we don't pay attention, AJAX could become what blink
was to the Web 1.0 era--hated by some, loved by others.
Tonight, I was trying to create a toggle section for a portion of a web page I was editing. I took a look at the
control, which is found in the
object. To use it, you code:
new Effect.toggle('ELEMENT_ID', 'THE_ANIMATION_YOU_WANT')
This is a very useful control; however, whatever object you click to make the magic happen doesn't change--at least, I couldn't find any documentation to do so. For example, lets say you have a link called "OFF" to make something disappear. I think that you would want the "OFF" link to turn to "ON," so you can make the something reappear. As in:
If you tried it, you see that the toggle action works, but the "OFF" link doesn't change to "ON," i.e., there is nowhere to specify what to change using the
function. (If you want to see the code, open it
in a new window.)
I did, however, found a solution to my requirement. The implementation of my solution looks like:
If you tried this version, you see that the toggling action works the same way as above, but the control object changes (with a gratuitous cool fading effect). I didn't use the
function, but I did use some of the functions available. (If you want to see the code, open it
in a new window.)
I think this toggling function is a very common requirement, but I just couldn't find a native solution that gave me any control over the toggling trigger--in truth, I didn't look hard enough, who has time for that.
Anyway, my solution would work for any type of trigger, whether it is a link, an image, or any element in the DOM hierarchy.
If you don't use script.aculo.us yet, you should give it a try
: you can code cool Web 2.0 effects that are "guaranteed" to work across multiple browser.
Friday, October 26, 2007
Over the last couple of weeks I have noticed that my keyboard has started to fail me and I misspell a few words when typing (I use a ThinkPad X60s
for my daily computing). This wouldn't be a problem, as when coding the compiler catches any mistakes I make; however, when typing emails some words are correctly spelled (the spell checker doesn't complain), but the context becomes entirely different from what I want it to mean--now, this is a problem.
For some reason, some keys are not "imprinted" on the screen when I press them, and so I have sent emails with the introduction "Hell there," when in fact it should read "Hello
I may have to mess around with the sensitivity settings, or check my typing speed. I may have become too fast a typer and my key strokes are getting stuck, which is ironic because this is the reason we use QWERTY keyboards
--the QWERTY keyboard style is more of an anachronism in the world of virtual keyboards
Email business strategy
Wednesday, October 24, 2007
I don't like absolute statements, but I think I'm safe if the following sounds like it: "every company that sells anything on the web has an email strategy." Having an email strategy can mean many things: from just publishing an address on a website, to actually selling a product via email.
I have an email strategy: I try to reply to most legitimate emails I receive (try it, ask me anything
). So I find it distressful when companies do not take advantage of one more selling opportunity. For example, over the last two days I have been trying to get information on two different products, each from a different vendor. I'm a repeat customer for both companies, and I purposely tried to contact them via email to see how they were doing.
In both cases I got no reply--it has been 48 hours and nothing. What's distressing about it, as a consumer, is that these vendors in fact encourage their web visitors to use their email address to get in contact with them. I know there are issues with spam; however, why advertise their email address and encourage their customer to use it and not have a plan to handle legitimate requests?
I know I'm only one customer, but what these unresponsive organizations don't realize is that with a strong Canadian dollar buying products from the US is cheaper--the web-retail environment is more competitive than it was last year and Christmas is coming. By not capitalizing on answering emails promptly, these companies are loosing money. Again, the revenue lost by not servicing Jose Sandoval (software developer and self appointed business critic) is small; but add many of me and losses can mean a smaller end-of-year bonus for all.
With everything you read/hear/watch about Canadians buying products from the US because we are overpaying here in Canada, I still wanted to contribute to out local economy: I emailed these two particular vendors; I waited for the information I requested; I got no reply; unfortunately, for them, I opted to import from the US.
Regardless of how small your organization is or how much spam you get, if you sell anything using the web, don't ignore legitimate customers requests. There are currently countless of US retailers that want our Canadian dollars, and ignoring customers is a big incentive for consumers to buy US products.
(Right now it's a very attractive proposition to buy anything from the US: you can get almost anything from 30% to 50% cheaper, depending where you look. Add to that no sales tax and free shipping, and ignoring a sale is bad news.)
Some things you can do:
- Check that your published email address is correct and is pointing to an actual salesperson.
- If you get too much spam, install a spam filter.
- If you get too many legitimate requests and have no time to answer them all, hire someone to reply to emails, or at least set up a robot to reply with a standard message, e.g., "Thanks for your email. We will get back to you."
Trust me, getting something is better than getting nothing, even if it's coming from a bot. Of course, you should redirect the email to an actual salesperson at some point, but the immediate contact can ultimately generate a sale.
- If you have no resources to hire more sales staff, redistribute emails among your existing staff and inculcate an "immediate response" culture.
Note that this may go against the typical "email overload" world we live in, but I already suggested to filter the legitimate requests before sending them to someone who can take action (see number 3 above).
Obviously, not every situation is the same so your strategy may vary, but this short list is a good start.
Trigger happy robot
Friday, October 19, 2007
From Did software kill soldiers?
The National Defence Force [South African National Defence] is probing whether a software glitch led to an antiaircraft cannon malfunction that killed nine soldiers and seriously injured 14 others during a shooting exercise on Friday.
This is a serious glitch. Whatever happened to the 3 robot laws
- A robot may not injure a human being or, through inaction, allow a human being to come to harm.
- A robot must obey orders given to it by human beings except where such orders would conflict with the First Law.
- A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.
YouTube, I want my bandwidth back
Thursday, October 18, 2007
Flash is to YouTube what O is to H2
O (apparently, that's a water molecule), but the embedded player used by YouTube, and other Flash movie sites, are wasting a large amount of internet resources: mainly, my bandwidth. Why do you or I care? Bandwidth limits, of course. My ISP says I have unlimited usage bandwidth, though we all know that this is not true: there is a limit, I just haven't reached it yet.
The problem with the YouTube player is that it doesn't have a stop button. It only has a play and pause button. See for yourselves:
From time to time, I know within 3 seconds of starting a video that I don't want to watch the whole clip. For example, you know the person with a hammer is going to smash something and it will likely be his or her thumb and rabid laughs will accompany the event. How many times can you see the same thing? It's funny every time, but I have a limit to internet hilarity.
So what I do is "stop" (pause, really) the movie and keep reading whatever content is around. However, the movie keeps downloading. Obviously, a longer movie uses more bandwidth, and I don't want to use all that bandwidth or make my internet connection slow for the 5 minutes it takes to download the whole clip into memory. I want it to stop. Note to YouTube: sometimes when I pause a movie, I want it to stop...I have moved on to other funny clips.
Someone at google must have noticed this (or YouTube, if they operate independently), And I'd think it's an easy fix: add a stop button to the Flash movie player. The player already has a useless button to restart a movie, why not make it the stop function. This button is redundant, as I can just drag the length indicator back to the beginning to restart the movie. See the redundant button:
These are minor improvements, but it's the minor details that make a User Interface superior to the competition. By the way, why are the players different? The one from the actual YouTube site and the embedable one?
There you go, this has been my contribution to the internet for today.
Two thoughts came to mind. First, regarding the two different players. It's obvious they have different functionality, but I still think they should be consistent.
And second, regarding the lack of a stop button. My thought is along the lines of video-view counts. I wonder how YouTube counts a movie view? For example, if I just watch 3 seconds of a 2 minute movie, does it count as a full view? If not, what is the threshold? 1.5 minutes out of 2 minutes? 1.99 minutes out of 2 minutes?
I would be interested to know how YouTube calculates video-views, and what statistical models it uses to account for incomplete viewings.
Let the good times begin...Again...
Wednesday, October 17, 2007
Two years ago, Cringely
(and I blogged
about it) wrote the following:
Right now, there is in the U.S. venture capital community about $25 billion that remains uninvested from funds that will end their lifespans in the next 12-18 months. If the VCs return those funds to investors they'll also have to return $3 billion in already-spent management fees. Alternately, they can invest the money -- even if they invest it in bad deals -- and NOT have to cough-up that $3 billion. So the VCs have to find in the next few months places to throw that $25 billion. They waited this long in hopes that the economy would improve and that technical trends would become clear so they could do their typical lemming-like jump off the same investment cliff as all the other VCs. Well, we're at the edge of the cliff, so get ready for the most furious venture investing cycle in history.
Now read what Brad Stone and Matt Richtel say in a New York Times piece, titled Silicon Valley Start-Ups Awash in Dollars, Again
Silicon Valley's math is getting fuzzy again.
Internet companies with funny names, little revenue and few customers are commanding high prices. And investors, having seemingly forgotten the pain of the first dot-com bust, are displaying symptoms of the disorder known as irrational exuberance.
Consider Facebook, the popular but financially unproven social network, which is reportedly being valued by investors at up to $15 billion. That is nearly half the value of Yahoo, a company with 38 times the number of employees and, based on estimates of Facebook's income, 32 times the revenue.
Google, which recently surged past $600 a share, is now worth more than I.B.M., a company with eight times the revenue.
More broadly, Internet start-ups are drawing investment based on their ability to build an audience, not bring in revenue--the very alchemy that many say led to the inflation and bursting of the dot-com bubble.
Coincidence? Probably, but the timing is just about right.
Bubbles in the finance market are inevitable, as investing is not always rational--we would like it to be, but it's not. The question is if we learned anything from 7 years ago? I'm sure we have, but the world of innovation is fast moving and has a very short-spam memory. Specially, when all we remember are the good times.
Bound to happen: India salary inflation
Although the short term gains of outsourcing development to a county like India are not disputed, the long term sustainability of such decisions are still up for debate, at least in the software engineering industry. And when I say long term, I mean 10 to 20 years, not 3 quarters in the future.
I have read Wikinomics
and The World is Flat
, and I believe specialization together with outsourcing are the future of software development--half of my business
is outsourced work--but the business fundamentals will always remain: it's about offering a superior product at profitable prices (for the producer and consumer). Once the labour costs increase shaving off whole percentage points of the ROI, important decisions have to be made; most of the time this means a decrease in cost, and sadly labour is a cost.
A real example of this can be found here: India grows up
. Of course, there are success stories, but we know that sometimes things don't work out and those don't get published in the mainstream media.
What are your thoughts on outsourcing key components of a system outside of North America? By system I mean a complex software system--call centers and such don't count.
Note that I consider Canada and the US to be at par in high technology expertise, so development projects moving between the US and Canada is just business as usual. For the sake of my argument, I only consider outsourcing companies outside these two countries, i.e., I am not too familiar with other countries' overall technical knowledge. The reality may be that these countries may in fact have superior labour forces, but I just don't know from first-hand experience. And of course, if this were the case, the market would make sure to spread the word.
Wednesday, October 10, 2007
Today, I encountered one of the most dysfunctional queues in my history with queues. This sounds rash, but a queue puts items in and takes them out in the same order they went in, so any queue that doesn't do this is broken or should not be called a queue--this is a black or white, true or false issue.
I found this unqueueing queue behavior in an automated phone system. It was infuriating. My interaction with the system went as follows:
I needed to place an order for graduation pictures, so I called the 1 800 number provided in the ordering package (I'll withhold the company name, but if you have graduated in Ontario, chances are this company took your pictures). I was immediately put into the system, which ordered me to press 1 to get connected to a live "customer representative."
It was around 4:00 PM, so I knew it was going to be a busy time and perhaps a long wait. I immediately got the generic message "We're sorry, but all our customer representatives are busy. Someone will be with you in a moment. Your number in the queue is 5. You are next to talk to a customer representative."
I'm thinking, "Great, I'm next in the queue." However, being number 5 in a queue doesn't mean next, unless there are exactly 5 customer representatives and are able to simultaneously take the 5 calls exactly at the same time. I didn't pay to much attention to this, so I kept waiting.
A couple of minutes go by and the message came up again and said "We're sorry...blah, blah, blah...Your number in the queue is 3. You are next to talk to a customer representative." Wait, I thought I was next. Oh, well.
A couple of more minutes go by and the message again said "We're sorry...blah, blah, blah...Your number in the queue is 2. You are next to talk to a customer representative." This message gave me hope: I went from 5 to 2.
But then something happened to my queue number. I heard the automated message come up again saying "We're sorry...blah, blah, blah...Your number in the queue is 7 [that's not a typo; it said number 7]. You are next to talk to a customer representative."
What do you mean 7: I started at 5, now I'm 7, after being 2.
I'm not sure what happened here, but if you give me a number in a queue, I'd expect it to decrease with time, NOT increase. I waited for about 20 minutes and this pattern kept repeating: you are number 5...4...6...3...2...5. I hang up.
I tried again later, and the same thing happened. However, this time I waited until I could place my order.
Jason B. MacDonald and Kirk Smith wrote a paper titled "The effects of technology-mediated communication on industrial buyer behavior," published in the Industrial Marketing Management
journal, stating that the satisfaction level with any point of communication with a company has a great effect on future purchase intentions. This is clearly such case where my satisfaction with this broken queuing system almost determined my purchase. I hang up the first time and only called again because my mom likes to hang pictures of her kids in her living room. If it were up to me, I wouldn't have called back.
I do wonder if the managers of this company know or care their system is broken, and that this automated mistake has a negative effect on their customers?
Football commercials (Football == Soccer)
Friday, October 05, 2007
La Tota y mi viejo me dieron la vida,
las nenas y la bruja el amor,
el futbol me dio coraje,
y la Seleccion el corazon.
Cheese? Yes. Understandable? It's one of those things: you have to be there to get it.
Ronaldo's injury video
Monday, October 01, 2007
Brazil's Ronaldo is one of the top scorers in the world. He
has played for the best teams in Europe and he is now playing for AC Milan, in Italy. He's also prone to injuries and every team knows this, yet he's able to demand top Dollars (or Euros) for just sitting on the bench, not even training.
This time around Ronaldo injured himself kicking a ball during a warm-up session before a Milan game. See for yourselves:
Bad luck for el gordo. Incredibly back luck.
You can't blame players for getting injured; however, as part of the healing process, I'm sure players blame themselves for doing that extra movement, or jumping to high, or putting their leg just a little too far.
It's a funny thing that happens just before you get injured playing any sport: you know milliseconds before the pop that whatever that pop will damage it will really hurt a couple seconds after it happens. And you keep repeating the instant of the pop in your mind for a thousand times wondering what you could have done to prevent the injury. Eventually, you learn to let go and just concentrate on getting better.
Finally, a good battery
It sounds too good to be true, but if scientist have indeed discovered a way to make batteries last for up to 30 years without a single charge, then this new battery will change the way we live.
The impact of such technology is far reaching. And I can't wait for my ThinkPad to include a long lasting battery, a betavoltaic battery