Archive for the 'Software' Category

Shanghai on Biz

July 07th, 2010 | Category: China,Entrepreneur,Software

Before heading to Shanghai, and while I was there, numerous people asked if I was going to the Shanghai Expo which is, as far as I can tell, the equivalent of a World’s Fair.  It has drawn thousands of extra visitors to Shanghai and lasts a full six months.  Well, I couldn’t find a compelling reason to go.  Hearing that there were long waiting lines sealed the deal.  Why do I want to do this?  OK, on to the real story:

The real reason for going to Shanghai was to have another CMIC retreat with Chris.  Peter and Chris had been to Shenzhen twice before, and since Peter’s trip to the US freed up a bed, the idea to spend some time working closely with Chris was hatched.  Well, I stayed about five full days and we worked every day from morning until bedtime only breaking for meals and the World Cup match between Argentina and Germany.

Well, I can’t argue at all with the results of the trip:

  • Peter and I blasted through a release of the 1.1 software the day I arrived.  Actually, he upgraded the servers with all the changes while we were asleep and I made sure the system was running as expected the next morning.  A few bugs were discovered (as well as some fraudsters), but we took care of it quickly.
  • Chris and I, working side-by-side, cranked out the callback feature making it possible to initiate calls as well as send calls.  I knew we could get this done during the trip, but I was surprised that we got it working end-to-end in just two full days.
  • I bumped up my bash command line skillz several notches by just sitting with Chris and asking questions.  I really hope to be able to zip around the shell soon.
  • Chris took me on a survey of the Ruby on Rails development system, which looks like a real pleasure to program in.  I can’t wait to learn it inside and out.  I also spent some time alone working on some sample code and problems.

Some fun things we did:

  • We worked in some great locations, notably:  1) The Park Hyatt Cafe at the millionth floor (ok, 91st) of the International Financial Center (IFC) building.  We enjoyed expensive (and decent) cappuccino and the best view in the city.  2) Mocha Cafe in People’s Square Park.  This place is hidden behind the entrance to an art museum.  It appears to be unknown to the masses because, despite its size, there were only a couple of parties there.  We enjoyed a hot lunch in the humid pre-storm afternoon, then escaped inside to AC while it poured outside.  It felt good to crank out more code while looking out onto the park in a thunderstorm.
  • Watching the Germany – Argentina game in a German restaurant.  We got the best seat in the house simply by asking, “Can we put a table HERE?” From experience, I predicted that Germany would win and that if Argentina got behind, they’d fall apart.  Neither of those was incorrect.  The Germans in the restaurant were quite mean to poor ole sad-looking Maradona whenever his face was shown on the TV.
  • Enjoyed the Monday special at Malone’s:  a 50 RMB colossal hamburger at Malone’s.  I hadn’t had a hamburger like that in months.  My was it tasty!  I respect Chris for eating another half of one, including the fries and the pint of beer it came with.  He said the week before he ate two.  Respect.

Some innerestin’ things:

  • Shanghai felt so different this time around.  I guess the last time I was there with Robert, we frequented visited Suzhou, got scammed by tea show representatives, bought knock-off ties on the street, and witnessed rats skittering through local hole-in-the-wall restaurants.  But this time, I had to make a special effort to speak Chinese, it seemed like.  Every single restaurant was full of foreigners and most every waitress spoke fine English.  It was good to get back to Shenzhen for this reason.
  • Shanghai was also quite expensive this time around, restaurants especially.  Granted, we didn’t do any street food, but even the Chinese restaurants was at least 130 per person (a little over $19 USD).  I guess the cheapest was an Indian restaurant with a lunch special.  That cost us 91 RMB.
  • There were tons of foreigners.  Plenty were quite obnoxious.  ‘Nuff said.
  • The Chinese were generally more behaved and urbane.  I saw no egregious violations like peeing in the street and only one spitting incident.
No comments

PHP and MySQL on the Mac

April 24th, 2009 | Category: Entrepreneur,Software

I now am needing to learn more about PHP, MySQL, WordPress, and so on. As you may know, this site you’re now reading runs on WordPress software, which, for the most part, I’ve been happy with. But, if I want to add my own customizations or just play around with different ideas to try out on WordPress, running a test site online is not so practical (especially with the pitiful speed of my internet here in China). So, I looked into running WordPress locally on my Mac. I had to hunt down four things to install and configure: Apache, PHP, MySQL, and WordPress. I spent four to five hours downloading, installing, and troubleshooting. In the end, it wasn’t so hard, but pulling all the info together from various websites was quite time consuming. So, I spent 20 minutes this morning culling the important information and distilled how I did it into a five-page document.

