September 29, 2017

Epson Scanner + Windows 10 = Success

Got an older Epson scanner and Windows 10? Struggling to get them to work together? I was too, but finally succeeded.

About a year ago, I switched to the Microsoft Surface Book laptop. My old Toshiba was starting to “act weird.” This is the technical term for the initial symptoms of hardware breakdown that signify that new hardware is needed, and which you can ignore at your own peril.

Naturally, the laptop came with Windows 10. After getting all my software configured and data moved over, I went to set up my Epson flatbed scanner. Initially, I tried using the CD that came with it and got an “OS not supported error.” Not too surprising considering the highest OS listed on the CD was Windows XP. I had been able to set up my Dell wireless printer with Windows 10 despite both vendors claiming it wasn’t supported. But it turned out that wasn’t the case with the scanner.

I dropped the project for about a year. I wasn’t looking forward to futzing around for a few hours trying to get it to work and likely failing. I used my phone for things like documents and checks to be deposited.

Fast forward to today. I now had a more detailed graphics project that required the quality of a flatbed scanner. I looked online at new Epson scanners, both lower-end models and super fancy photo scanners. None of them listed Windows 10 as a supported OS.

This seemed odd considering how long Windows 10 has been out. So I Googled it and found lots of people asking the same question: what companies have scanners that support Windows 10? Apparently, none that admit to it.

So I decided to try setting up the scanner one more time. I succeeded in getting it to work, and here's how I did it.
  1. Go to the Epson support scanner page:
  2. Select your scanner type. In my case, it was Perfection Series.
  3. Select your scanner model. In my case, it was Epson Perfection 1670 Photo.
  4. In the Operating System dropdown, select the most recent operating system version for which you see Scanner Driver and EPSON Scan Utility. For me, it was Windows 7 32-bit. The majority of today’s hardware is 64-bit, and I could have selected Windows 7 64-bit. But in my experience, 32-bit applications always seem to run regardless of the hardware it’s running on. Whereas 64-bit software is much more finicky.
  5. Install the EPSON Scan Utility and voila!
My guess is that the success of this approach depends on how old the scanner is. Getting it to work seems unintuitive to me, so I hope this helps you get your scanner up and running!

April 05, 2016

Call the Tone Analyzer Service from C#

After I figured out how call the Tone Analyzer service from Postman (detailed in my previous post), the next step was to call it from an app and do something with the results.

To get started, I decided to create a simple C# app that calls the service. You enter the text you want to analyze and click the Analyze button. The code calls the service, returns the analysis results in JSON, and displays the results in three charts. Those charts correspond to the three categories of analysis that the service does: emotion, writing/language, and social.

This app is was inspired by the Tone Analyzer demo page. It’s an old school Windows forms app, but that means it’s easy to download and run. The code for it is on GitHub.

  • Visual Studio – If you don’t have Visual Studio installed, you can install the community version for free from the VS downloads page.
  • Service Credentials – You need an instance of the Tone Analyzer service and the service credentials. You’ll need to create an instance of the service on Bluemix, which is IBM’s cloud platform. It’s a pretty straightforward process, and you get a 30-day trial to test it out. Just follow the first steps in my previous blog post under the Create the Service & Credentials section.
To run the app on your machine, just download it, open it in Visual Studio and click Start. Be sure to put the username and password for your instance of the service in the text fields. You might want to set the Text property so you don’t have to enter them every time you run the code.

The first thing you’ll probably notice is that all of the code is in the btnAnalyze_Click event. Not a best practice by any means, but it makes it easy to see what’s going on. The one dependency this app has is on Json.NET. This is a free, open source framework for working with JSON.

