What Gas Stations and Yoga Schools Have in Common

In the past two days I attended a party with Gas Station owners, and then a Yoga school. These two events gave me the material for this blog. So what do a gas station and a yoga school have in common? Both types of small businesses use software. What a revelation! To be more specific, in both cases I saw the room for improvements in software.

Actually, I started writing about gas stations eight years ago. Senior (literally) Java developers may remember the times when reading printed glossy magazines on software development was a norm of life. Eight years ago I wrote a series of articles under the category “Yakov’s Gas Station”, which was printed in Java Developers Journal. You can still find them online.

Anyway, during the party conversation my wife mentioned an episode at a gas station that happened a couple of years back. We live in New Jersey, which is one of two privileged states where people are not allowed to fill gas tanks themselves. You pull down to the pump and keep sitting in a car like a tsar. The gas attendent will come over and will do the rest. He started filling my wife’s car at one price, then changed the price (increased) on their large billboard, then came back to the car trying to charge this transaction at a new price. My wife didn’t agree, and after a short and colorful conversation she won (what’s new?).

Our friends (gas stations’ owners) told us that in New Jersey it’s illegal to continue pumping gas if the the gas station owner needs to change the price. The owner should stop operating all pumps, change the price, and then resume work. This is how it should work in theory. But in the real life, you may lose customers if they’d be asked to wait. I was surprised that the gas station owners didn’t see it as a big deal.

I started to tell them that there is a better software solution, which could be implemented allowing continue pumping gas and changing the price without affecting the customers who are in the process of getting filled. Software developers know that I was thinking of implementing proper synchronization locks that would freeze the price that was in effect when the pumping started. Why it was not done? Software architects didn’t care about these small business owners, which would accept that “This is how the system is set up and we’ll use it this way“.

Now the Yoga school. They sell various types of monthly and yearly memberships that would allow attending unlimited classes – as many as you want. The problem is that I don’t need this all-you-can-eat option. Going there twice a week it more than enough for me. Any other options available? Yes, you can purchase 10 sessions at a discount price and attend them on an a la cart basis.

Now we are talking! Can I buy these 10 tickets and share them with my wife? No, the system is not set up this way. Sure, they’ve designed the database linking these tickets to the members’s ID. It’s a wrong software solution again. Why not keep things simple? A ten-session ticket is supported by a single database table with two columns: tktID and RemainingSessionsCounter? The customer comes in, hands the ticket to the girl who scans or enters the ticket number into that computa, and the program decreases the counter. Simple? Yes. Good for the business? Yes. Good for the customers? You bet!

The problem is that software creators have to build their systems based on what the customers needs. Yes, the customer may not know any better, but what about you?

Four years ago I was a part of a small group of people who created a startup for automating small-scale insurance business – the agencies. Back then agents were using a mediocre software that was available. We had almost no knowledge about how the small insurance businesses operate. But we didn’t like what we saw. Insurance agents also didn’t know any better. Today, more than a 100000 agents across the country are using our software called SureLC. They are happy, we are happy.

Steve Job once said, “People don’t know what they want until you show it to them.” So if you are about to automate a business, don’t just have write software implementing existing workflows. Think about the customers, and when your next system will go in production, people will say, “Wow, we didn’t know it was possible!”

Listen to Youtube

I don’t have time to read. Because of that I listen to audio books on the go, and it’s really great. During the last ear I’ve consumed a dozen of novels (yes, non technical books), can you believe this? I did it while walking, driving or riding. Listening to the books is great.

I also listen to audio podcasts,lectures, and radio programs available as audio files or as a stream.

But what to do with video presentations from youtube? There is some great content there that I would not want to miss. On the earlier stages of my evolution I was using the Firefox plugin called dwhelper, which can save (most of) youtube videos in the files in mp4 format. Then I’d copy it to my iPhone to play using the VLC application.

