Thursday, August 29, 2013

Apple Mail adds link to span content

I don't know the root cause, but the problem is Apple Mail somehow adds hyperlink to span content. It will show hyperlink for To fix this, I use


During the testing, if I put All rights reserved., the reserved will be changed to hyperlink, strange. So the simple conclusion is: use p instead of span.

SVN update 403 error

Once in a while, when I update codes from SVN, I get the following error: Server sent unexpected return value (403 Forbidden) in response to OPTIONS request for '' If I go to command line to run svn up, I get the following error: svn: E155036: Please see the 'svn upgrade' command svn: E155036: Working copy '/Users/jimz/Workshop/dev' is too old (format 10, created by Subversion 1.6) I might imply the SVN GUI tool uses different version from svn command line. I could not figure out the root cause of 403 Forbidden, but after I delete local Working copy, and checkout the whole folder, then it works. No root cause, but solution for quick turnaround.

Sunday, August 18, 2013

Lessons - startup

  1. Make most decisions by consensus, but have a single CEO whose decisions are final. Make it clear from day one.
  2. Pick the initial team very carefully. Everyone should be pleasant to work with, have at least one skill relevant to the business they’re spectacular at, be extremely effective and pragmatic. Everyone should have product sense and a shared vision for the product and the company.
  3. The standard you walk past is the standard you accept. Pick a small set of non-negotiable rules that matter to you most and enforce them ruthlessly.
  4. Most investor advice is very good for optimizing and scaling a working business. Listen to it.
  5. Most investor advice isn’t very good for building a magical product. Nobody can help you build a magical product — that’s your job.
  6. Product sense is everything. Learn it as quickly as you can. Being good at engineering has nothing to do with being good at product management.
  7. Product comes first. If people love your product, the tiniest announcements will get attention. If people don’t love your product, no amount of marketing effort will help.
  8. Don’t guess. Measure.
  9. Market to your users. Getting attention from people who won’t buy your product is a waste of time and money.
  10. Product comes first. Selling a product everyone wants is easy and rewarding. Selling a product no one wants is an unpleasant game of numbers.
  11. Inbound is easier than outbound. If possible, build the product in a way where customers reach out to you and ask to pay.
  12. Minimize complexity. The simpler the product, the more likely you are to actually ship it, and the more likely you are to fix problems quickly.
  13. Pick implementations that give 80% of the benefit with 20% of the work.
  14. Every once in a while, get away. Go hiking, visit family in another city, go dancing, play chess, tennis, anything. It will make you more effective and make the people around you happier.

Browser developer tool

Built-in browser developer tool really helps Web development, the all-in-one development environment is getting better and better from desktop browsers.

Chrome: This is my favorite
Firefox: Firebug extension, but I think Firefox 23 built-in tool is cool and promising
Opera: Dragonfly, very clear and easy of use
Safari: Xcode style, hard to use. I seldom use it unless I need debug iOS safari (mobile web remote debug)
IE9: F12. So hard to use, but IE11 is getting much better based on .NET magazine. Hope it will catch up Chrome/Firefox.

Usually the features available from these browser developer tools are similar, and they should Element inspector, Style box model, Resource browser, network activity, Performance, profile, Console etc.

Here are some tips I just learned or I don't use frequently:
  • Don't forget right click in developer tool - the contextmenu has some surprises
  • Debugging Minified JavaScript
  • Emulate a User Agent
  • Checking DOMContentLoad and Load Event
  • Incrementing CSS Values - Simply use the up and down cursor keys to increment/decrement by a unit of 1.
  • console.log() for outputting debug info, will work printf style. like console.log("The flower is %s.", "red")
  • console.assert() can be used to test whether expressions are true or false.
  • console.table() can be used to output data from an array of arrays or a list of objects in a sortable, tabular format.
  • You can automatically create a breakpoint in your code by adding the following line to your JavaScript: debugger;

Tuesday, August 13, 2013

Versioning main.js in requirejs

        var require = {
              paths: {
                'main': 'main.js?v=MD5_MAIN'
<script data-main="js/main" src="js/lib/require/require-2.1.5.min.js"></script>

This is one way, and need make sure require config is before require.js script tag.

Another way mentioned in the issue by requirejs author jrburke is using directory. This is a better way than querystring.
<script data-main="v1/js/main" src="v1/js/require.js"></script>

Thursday, August 1, 2013

Flash acoustic echo cancellation

Acoustic echo cancellation (AEC) is required for voice-over-IP (VoIP) applications to provide headset-free talk. AEC is available in messenger applications (such as Skype and Google Talk) and softphones (such as Xlite).

In Flash, to use acoustic echo cancellation, call the Microphone.getEnhancedMicrophone() method to get a reference to a Microphone instance. Set Microphone.enhancedOptions to an instance of the MicrophoneEnhancedOptions class to configure settings. When AEC is not supported, Microphone.getEnhancedMicrophone() returns null.

Here are sample codes:
var mic:Microphone = Microphone.getEnhancedMicrophone();
var options:MicrophoneEnhancedOptions = new MicrophoneEnhancedOptions();
options.mode = MicrophoneEnhancedMode.FULL_DUPLEX;
options.echoPath = 128;
options.nonLinearProcessing = true;
mic.enhancedOptions = options;
There are two other settings similar but not exactly for acoustic echo cancellation.
  1. setUseEchoSuppression - this method can reduce, but not eliminate, the risk of feedback amplification. When enhanced audio is used, this echo suppression functionality is ignored.
  2. noiseSuppressionLevel - Maximum attenuation of the noise in dB (negative number) used for Speex encoder. If enabled, noise suppression is applied to sound captured from Microphone before Speex compression. Set to 0 to disable noise suppression. Noise suppression is enabled by default with maximum attenuation of -30 dB. Ignored when Nellymoser codec is selected.