The code has two primary parts: The first part of the code creates a WebRequest to communicate with the service and sets the credentials. Then it sends the request, gets the response JSON back, and shows it in the second text box.
  string baseURL;
  string username;
  string password;

  // Set the URL to the Tone Analyzer service and creds for the instance of the service
  // Be sure to set these vars or the text controls with the username and password of your instance of the Tone Analyzer service
  baseURL = "";
  username = txtUsername.Text;
  password = txtPassword.Text;

  // Get the data to be analyzed for tone
  string postData = "{\"text\": \"" + txtInput.Text + "\"}";

  // Create the web request
  var request = (HttpWebRequest)WebRequest.Create(baseURL);

  // Configure the BlueMix credentials
  string auth = string.Format("{0}:{1}", username, password);
  string auth64 = Convert.ToBase64String(Encoding.ASCII.GetBytes(auth));
  string credentials = string.Format("{0} {1}", "Basic", auth64);

  // Set the web request parameters
  request.Headers[HttpRequestHeader.Authorization] = credentials;
  request.Method = "POST";
  request.Accept = "application/json";
  request.ContentType = "application/json";

  byte[] byteArray = Encoding.UTF8.GetBytes(postData);
  // Set the ContentLength property of the WebRequest
  request.ContentLength = byteArray.Length;

  // Get the request stream
  Stream dataStream = request.GetRequestStream();
  // Write the data to the request stream.
  dataStream.Write(byteArray, 0, byteArray.Length);
  // Get the response
  WebResponse response = request.GetResponse();
  // Display the status
  // Get the stream containing content returned by the service
  dataStream = response.GetResponseStream();
  // Open the stream using a StreamReader for easy access
  StreamReader reader = new StreamReader(dataStream);
  // Read and format the content
  string responseFromServer = reader.ReadToEnd();
  responseFromServer = ToneAnalyzerTools.JsonPrettify(responseFromServer);
  // Display the content
  txtOutput.Text = responseFromServer;
The second part of the code first sets up the three chart controls. This app uses the standard chart control that comes with Visual Studio, but I think a third-party chart control like ChartFX would probably generate cleaner and more modern looking charts.

Then the code uses the Json.NET objects to dynamically loop through the returned JSON. Many thanks to Rick Strahl for his blog post Using JSON.NET for dynamic JSON parsing! If not for that post, I’m pretty sure I’d still be trying to figure that out.
  // Dynamically assign the JSON to objects
  JObject DocumentTone = JObject.Parse(responseFromServer);
  JArray ToneCategories = (JArray)DocumentTone["document_tone"]["tone_categories"];
  // Loop through the categories returned in the JSON
  dynamic categories = ToneCategories;
  foreach (dynamic category in categories)
      // Random troubleshooting code; did this in the beginning to check values

      // Add the emotion scores to the chart
      // This is the brute force approach; it's likely this can be done by assigning an array to the datasource of the chart
      // or something elegant like that
      if (category.category_id == "emotion_tone")
          int i = 0;
          foreach (dynamic tone in category.tones)
              switch ((string)tone.tone_id)
                  case "anger":
                      crtEmotion.Series["Emotions"].Points.AddXY((string)tone.tone_name, (double)tone.score);
                      crtEmotion.Series["Emotions"].Points[i].Color = Color.Red;
                  case "disgust":
                      crtEmotion.Series["Emotions"].Points.AddXY((string)tone.tone_name, (double)tone.score);
                      crtEmotion.Series["Emotions"].Points[i].Color = Color.Purple;
                  case "fear":
                      crtEmotion.Series["Emotions"].Points.AddXY((string)tone.tone_name, (double)tone.score);
                      crtEmotion.Series["Emotions"].Points[i].Color = Color.Green;
                  case "joy":
                      crtEmotion.Series["Emotions"].Points.AddXY((string)tone.tone_name, (double)tone.score);
                      crtEmotion.Series["Emotions"].Points[i].Color = Color.Yellow;
                  case "sadness":
                      crtEmotion.Series["Emotions"].Points.AddXY((string)tone.tone_name, (double)tone.score);
                      crtEmotion.Series["Emotions"].Points[i].Color = Color.Blue;

      // Add the language/writing scores to the chart
      if (category.category_id == "writing_tone")
          foreach (dynamic tone in category.tones)
              crtLanguage.Series["Language"].Points.AddXY((string)tone.tone_name, (double)tone.score);

      // Add the social scores to the chart
      if (category.category_id == "social_tone")
          foreach (dynamic tone in category.tones)
              crtSocial.Series["Social"].Points.AddXY((string)tone.tone_name, (double)tone.score);

  // Sort the emotion chart by emotion names; it just so happens the alphabetical order matches the priority order
  // The emotions like anger and disgust should be at the top of the chart
  crtEmotion.DataManipulator.Sort(System.Windows.Forms.DataVisualization.Charting.PointSortOrder.Descending, "AxisLabel", "Emotions");

  // Clean up the streams.
Each tone category – emotion, language, and social – has subcategories. For example, the emotion category has five subcategories: anger, disgust, fear, joy, and sadness. For each subcategory, 0 is the low score and 1 is the high score. You’ll see values returned like 0.039091 and 0.655229.
There’s lots more information about the different systems and algorithms used to calculate the tone scores in the IBM documentation. This blog post also has more details about the different types of tone scores and how they’re modeled.