When I walk or drive I can’t watch the iPhone screen. I listen. You’ll be surprised, but most of the presentation slides are pretty much useless for the audience. You can listen to the audio and visualise what the speaker refers to. With presenters like Steve Jobs it was easy – there were no program listings on his slides. It’s not difficult with most of other speakers too – they read from Powerpoint slides anyway.

So now I’m getting rid of the video part completely. This is how it works. Go to youtube and find the video you’d like to listen to, for example, Martin Fowler’s intro to NoSQL: http://www.youtube.com/watch?feature=player_embedded&v=qI_g07C_Q5I

Then copy this URL to a converter service that can extract the MP3 out of it. So far I’ve been using free service at http://www.vidtomp3.com. In some cases it works very fast, in some cases it’s slow, but it does the job. Copy the mp3 to your audio player and consume the info on the go. This is all it takes.

P.S. If you of better ways to consume info, please share.

P.S.S. If you believe that we already have too much of the information to consume, do not follow my advices. Consult with your therapist.

jQuery Mobile chapter is done

The draft of the jQuery Mobile chapter is done. As usual, your feedback is appreciated http://enterprisewebbook.com/#_jquery_mobile.

If there is something to be changed, please open the issue on github at https://github.com/Farata/EnterpriseWebBook. See something? Say something! 🙂

Started writing the chapter on Sencha Touch. This book never ends. It has already more than 500 pages. I promised O’Reilly that all drafts will be ready by mid-August. It’s not easy, but possible.

Please do me a favor, check the book’s text on your smartphone. We’ve implemented responsive design there, and it should be properly laid out on small screens too. Please leave the comment to this blog specifying the model of the mobile device, the name and version of its OS, and if the text looks decent there.

Categories Web

How we write a book for O’Reilly

In the past, to write a book the writer would need a quill pen. After a while, Microsoft Word replaced the goose feather. Today, any Word processor is not good enough. You need to have tools to generate the book content in various formats to be read on various devices. Things get complicated if you have more than one writer working on the book. Now you need a distributed version control system.

We’ve recorded a Webcast showing how we write a technical book for O’Reilly Media. This Webcast is not about the book itself, but rather about the process of writing the book and the software tools we use for it.

The recording is available here. This is an interactive recording – you can switch it to the full screen mode.

What Makes America the Greatest Country in the World?

My son Dave bought the DVDs with the first season of the HBO’s series “The Newsroom”, and we watched the first episode today. In the beginning, they showed a press conference, where a journalist asked a TV anchor, “What makes America the Greatest Country?”. He could not give a decent answer, which got me thinking, “How would I answered this question?”

I live in the USA for twenty one years. Before that I lived in the USSR. I’m an American citizen. I don’t have any other citizenships. I can compare. I can observe. I can speak up freely.

To put it short, the USA is the most wanted country in the world. That’s why it’s the greatest country in the world. Of course, not 100% want to relocate to America. But most of the people do even if they say otherwise.
People vote for America by putting the money (or lack of thereof) where their mouth is. People find any possible way to get their feet on our soil. Some people are educated and they know exactly why they want to come here. Some people simply get a gut feeling that this is the right place to live and raise children.

Some people use this magic word “opportunities” without knowing exactly what it means. For most of them it’s an expectation of some miracle. Say, I’m a poor guy from Pakistan working at a gas station, and one day the the Rolls-Royce pulls over and my life will never be the same. Or more realistically, I’ll work for 7 years and make enough money to buy a house in my country and my family will live better. Because of America. There’s something in the air…

_MG_8298

Living here for two decades, I can say that the USA is not a rosy place where life is good for everyone. I see double standards in politics. I see that we are sending our kids to wars where we shouldn’t be. I see fraud in financial and insurance industries. I see how lawyers rule here, but they do it according to the laws and not the bribes. I know that pharmaceutical companies do what they want in pricing, but people have pills. Maybe too much of the pills. I had to go through a surgery. After getting a second and third opinion, I picked one of the best surgeons in the country and everything went perfect.