You can download the pdf file here.

It sure is nice having this set up locally. It’s incredibly fast (obviously) and as easy as editing and saving files in a basic text editor.

1 comment

Personal Code Review

March 11th, 2009 | Category: Entrepreneur,Software

In my “The First Three Weeks” post, I mentioned how one of my first projects is to re-release my shareware.  I have two closely related shareware applications.  Both are “Download Managers”, which make archiving websites, and downloading in mass easy.  My applications are written in MFC and ATL, ancient technologies by today’s standards.  This project has been occupying most of my working time; my other projects are mostly being outsourced right now.  For example, logo work and graphic design is something that must be done but I personally have no talent to do it myself.  Witness the lousy graphics that I created myself or borrowed from freeware in my last shareware release.  So, even though collecting bids and reviewing work can be time-consuming, that option sure is better than pretending I can do it myself and wasting time and effort.

But, how easy it is to digress.  So, back to the main point.  This is the first time I’ve been back in my shareware code in nearly six years.  Also, this code was written about nine years ago.  My how the time does fly.  It’s interesting to see how my coding style has transformed over the years.  So what have I noticed?  Well, why not give myself a code review for everyone interested to see?  Here it goes:

Strengths:

  • Organization – The code and projects are organized well.  It’s easy to find things and there is very little duplicated code.  The code is organized well for reuse.
  • Loosely-Coupled Code – Code is easy to move around or remove entirely without too many side effects.
  • Well-commented – The code is easy to read and commented well.  There are some fairly obscure sections that would have taken me a long time to figure out, but the comments gave me a great starting point.
  • Easy to localize – Dialog and string resources are managed well and it’s a piece of cake to localize the applications into multiple languages.

Weaknesses:

  • Error Handling – The error handling is generally good, but sometimes very lax.  There are a few egregious violations like a string buffer being passed to a function with no indication of length.  The function assumes the buffer is at least 64 bytes.  Yes, I have fixed that.  Microsoft educated me well on defensive programming.
  • Unicode support – In most places, you could tell that I was paying attention to Unicode, but I had to spend at least a full day updating the rest of the code to be cleanly build both Unicode and MBCS builds.  However, I discovered one big problem:  I realized my home-grown HTML parser simply did not work in Unicode.  And, it’s not a simple matter of using TCHARs or something like that…
  • HTML Parser – For the sake of speed, my parser assembles DWORD tags from HTML and matches them to predefined HTML DWORD tabs like “<ahr”, “<ima”, “<bas”, etc.  When I started writing this app, the web was still quite young and HTML parsers weren’t so common.  The MS DOM probably existed, but since it’s shipped with IE, I, like most normal people, probably assumed that IE could easily be uninstalled in favor of another browser.  Regardless of how engrained IE is into Windows or Anti-Trust rulings, I didn’t want to rely too much on third party libraries.

    I do have my full Unicode builds working now, but my parser doesn’t work.  It’s quite the understatement to say that’s a big problem.  The jury is still deliberating about what to do.  The easy answer is to just stick with a multi-byte character set build, which still works great.  I may do that for the first re-release and then upgrade the parser to use the DOM for the next release.

    The parser really does need an upgrade because it’s also quite complex.  There is a lot of code in this “pointer” style (and this is one of the easier sections):

    TCHAR* pBM = buffer;
    while ( _T('#') != *pBM && *pBM )
         pBM++;
    ...
    if ( _T('#') == *pBM )
    {
        *pBM = NULL;
         token = ST_HTML_FILE; 
    }

    So, with a lot of code like this, maintenance is a bit of a problem.  Time for something more reliable and easier to manage.  My IE plug-in application uses the DOM for parsing and it’s much simpler, however, that application does not need to update the links in the HTML to match the users hard drive.

  • Feature happy – Well, this one isn’t so serious because my applications already aren’t very feature heavy, but I do have a few silly features and additions that don’t provide any value.  I gained a new appreciate of this problem at Microsoft.  It was something that I fought against constantly.  Maybe I’ll write more on this later, but I was shocked at how much effort and time we put into useless features.  But, hey we did, and I sometimes felt like an outsider for opposing them.  Anyway, because of my appreciation for a feature done well vs. a mad mass of confusing features, I’ve cut my non-essential features and frills.
  • Graphics – That’s why I’m outsourcing this next release.

In summary, I’m happy with the code.  Though I’ve expanded more on the negatives here, I’d rather have this strength/weakness profile than have it flipped!  That would be a much tougher problem to deal with.  That would basically mean rewrite.  That would tempt me to abandon.

No comments