Note that I did encounter some issues with form resizing after I added the chart controls. Right now, the form resizes such that the chart controls are cut off of the right side of the form and on the bottom.

When I first heard about IBM’s Tone Analyzer service, I was jazzed. I could picture so many ways that functionality could be used in practical ways.
  • Call Center Chat – This service could be integrated into customer service tools like Salesforce’s Live Agent which enables reps to chat with customers. Every time a customer sends text through the chat tool, you could call the service and pass it the customer’s chat content. A rep could see in real-time the emotional state of the customer.
  • Outlook/Word Add-in – The ability to click a button and analyze an email or a document would be awesome. Credit for this idea goes to Paige McAndrew, dev lead at Not Rocket Science. When I was telling her about Tone Analyzer and my app, her first suggestion was an Outlook add-in. Instead of clicking Send, a user could click a button and then decide whether to click Send.
  • Self-Coaching – More and more companies are implementing enterprise social networking tools for internal collaboration and communication. Tools like Chatter (Salesforce), Yammer (Microsoft), and Facebook at Work (Facebook). All those posts mean that everyone is doing a lot of writing. It would be great to be able to click a button and find out the general tenor of your own writing.
I think the real strength of Tone Analyzer is realized when it’s integrated into existing apps. I hope this blog post and the C# app help you get started.

March 27, 2016

Calling the Tone Analyzer Service Using Postman

Ever write something and wonder, "Is this too harsh?" Or, "Does this sound overly friendly, like a text message?" Well, now you can use IBM’s Tone Analyzer to give you insight into what your writing conveys.

Tone Analyzer is part of the Watson services. Like a lot of people, the first time I heard about IBM’s Watson was when it was a contestant on Jeopardy competing against two former winners. For anyone who has never played, you’re given a clue in the form of an answer and the contestants must guess the question correctly and be the quickest to respond. Watson not only performed as well as the human players, but ended up winning the game.

Watson is a natural language and machine learning technology. It has access to vast quantities of both structured and unstructured data. You can ask a question just like you would if you were asking a person, and Watson uses all of that data to return an answer.

When I heard that there was a public Watson API, it stuck in my head. I investigated and found that there wasn’t just one API, but a whole collection of services. Anything from converting text to speech, to extracting personality characteristics from content, to gathering data from images. That’s when I came across Tone Analyzer and it caught my attention.
The Tone Analyzer service analyzes writing and returns information about what that writing conveys. It returns its analysis in the form of scores that fall into three categories: emotion, language, and social. To see it in action, check out the Tone Analyzer demo page. You can paste in some text and see immediate results.
The goal of this post is to step you through successfully calling the Tone Analyzer service. This was the first step I took before I created a .NET app that calls the service. I cover that app in a blog post after this one. I referred to the IBM Tone Analyzer tutorial quite a bit, but there were some different steps that I followed, so I’ve detailed everything here.
To call the Tone Analyzer service, you first create an instance of the service on Bluemix and then get the credentials for that instance. Bluemix is IBM’s cloud platform that you can use to host your own apps and services.
  1. Go to the Bluemix console.
  2. Click LOG IN to sign in to Bluemix using your IBM ID username and password. If you don’t have an IBM ID, go to the registration page. Note that your IBM ID is different than the service credentials that you’ll create.
  3. After you log in to Bluemix, click the service catalog.
  4. Click the Tone Analyzer service.
  6. In the Add Service panel, enter a unique name in the Service name field and click Create.
  8. In the left panel, click Service Credentials and the username and password for the service appear in JSON. Make a note of these credentials – you’ll need them any time you call the service.