But I also see that there is law in this country. A policeman is not your enemy (even if you’re making 80 on 65). I see that if you have an idea for business, this country doesn’t stop you. Go ahead and try it out. If you made a mistake, try again.

This is the country with the most stable financial system. People from around the world send their own money to America for storage. Technically, they give us the money for free, without the interest. Dollar up, dollar down, but it’s The World’s Currency.

The high education is one of the most respected and recognized in the world. Seven hundred thousand foreign students get their higher education in the USA.

I see that more that 200 nationalities learned how to live together and respect each other. Do they really like each other? Not always, but they respect the rights of other to be here. Live and let live. Again, it’s not perfect. The Ebony and Ivory problem still exists. But it’s better than in any other multi-national country.

We have fair elections. They may not be perfect, but when Barak Obama won, I knew that he won not because some people cheated on counting votes, but because he’s a winner according to the today’s laws.

I like the fact that people are smiling to each other. Not as much as before 9/11, but they smile. I like the fact that most of the people you are contacting try to help you and not take advantage of you. Retired people can maintain a decent lifestyle and enjoy good medical treatments (at least till Obamacare will come into our lives).

That’s why the USA is the greatest country in the world in my opinion. This is not the right country for everyone. If you need siesta and fiesta on the daily basis, your native Colombia or Brasil is a better place for you. But why all these Mexicans are risking their lives illegally crossing the border every day just to get to the American soil without education, English or profession? I guess, they decided that America is the greatest country in the world. I decided this wehn I was a kid and have never changed my mind since.

PRISM, Government, and Software Developers

In 2013 having a landline phone number is bad. It doesn’t give anything but these annoying calls from telemarketers. The only reason I keep it is that it’s a part of the internet-phone-tv package provided by a phone company for cheap.

During the last week I started getting about 10 marketing calls a day, which I don’t pick, but they interrupt whatever else I do. So I decided to visit the National Don’t Call Registry, register my phone number online, and if after 31 day after registration someone still calls me, I have a right to complain to the government. Cause my government cares about me!

I have even a better idea. Since the government records all the phone numbers and the lengths of calls of businesses, why won’t they simply disconnect the numbers after say a thousand people picked their calls and hung up within 5 seconds? Hey government, get the PRISM program a real assignment!

Actually, I decided to write this blog for a different reason. Every time I run into an idiotic Web design, I want to share this with as many people as possible. Now take a look at this registration form, where I was supposed to enter my phone number.

dontcall

This is one of my favorites. The goverment has enough money for the PRISM program, but not enough for hiring decent Web developers. How should I enter the phone number? You pick:

1-212-333-5555
(212) 333-5555
2123335555
12123335555

In 2013 you can’t ask people to worry about the phone input format! If you are really smart and a detail-oriented person, you’ll read the small print in red “Please enter only numbers in Phone Number Field”. Not only that dumb Web developer knew how to strip away the dashes, spaces, and parens from the HTML form field, he doesn’t even not how to display that message in red in larger font and before the field itself!

No biggies. American citizens have time. They can experiment and somehow figure out the right format.I can tell you even more. That dummmy government employee didn’t even care about validating the input! You know these red borders that may appear in the fields with invalid entries? I’ve seen those too.

But this coder did not bother. Guess what he did? In the page markup he just specified that the length of the field has to be 10 characters. As simple as that. I’ll show you the code fragment from that page (no worries, you’ll get it even if you have no clue about Web programming). Check this out:

dontcall3

Any characters the user enters after the first ten will be quietly cut off. If the server-side code was written by the programmers of the same quality, the crippled phone number will be entered into the database.

I request the US Government to reveal the whereabouts of this software developer, the QA tester, and his manager. If any of them is a US Citizen, their passports have to be revoked forever and they should be sent to Cuba by the Aeroflot flight #150.

