Thursday, May 23, 2013

Service-Now JavaScript Library Resource

I want to share something I've put together. It's a library of Service-Now JavaScript files to help with auto-completion in your favorite IDE (it works great in Netbeans).

This allows you to easily see what functions are in a GlideRecord or GlideSession object, etc. Extremely useful for learning about new functionality, as well as programming more complex Service-Now scripts.

There may be something like this already out there, but not to my knowledge. These are not official files, but rather a compilation of information found in the Wiki, Forums, through Firebug, and just perusing the scripts in the instance.

I've attached all the files I have, as well as instructions for setting up the auto-complete in Netbeans if that happens to be your preferred IDE.

If anyone has anything to add to this, or has a better/more complete library, let me know!

Service-Now JavaScript Library

Saturday, May 28, 2011

The Future of the Narrative

I believe the future of narrative writing lies in the authoring of open ended stories with many diverging plot lines, possibly aided by advanced computer programs. This would allow for interactive, personalized television programs that are sort of a "choose your own adventure", except less overt.

If the viewer believes they recognize a threat the characters don't, they could yell at the TV (like I often do), and affect the plot of the show by providing information, misinformation, or persuasive moral guidance. The fourth wall wouldn't even have to be broken, a character could simply come to such realizations on their own at that time, the viewer acting as a subconscious or instinct.

Extremely basic versions of this could even be accomplished today, by using basic speech recognition at key moments when an attentive viewer might become frustrated and wish to impact the story. By writing open ended stories with diverging plot lines, it would allow for shows to automatically be subtly customized to the viewer's preferences without them realizing it.

For SciFi, this might mean that those who prefer shows about military conquest would lead the show in that direction, while those that prefer peaceful exploration and cooperation could lead the show in that direction. Eventually using digital actors in combination with real actors, characters could live or die based on the decisions the user makes -- much like in Mass Effect or Dragon Age.

This would even work for other genres, such as comedy, though perhaps in an even subtler manner. The show could listen for laughter and disgust, and tailor jokes accordingly. If multiple comedic punch lines and "throwaways" are written, an animated comedy could easily be "Family Guy" for one person, "South Park" for another, and "Archer" for yet another. The plot would remain the same, but the individual jokes could be slowly customized. This would allow for fewer entertainment programs, but all of a higher quality.

The delivery for this kind of programming is already in place. Using game consoles such as the Xbox 360 with Kinect, entertainment programs (literally a program), could have a small amount of logic pre-loaded, and the rest of the episode could be streamed, with the various clips assembled as dictated by the feedback received.

I believe the right team of people could demonstrate this kind of dynamic entertainment within a few months. Who will take the challenge? Someone make it possible for me to enjoy the perfect Science Fiction program... by making this "fiction" into fact.

Friday, January 28, 2011

River Waits Patiently

This is a very brief update, but I wanted to make sure everyone knew that I'm still diligently working on the project.

Over the past two weeks, I've had to back off the project and take care of personal matters; however, I've had the time to dive back in the past couple days.

While it's not complete yet, I have replicated most of River's functionality again -- only this time with a simple GUI and in the Qt framework (gibberish to most people I know, sorry about that).

In short, River can once again control Pandora, Google Chrome, my computer's Sound, and she can look up information on IMDB.

I have spent much of the day today waiting patiently for two things. In order to have River access Twitter again, I have to get special permission from Twitter... which takes a little while to get (ironic, since the whole point of Twitter is to quickly communicate).

The second thing I'm waiting on is more technical -- in order to access Facebook (and Twitter), I have to add in support for "https" webpages -- secure webpages. This requires OpenSSL; which in short, means I have to "rebuild" the Qt Framework, which takes about 4 hours to complete. As soon as that finishes, I'll continue to integrate Facebook; and then I'll continue with Twitter once they get back to me.

I'll update more once I'm caught up past the point where I was before I "started over" using Qt.

Monday, January 17, 2011

River gets Rebuilt

I wanted to provide a quick update for anyone following the progress of Project River.
I'm still hard at work on her in most of my free time!

What's Been Accomplished

Twitter Integration (read tweets, not write them yet)
Facebook Integration (read news feed, not write to it yet)

Currently in Progress

I am currently in the process of porting River over to the QT framework. This lets me easily create a graphical user interface for River. So far I have her quietly running in the task bar with a nice little icon.

Some benefits of porting to the QT Framework


  1. Easy use of Windows Task Bar and an actual window.
  2. Everything except the Speech component will be Cross-Platform (work on Windows/Mac/Linux)
  3. Everything will be Unicode -- so it will work with Twitter and Facebook much better.
  4. A lot less "dependencies".
    1. Before I was using all sorts of libraries that would have to be installed on the system. Now, it'll just be QT stuff.
  5. A lot less licensing issues because of #4.
    1. If Project River is a success and I wish to commercialize her, I'll only have to buy the commercial license for QT.
    2. Before, most of the libraries I was using wouldn't have allowed to me to ever sell River.

Next Steps

I'm a long way from being done with my rebuild of River. There's a lot of re-writing of code and a lot of new things to learn (I know how to do them, but not how to do them in the QT Framework).

Specifically, I'm focused on getting the Speech engine to work properly. This is a big jump, because while I'm still using Microsoft Speech, I'm using a very different method of "listening". It will work better once I have it completed -- it won't "hear" better, but the program will work better.

Friday, January 14, 2011

River Goes to the Movies