After setting up the Tone Analyzer in Bluemix, the next step is to call the service and return results in Postman. Postman is a Chrome app that you can use to create and call REST API requests.
Using this tool, you can add all the parameters to pass to the call and save the request. Awesome! I may be the biggest Postman fangirl of all time. I pretty much tell anyone I know that might possibly be testing a REST API about it. I have found it to be much easier to use than cURL. 
  1. If you don’t have Chrome installed, install it from You need to have Chrome to install Postman, but you don’t need to use Chrome as your browser.
  3. Install Postman from the Chrome Store. After you install it, it’s available from the Chrome App Launcher.

  4. Open Postman and be sure to set the following:
  5. Double check the Tone Analyzer documentation for the latest service URL. The URL also has the sentences=false parameter which returns analysis for the document as a whole. If you remove this parameter, the JSON returned will also contain tone analysis at the sentence level.
    • On the Authorization tab, select Basic Auth and enter the service username and password that you retrieved previously.

  6. On the Headers tab:
    • Add a key of Content-Type and a value of application/json.
    • The Authorization key and value are automatically created from your username and password.
  7. On the Body tab:
    • Select raw.
    • Select JSON (application/json) from the dropdown.
    • Enter the text you want to analyze in JSON format.
  8. Click Send. In the bottom pane you’ll see the status in the upper right and the results in JSON. If you want to save the results, click Save Response. This comes in handy if you want to test sending in different parameters and compare the results.
And that's it! If you're new to working with JSON, use a JSON formatter like JSON Editor Online to see how the results are structured.
If you remove the sentences=false parameter from the URL, the results will contain tone analysis for each sentence in addition to the document-level analysis. That could be interesting if you have a scenario where you want to see what emotion is being conveyed in each sentence. Perhaps to analyze call center chats to better understand customer service scenarios.

If you want to integrate Tone Analyzer into your app, this is a good first step. Building an app that calls the service was my next step and the subject of my next blog post coming soon.

This blog post was updated on Jul-25-2016 to reflect changes made when Tone Analyzer went GA. See the IBM Release Notes about it for more details.

November 13, 2013

Meditation & Technology: The Infinite Loop of Perfection

At first glance, meditation and technology seem quite disparate and unrelated. But, like many aspects of life, there’s a strong connection between the two.  When you engage in both of these activities, you’ll not only experience the specific benefits associated with each one, but you’ll find that they benefit and reinforce each other.

Let’s start with meditation. What exactly is it? Meditation is stopping thought. Discussing meditation is a challenge because even though literally thousands of volumes have been written on the subject, and even more has been spoken about it, it is, at its core, an experience. Discussion of the subject is really more of a pointer that refers to the actual experience. That said, meditation is focused concentration that leads to stopping thought. When thought stops, life is experienced as it really is.

There are many different methods and ways to meditate. No one way is the "right way." Rather, different methods work well for different people. One meditation technique might work better at a different stage depending on how long you’ve been meditating. All methods do have one common aspect: the core practice involves focus and concentration.

This focus could be directed to a sound, like a mantra. It could be directed visually, to an object like a candle flame. Or the focus could be out of the realm of the five senses and directed to one of the main energy centers in the body. Personally, I find the candle flame technique to be very effective. In all cases, the goal is to slow down and eventually stop thought through concentrative practices.

Another common aspect to the various ways of meditation is consistent practice. Typically, it’s recommended that you meditate twice a day - once in the morning and again in the evening. At first, you sit for a brief time. As you become more comfortable, you increase the amount of time you sit. This approach is similar to that of training for any sport. For example, in running, you carefully build a foundation by running consistently for short distances. Then you slowly increase your mileage over time being careful to pace yourself and avoid overdoing it.

Why do it? some might inquire. Well, the return on investment of meditation is quite high. Even though it can be a challenge to sit and still the mind initially, even early on, you’ll find that you feel better: more positive, more balanced. Worry and anxiety decrease and you have more energy. It’s not that all of a sudden your life becomes trouble-free. You still experience turbulence, both inner (emotionally) and outer (life situation). But you feel more mental stability and can draw on those moments of stillness in a hectic world.

Another key benefit of consistent meditation is increased ability to concentrate. It takes a tremendous amount of focus to be able to meditate and stop thought. So you build concentration and focus just like building muscles or endurance. Over time, your mind becomes clearer and you’re able to focus on an activity with one-pointed attention and for longer periods of time.

On the other side of the equation is technology. That is to say, specifically a career in technology such as programmer or systems architect or a similar role.

Let’s take the example of a computer programmer (software developer). As a programmer, you must solve problems every day. For example, a problem might be something a customer needs in a piece of software or it could be figuring out how to code something.

In addition to creative problem solving, another key component to a highly technical job is the ability to visualize very complex structures. As a developer, everything you create is virtual, so it’s necessary to be able to picture in your mind how an entire system works and how the various parts of it relate.

It’s also a common requirement to be able to read code and to understand what occurs when that code runs. So you need to be able to mentally visualize what the code does and how it functions within a larger computer system.