Blogging and Meditation

I’d like to share with you an interesting side effect of blogging that I recently discovered… through Yoga.

During the last 10 years I was blogging pretty actively. To be precise,  I’ve   published more than 900  blogs here, at yakovfain.com. All these blogs were written in English, and the comments were written by English-speaking people from around the world.

During the last 5 years I’ve been also actively recording audio podcasts in Russian at americhka.us, where I published about 400 podcasts. These podcasts are commented by the Russian-speaking people from around the world.

The cultures of the English and Russian blogospheres are different. English speaking people are more polite. If they don’t agree with what I say or write,  they try to express their opinion rather than just writing “It’s bullshit” in comments.  This means my English-speaking readers respect me. Some people say that Immanuel Kant defined respect as the right for another person to have  different opinion (this is not an an exact quote, but the meaning should be correct).

The situation in the Russian-speaking blogosphere is different. Pretty often people do not tolerate other people’s opinions, and you can find the “It’s bullshit”-type comments a lot more frequently there.

I’m not complaining – I have a lot of Russian-speaking readers and listeners who enjoy my podcasts and respect my opinions. I’m just sharing my observations. Five years ago I was caught off-guard by the harsh and sometimes insulting tone of some comments there. I even had to leave one Russian podcasting portal for the lack of any protection from these negative people.

When I opened my own site at wordpress.com, it gave me  the moderation and banning features. I started controlling the content and banning offenders (I banned about a dozen of people over the last 5 years).

 

Now let’s switch the subject. Last month I’ve enrolled in Yoga classes. This membership allows me to attend unlimited classes ran by various instructors. I’m not a gym-type of a person, and decided to go easy on myself  – I started attending only the meditation classes for now. The teacher is from India, and he spent more than thirty years researching studying of various Yoga masters. I like the teacher.

Many people who attend his class complain about being under stress. Yesterday, one lady came to the class being extremely angry with her husband. The other lady (I’ve never seen her before) spent five minutes before the class telling me how that bad brother-in-law came back into their family’s  life.  People have problems. They are coming to relax and meditate.

The teacher explains that the problems are inside each of us. If someone directs their negativity toward you, just concentrate within your inner self. Do not react to the offender.

I like attending his sessions cause he’s the wise guy. But on the other hand, I noticed that I’ve learned not to respond to the offenders by being in the open in a not-so-friendly blogosphere. I’ve learned to ignore angry comments. It seems that I’ve been already applying these meditation and protection techniques without even knowing about these Yoga studies!

So I want to thank Russian blogosphere for making me a stronger person. No, I haven’t reached the turn-the-other-cheek level suggested by Gandhi and Jesus.  I’ll keep moderating comments. But I’ll remove the bans from those angry birds. Let them keep chirping.

Peace!

HTML5 book. The Eplogue. Take 2.

Even though this book is about HTML5, the authors would rather work with compiled languages that produce applications to run in virtual machines. Such software platforms are more productive for development and more predictable for deployment. While writing this book we were often arguing about pros and cons of switching to HTML5, and so far we are concerned that the HTML/JavaScript/CSS platform is not ready for developing of the enterprise applications just yet. We live in the era when amateurs feel comfortable creating Web sites and that JavaScript provides flexibility and customization the Access and Excel provided in the old good PC times.

Till this day Microsoft Excel is the most popular application among business users in the enterprises. They start the application locally, it has a local storage that enables work in the occasionally-connected scenarios. Both the data and the code are physically located close to the user’s heart. Microsoft Excel allows the users to have her own little pieces of data and amateurish-but-working-code (a.k.a. formulas) very close and personal. Right on the desktop. No need to ask these IT prima donnas for favors. No dependencies on the connectivity or some mysterious servers being slow or down. The most advanced business users even learn how to operate MS Access database to further lessen the dependency from IT.