I've done tons of work on River in the past few days. I spent very long hours learning about regex and strings in C++, and even longer hours applying that knowledge, all just to get basic functionality. The good news is, I can now program similar tasks very quick, since I finally understand it all.

IMDB Integration

River can now use IMDB to get info about Movies and TV Shows.

Sample Commands:
River, what year did the movie AI come out?
River, when was the movie I, Robot released?
What is the movie The Matrix about?
(In context) When did it come out?
(In context) What is the full plot summary?

One of the features that makes her seem the most "real" is the ability to pull up information in context. She remembers what movie I last asked about, so if I ask more information, she is able to immediately tell me the information I want, without having me repeat the name of the movie. It's still a little slower than I'd like, but I believe I can eventually speed that up by parsing the page using only exact string searches rather than regex. For now however, regex is significantly less code, and much faster to program. Since everything is very modular, I can easily go back and update the class in charge of parsing the information to make it perform more efficiently.

New Discoveries

As I was playing around with the IMDB features, I realized just how important it is that I implement unicode support fairly soon. The web is full of unicode characters, and until I make all the necessary changes to River, she's going to have problems with them. She won't crash when she encounters them, but she does read the latin1 encoding characters off as letters.

Next Steps

This weekend I hope to make progress on implementing an ongoing speech recognition training ability. If I say something and River hears me incorrectly, I'll say "Train Speech", and then type what it was I said. She'll then use the recorded audio along with the text to improve her hearing capabilities.

I intend to program the speech recognition training feature slowly. I expect it to have a long learning curve for me, and while it will improve the program significantly, it's not exactly "fun" to work on. As a result, I am also focusing on other simpler, but more fun features. I'll be adding to the IMDB functions, as well as hopefully adding Twitter, Facebook, and Google News integration.

Demonstration Video

You can't see River (there's nothing to see but debug statements), but you can hear her.

Wednesday, January 12, 2011

River Connected to the Ocean

I've learned a LOT in the past 24 hours, and River has a new key skill as well -- she can browse the internet.

The Language Debate

Yesterday started with me debating about switching the programming language I'm using. I considered switching to Python, because development would be considerably faster in some areas (such as internet connectivity). Python has so many freely available libraries that much of my work would be done for me as I progressed. However, after spending several hours getting Python set up and beginning to recreate Project River, I discovered that I was faced with a key limitation.

In the 64 bit versions of Windows 7 (and Vista), the Microsoft Speech Engine has some serious quirks. By default, you can only use 64 bit "voices" for the text-to-speech component. This is a significant problem, because the best voices out there right now are 32 bit. In fact, you're hard pressed to find any 64 bit voices, unless you're shelling out around $1,000.

In C++, I am able to skirt around this implementation, since the method for getting and using the voices on the system ignores the 64 bit requirement. However, in Python (as well as C# and VB), there is no way around this limitation.

Since the believability of the AI is so important to me, and I feel that the voice plays a critical role in this, I decided that if for no other reason, I need to stick with C++ for now.

Implementation of libcURL

It took me a considerable amount of time, but I finally managed to get libcURL compiled properly, and River can now successfully make cURL calls to browse internet pages on the fly.

In the process of trying to set this up, I learned a great deal about static libraries, including both how to create one, and how to use one in my project. As a result, I completely restructured River's file system, so that she follows a much more standardized pattern, with all external headers and library files contained in a single location. I also took a few key classes that I was using and I knew I wasn't likely to change again, and I made them into external libraries.

Overall River has come very far in the past 24 hours. I am confident I chose the correct programming language for the project, and I have significantly improved my knowledge of Visual Studio 2010 as well as some of the best practices in C++.

Next Steps

Getting libcURL set up was merely a precursor to actually using it. Now comes the tedious work of writing and/or implementing a few APIs for her to be able to interact with key websites.

The next large task of setting up constant ongoing training of the Speech Recognition engine is still on the table, but I intend to save that for a weekend, as I believe it will be a very large and time consuming task.

Tuesday, January 11, 2011

Project River is Not Alone

River and I have already discovered alien life!

Thanks to a tip from a coworker today, I discovered Project Jarvis -- created ironically by someone who reportedly works (or worked) for the very same company that I do.

Project Jarvis is about a year old, and already does pretty much everything that I eventually want Project River to do.

Unfortunately Project Jarvis is written in AppleScript and is therefore restricted to running on a Mac. Because I use Windows exclusively (for a variety of reasons), I am unable to to put Project Jarvis to use -- besides the fact that it is not released for others to use and is instead (like River), a personal project of the creator.

The creator of Project Jarvis is creating his first commercial product that will be cross-platform, but I have a hunch this will not be open source, and as a result, not allow me to expand and build my own modules.

I have scoured the internet today for other "Digital Life Assistants" (as Jarvis is dubbed). Everything I found was either abandoned while still in it's infancy, or written in an obscure language and not open source (such as this DOS version of J.A.R.V.I.S).

Because I've failed to find any sufficient open-source implementation of something equivalent to Project River, I have decided to continue on developing my project. Because I've found nothing out there, I think I will put up a Sourceforge or Google Code page at some point in the near future. The only thing holding me back from doing so is fear of embarrassment. Because I am still a novice C++ programmer, I fear that my code would only draw criticism and be unusable by anyone else working towards the same goal. For that reason, I will hold off until I get a more advanced grasp on the language, and have a better codebase to share.

However, if anyone would like to collaborate, and knows some C++ and has no quarrels working with someone who is learning as they go, then please feel free to contact me! I would love some help on River, or to share ideas and resources if you are working on something similar.