Meditation & Technology Together
Meditation and technology are separate individual activities, but it’s amazing how well they relate and benefit each other. Meditation involves extended periods of concentration. This helps you when you sit down to work on a coding task. You’re able to focus better. Conversely, as you work all day coding and creating solutions to technical problems, you continue to build the ability to concentrate. Another side effect of meditation is more energy and mental spaciousness; less mental clutter in the form of thoughts. So it becomes easier to see creative solutions to technical problems.

As you sit at your computer, visualizing systems or databases and solving technical problems, you’re not interacting with a lot of people, so your distractions are minimal (unless your company offers free snacks, which is a whole different type of distraction). Reduced interactions mean less energy drain which leaves you feeling more energized at the end of the day.

Of course, you still need to interact with your customers and colleagues, but the majority of your time is spent working creatively at your computer. Then when you sit to meditate in the evening, you still have some energy and inspiration. Although we looked at the example of a computer programmer, any highly-technical role in software development requires similar skills: the ability to focus, the ability to visualize and understand complex systems, and creative problem solving.

But don’t just take my word for it. According to Psychology Today, there’s scientific research that meditation has these benefits:
  • Increases the size of certain parts of the brain, especially regions associated with paying attention
  • Increases focus and concentration
  • Improves memory
  • Improves creativity
I've been meditating and working in technology for over twenty years, and I’ve experienced first-hand how meditation and technology continually benefit each other. If you’re a programmer, technical product manager, business analyst, quality assurance engineer, web designer or technical writer, consider adding meditation into your life. It brings many benefits, all of which enhance life in general and your career in particular.

If you meditate already and you’re in between jobs or thinking about switching careers, consider moving into a career in technology. Although it may seem counterintuitive, you can use your work to advance spiritually. You can use the hours you spend at work to build concentration and become a better meditator. Practice meditation and work in technology and they’ll be no stopping your success in both endeavors!

October 29, 2013

My Latest Article: Agile & Doc

Here's my latest article from the October issue of Software Development: Tech Writers Should be Pigs Not Chickens. If you work on a team that uses agile and also has product documentation, this may be of interest to you.

There are some challenges to integrating the product documentation function in the agile development cycle. But the benefits make it worth the effort.

November 23, 2012

Learning Azure? Labs & Free Ebooks

Anyone that works with the Microsoft developer tools knows that learning is part of the job. Azure is no exception.

For those of you brand new to it, Azure is the umbrella for all the services that enable you to run your apps (or parts of your apps) in the cloud.

Some resources that I found helpful for shortening the learning curve were the MSDN virtual labs and some free ebooks.
When you use one of the virtual labs, you can step through the exercises yourself using the VM and the PDF. Note that the VM is timed and is only available for about 90 minutes. So I found it easier to run it locally and go at my own pace. Of course, you may not have the tools to do that, so that's why the VMs are so handy.

But they also have this cool thing called Hands-On Labs Online (HOLO). You register for the HOLO which takes place at a particular day/time. Then you can walk through the lab while it's being presented live. There are also experts online that can help you with the lab via chat.

And the free ebooks? Not much to be said except that they're an awesome resource. The two that I found particularly helpful for learning Azure were:

Hope you find this collection of Azure learning resources helpful!

September 23, 2012

Win 8 - Getting Used to No Start Orb

I just installed the Windows 8 release preview on a test machine. If you've been around in the past six months and either been on the Internet or watched TV, you probably know that the new UI has done away with the "Start" paradigm. Which is to say, there's no Start orb/button.

Needless to say, the Windows 8 UI takes a little getting used to, especially if you're using it on a computer with a keyboard and mouse. I haven't tried it on a tablet or phone yet, but I can see where it would be much more intuitive to use on a touch device.

Although I'm an early adopter of technology, I'm typically one of those people that immediately looks for the "classic mode" setting. Unfortunately, there's no such option in Windows 8.

If your first reaction to Windows 8 is "OMG, get me a Start button, stat!" there are a number of utilities available - a growing market, no doubt - that will update the UI with a Start orb or menu. Each utility has its pros and cons, so check out this CNET article that has review of three of them.

I was tempted to install one of these utilities. But perhaps I'm rushing to judgment on the UI without giving it a chance. Also, once you get used to using one of the utilties, you miss out on any potential benefits of using the new UI. So I'm going to stick with it and see how it goes. I've still got Win 7 on my primary computer!