But there is only so much you can do with primitive tools. Visual Basic was “JavaScript” of the nineties – it had similar problems, but nevertheless had huge followings. Now the same people are doing JavaScript. If we don’t break this cycle by adopting a common to all browsers VM, we are doomed for going through the generation after generation of underpowered crap.

Recently, one of our clients from Wall Street sent us a list of issues to be fixed in an Web application that we were developing using Adobe Flex framework (Flash Player was the VM, where this application ran). One of the requested fixes was “remove a random blink while a widget moves in the window and snaps to another one”. We’ve fixed it. You may argue that Flash Player as any browser’s plugins are going away. But the bar set by Flash based enterprise applications is set pretty high. We hope that future enterprise Web applications developed with HTML6 will raise the expectations in the user experience area. The time will come when HTML widgets won’t blink in any of the major browsers.

We wrote this book to help people with understanding of what HTML5 applications are about. But make no mistakes – the world of HTML5 is not a peachy place in the future preached by educated and compassionate scientists, but rather a nasty past that is catching up bringing the mob with it.

It’s a past and it’s the future. The chances are slim that any particular vendor will win all or even 80% of the market of the mobile devices. In competitive business, being able to make an application available ONLY to 80% of the market is not good enough, hence the chances that any particular native platform will dominate in the Web developers are slim. HTML5 and related technologies will serve as a common denominator for mobile developers.

The authors of this book have more than 100 years of combined experience in development of enterprise applications. Over these years we’ve learned that the saying “Today’s on Wall Street, tomorrow on Main street” works. IT departments of financial companies are very pragmatic in selecting tools for development of their software. Especially, we’re watching the platforms used for development of financial trading applications – they must be fast, reliable, and any delays in processing or clumsy UI may lead to substantial money losses. Besides, the development cost dramatically increases if an IT organization sets a goal to offer their trading application to the entire mobile market, which is a moving target today and will remain the same in the foreseeable future.

Check out the trading application tradeMonster. It has been developed using HTML5 and uses the same code base for all mobile devices (they use Flash Player in the desktop version). Yes, they have created native wrappers to offer this application in Apple or Google’s application stores, but it’s still an HTML5 application nevertheless. You can create a paper trading account (no money is involved in trading) and test their application. If you like it, consider using HTML5.

Enterprise IT managers need a cross platform development and deployment platform, which HTML5 is promising to be. Take with a grain of salt all the promises of being 100% cross-platform made by any HTML5 framework vendor. “With our HTML5 framework you won’t need to worry about differences in Web browsers”. Yeah, right! HTML5 is not a magic bullet, and don’t expect it to be. But HTML5 is for real and may become the most practical development platform for your organization today.

Hack: iPhone, USB, Macbook, Web Server

If you are developing a Web application for a mobile device, it’s great if you can run it on  a real device. Sure enough, you can deploy your app on the remote publicly available server and then enter the URL of that server from your mobile device. This strategy works for any mobile device.

But I had a more specific case: I have two Apple devices: MacBook (my development machine) and iPhone – my mobile device.  I wanted to connect to the Web Server running on my MacBook from my iPhone connected to the USB port of MacBook. To put it simple, I wanted to eliminate the step of deploying the Web app on a remote server.

I’ll share with you all experiments I’ve done this morning till I made it work. I’ll appreciate your feedback if can offer some explanations of the Web server weirdness I had to overcome.

1. Both devices have to be on the same Wi-Fi network.

2. You need to know the IP address of your MacBook on this local network – this is the part of the URL to enter in the browser of your iOS device. There are two ways of finding this IP address: either open System Preferences | Network – the IP address is shown right under the Wi-Fi connection or run the Network Utility to see it there. In my case it was 10.0.1.3.

3. Start the local Apache Web Server that comes with Mac OS.  Prior to Mountain Lion doing that was easy – System Preferences | Sharing | Web Sharing.  Now Apple removed this option, but Apache Web Server is still there. you can start it from the Terminal as “sudo apachectl start” and stop with “sudo apachectl stop”.  After start, enter http://localhost, and you’ll get this given you’re Mr. Fain: webserver

4. The document root directory of this server is /Library/WebServer/Documents. This is where you need to deploy your HTML files.

5. Here’s the problem: if you’ll try to access this Web server from your iPhone (e.g. http://10.0.1.3), you’ll get the error “Safari Cannot open page because it could not connect to the server”. Adding the port 80 to the URL didn’t help.  The interesting part is that when I tried to start another server on my computer – it was Apache Tomcat running on port 8080, I was able to connect to it from my USB-connected iPhone. This gave me a hint there there is something wrong with the port 80.

Disclaimer 1. I still don’t know what kind of setting should be changed on the Web server to allow such connection. If you do – please share.

6. Change the default port where your Apache Web server runs. Change to the directory /etc/apache2 and edit the configuration file httpd.conf  using  “sudo nano httpd.conf”.  Find the line that reads “Listen 80 ” and change 80 to another port number, for example 8000.

Now my iPhone can reach my local Web server via the USB connection by entering the URL: 10.0.1.3:8000.

Update: I just got a hint that instead of IP you can use the computer name shown on top of the Sharing screen in System Preferences. In my case the URL would look like http://Yakov.local:8000

photo

What’s left?  To deploy your Web applications under any Web server that runs on any port but 80.  It doesn’t have to be  internal Apache Web server.  As I said before, you can  use Tomcat or  any easy to install and start Apache Server packaged with XAMPP (again, change the port).

Disclaimer 2. I don’t know why the internal server that comes with Aptana IDE and runs on port 8020 still doesn’t respond to my iPhone-USB setup.  If you do,  please let me know.

But the good news is that you don’t have to use the internal Web server with Aptana IDE. you can configure it to use Apache Web – I’ve described the process in Chapter 5 of our upcoming book on Web development in the sidebar “Configuring Aptana IDE to use Apache Web Server”.

Do you know if a similar setup is possible with Android devices without the need to install any heavy SDKs?

 

Technical books are getting thinner

While working the upcoming book on Web development, I keep stopping myself from writing too much. And this is what I want to talk to you about.  In the past, technical books were a lot fatter than today. A typical book on computer programming was a thousand pages long.  If the author(s) wanted to cover a set of related technologies (like J2EE or .Net) the book could span 1500 pages or more. People were used to read books because Google, Stack Overflow, Youtube and Vimeo were not invented yet.  Today, majority of software developers are googgling trying to find a code snippet to copy-paste, and the smaller part of the programmers watches video recordings from conferences.

I’m not sure if O’Reilly started this “Get Slim” movement, but recently I ran into their book, which was only 60 pages long. Want to be a published author? Easy. Write sixty pages and update your resume. This is yet another example of devaluation in action. The next step is to increase the font and add some comics-style illustration like in books for children.

I’ve just have submitted a 38-page chapter on selected HTML5 APIs, where I reviewed History API, Web Messaging, Web Workers, Offline Web applications, Web Storage, and IndexedDB.  Can these materials get a decent coverage in 38 pages? Yes, if the reader has some background in Web development and know how to self-study. Yes, because the code example are focused on the covered API as opposed to offering a 200-line code samples of which 180 lines is the author’s favorite set of utility functions, which he uses daily.

When you submit a proposal for the book, the publisher asks for the estimated number of pages.  A year ago we estimated that the book would have 600 pages. Most likely it’ll have a little more than  650 pages, which is a really thick book by today’s standards.  I also know that we’ll get several  reviews stating that the book doesn’t cover some of the topics in depth, which is perfectly fine. The main goal of a good technical book is to ignite the reader’s interest to a covered topic and give some   kick in the right direction so googling will become more educated and fruitful.

Do you read technical books  or it’s too old-fashioned? If you do, what’s your preferred book size?