<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>IBM &#8211; Xojo Programming Blog</title>
	<atom:link href="https://blog.xojo.com/tag/ibm/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.xojo.com</link>
	<description>Blog about the Xojo programming language and IDE</description>
	<lastBuildDate>Mon, 15 Apr 2024 15:19:41 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>SQL 50th Anniversary</title>
		<link>https://blog.xojo.com/2024/04/15/sql-50th-anniversary/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Mon, 15 Apr 2024 15:19:40 +0000</pubDate>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[MS SQL Server]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=12874</guid>

					<description><![CDATA[SQL is 50 years old! It was first introduced in a 1974 paper titled “SEQUEL: A STRUCTURED ENGLISH QUERY LANGUAGE” by Donald Chamberlin and Raymond&#8230;]]></description>
										<content:encoded><![CDATA[
<p><a href="https://en.wikipedia.org/wiki/SQL">SQL</a> is 50 years old! It was first introduced in a 1974 paper titled “<a href="https://s3.us.cloud-object-storage.appdomain.cloud/res-files/2705-sequel-1974.pdf">SEQUEL: A STRUCTURED ENGLISH QUERY LANGUAGE</a>” by Donald Chamberlin and Raymond Boyce who were part of the IBM Research Laboratory in San Jose California.</p>



<p>This paper probably explains the biggest issue regarding SQL that persists to this day: its pronunciation.</p>



<p>I always flip between saying “sequel” and “ess cue ell” depending on context. The authors used SEQUEL as an <a href="https://www.merriam-webster.com/dictionary/acronym">acronym</a> of <strong>S</strong>tructured <strong>E</strong>nglish <strong>QUE</strong>ry <strong>L</strong>anguage. Over time this was referred to as Structured Query Language and the <a href="https://www.merriam-webster.com/dictionary/initialism">initialism</a> of SQL took hold. Still, the pronunciation of sequel seems to have also stuck. Anyway, pronounce it how you want — I won’t judge.</p>



<p>I&#8217;ve sometimes seen people claim that SQL stands for Standard Query Language. As the above clearly shows, that is not true. And if you&#8217;ve used SQL at all with more than one database, you also have empirical evidence that there is not much standard about it beyond the main keywords.</p>



<p>The <a href="https://s3.us.cloud-object-storage.appdomain.cloud/res-files/2705-sequel-1974.pdf">paper itself</a> is only about 15 pages, so not long at all. I found this surprising as I expected it to be some lengthy and detailed specification written for academics.</p>



<p>But it’s not.</p>



<p>It starts by talking about the relational model of data, a somewhat new concept at the time (first <a href="https://en.wikipedia.org/wiki/Relational_model">described in 1969</a>), and the predicate calculus, introducing a sublanguage called SQUARE, which strikes me a somewhat functional way of querying relational data. Math nerds do love their functional languages.</p>



<p>The authors then go on to introduce SEQUEL as a substitute for SQUARE and it’s here where we see the first syntax that you might recognize:</p>



<pre class="wp-block-code"><code>SELECT NAME
FROM   EMP
WHERE  DEPT = ’TOY’</code></pre>



<p>Boolean expressions in the WHERE clause are also covered along with functions in the SELECT clause. These are all things still being used to this day.</p>



<p>The main justification the authors use for SEQUEL is that the concepts of predicate calculus and SQUARE require &#8220;too much sophistication for the ordinary user&#8221;. I won’t argue with that!</p>



<p>They drive that point home by showing how to get data results using some example queries, first by using SQUARE and then comparing to the SEQUEL equivalents. Their first query is this:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Find the names of managers who manage more than ten employees.</p>
</blockquote>



<p>Note that for this example, there is a previously defined database with one of the tables as follows:</p>



<p>EMP (NAME, DEPT, MGR, SAL, COMM)</p>



<p>The SQUARE example looks like this:</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="122" src="https://blog.xojo.com/wp-content/uploads/2024/04/Pasted-Graphic-1024x122.png" alt="" class="wp-image-12878" srcset="https://blog.xojo.com/wp-content/uploads/2024/04/Pasted-Graphic-1024x122.png 1024w, https://blog.xojo.com/wp-content/uploads/2024/04/Pasted-Graphic-300x36.png 300w, https://blog.xojo.com/wp-content/uploads/2024/04/Pasted-Graphic-768x92.png 768w, https://blog.xojo.com/wp-content/uploads/2024/04/Pasted-Graphic-1536x184.png 1536w, https://blog.xojo.com/wp-content/uploads/2024/04/Pasted-Graphic.png 1672w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>I’m not going to even try to explain this. Read the paper if you’re curious.</p>



<p>Here&#8217;s the SEQUEL version:</p>



<pre class="wp-block-code"><code>SELECT   MGR
FROM     EMP
GROUP BY MGR
WHERE    COUNT (NAME) &gt; 10</code></pre>



<p>Well, now. That certainly makes more sense to me. I&#8217;ll bet that everyone reading this knows exactly how to parse out the SEQUEL command. It would actually work as-is in a database such as SQLite today!</p>



<p>There are other examples in the paper as well. Like I said, it’s somewhat short so you might find it to be an interesting read.</p>



<p>Happy 50th Birthday, SEQUEL (SQL)!!</p>



<p><em>Paul learned to program in BASIC at age 13 and has programmed in more languages than he remembers, with Xojo being an obvious favorite. When not working on Xojo, you can find him talking about retrocomputing at <a href="https://goto10.substack.com" target="_blank" rel="noreferrer noopener">Goto 10</a> and </em>on Mastodon @lefebvre@hachyderm.io.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Identify Images Using IBM Watson&#8217;s Remote APIs</title>
		<link>https://blog.xojo.com/2018/05/23/identify-images-using-ibm-watsons-remote-apis/</link>
		
		<dc:creator><![CDATA[Xojo]]></dc:creator>
		<pubDate>Wed, 23 May 2018 10:00:33 +0000</pubDate>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[Watson]]></category>
		<category><![CDATA[Xojo Framework]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=4293</guid>

					<description><![CDATA[Have some fun with Artificial Intelligence and Xojo! See examples from IBM's Watson services and how to use them with Xojo to classify images.]]></description>
										<content:encoded><![CDATA[<p>Some of the most interesting web services you can use with Xojo through remote API calls are related to <a href="https://en.wikipedia.org/wiki/Artificial_intelligence">Artificial Intelligence</a>. There are many different APIs provided by the main players in the AI sector, but IBM&#8217;s Watson is by far the most well known.</p>
<p>I&#8217;m going to show you how to connect to IBM&#8217;s Watson services with REST APIs and how to use them with Xojo projects to identify images. This is just one example, of course, of the many ways to utilize Watson and AI in your Xojo apps.</p>
<p><span id="more-4293"></span></p>
<h3>IBM Watson</h3>
<p><a href="https://www.ibm.com/watson/" target="_blank" rel="noopener">IBM&#8217;s Watson services</a> have been online for several years and are continuously updated. They are paid services but you can create a Lite user to test and evaluate them. The <a href="https://console.bluemix.net/developer/watson/documentation?cm_mc_uid=39948455095014385868305&amp;cm_mc_sid_50200000=73496051523601646255&amp;cm_mc_sid_52640000=69577461523601646258" target="_blank" rel="noopener">documentation and variety</a> of services are huge and includes (among other things) image identification services.</p>
<h4>Identify images with Watson</h4>
<p>This service mainly offers two possibilities: identifying the faces in an image (returning the position, the probable gender of the subject and the probable age range) and the classification (i.e. the recognition of possible tags that can be associated with the image).</p>
<div class="keyconcept"><strong>The key concept of this type of process is: Probability</strong><br />
The result is a probability, not a certainty. It&#8217;s up to your app to accept or reject the result and how to use it. For example, you can set a threshold and automatically accept the results and send the user the uncertain result to confirm or refuse.</div>
<p>Watson&#8217;s <a href="https://www.ibm.com/developerworks/community/blogs/5things/entry/5_things_to_know_about_Watson_Natural_Language_Classifier?lang=en">Natural Language Classifier</a>, is a service that &#8220;applies cognitive computing techniques to return best matching predefined classes for short text inputs, such as a sentence or phrase&#8221;. It is really large (and the definitions are localized in many languages); moreover you can create your own classifiers specific to projects. The Lite user can create only one classifier at a time that is replaceable but not updatable. Another limit is the number and total size of the images that you can use to address your classifier.</p>
<p>Watson&#8217;s documentation is complete and easy to use. After creating the service in your account, you can start using them with the terminal or through the web page relative to the selected service.</p>
<h3>How to use Watson with Xojo</h3>
<p>The services use a REST API so you&#8217;ll use <a href="http://developer.xojo.com/xojo-net-httpsocket">Xojo.Net.HTTPSocket</a> as the base class to create the object that will consume these services. To learn more about using Xojo with a REST API, you should read up on that before continuing: <a href="https://blog.xojo.com/2015/10/01/cats-up-using-httpsocket-with-the-cat-rest-api/" target="_blank" rel="noopener">Cats Up: Using the HTTPSocket with the Cat REST API,</a> <a href="https://blog.xojo.com/2018/02/06/pdf-file-generation-there-is-an-api-for-that/" target="_blank" rel="noopener">PDF File Generation? There is an API for that</a> and <a href="https://www.youtube.com/playlist?list=PLPoq910Q9jXiH5A32myqHwd1WLuUnBTuO">Web Services Video Playlist</a>.</p>
<p>In this example, the base class is called &#8220;WatsonAPI&#8221;. This class will deal with the communication with the API (sending and initial interpretation of the answer) and will have some common features (such as zipping several images so they can be sent all at once). Moreover, since the interaction with the service is asynchronous, the class will have to manage the serialization of the different requests and take care to return the result to the correct call.</p>
<p>Next, you&#8217;ll define a delegate who will have as an argument the answer (positive, negative or error) that will have as its signature a <a href="http://developer.xojo.com/xojo-core-dictionary">Xojo.Core.Dictionary</a>:</p>
<pre>WatsonReplyFunction(reply as Xojo.Core.Dictionary)</pre>
<p>Now you&#8217;ll define two private properties: id and callback. You&#8217;ll use id to distinguish the various call, and callback will be the function to call when there&#8217;s a the result.</p>
<pre>Private Property id as Text
Private Property callback as WatsonReplyFunction</pre>
<p>The constructor (protected because the subclasses will call it) can be of this kind:</p>
<pre>Protected Sub Constructor( cb as WatsonAPI.WatsonReplyFunction)
  // Register the callback
  callback=cb
  Super.Constructor
  register Me
End Sub</pre>
<p><em>Register</em> is a private shared function that assigns the identifier to the object and saves the pair id, object in a shared dictionary. There&#8217;s also a <em>deRegister </em>function that will delete the object whose identifier is passed.</p>
<p>As noted before, you&#8217;ll use a dictionary to represent the API result because it&#8217;s the format used for positive or negative API replies. Moreover, we can use the same format for network error replies. The dictionary will contain at least 3 values: <em>success</em> as boolean for a positive or negative reply, <em>status</em> as integer for the reply http status and <em>result</em> as text or dictionary to represent the current reply. Since it&#8217;s a dictionary, we can easly add more information as needed. Subclasses or consumer classes can transform this data structure in a more specific way (class, record or whatever).</p>
<p>Now you will implement the major events:</p>
<pre>Sub Error(err as RuntimeException) Handles Error
  //All replies will have the same structure
  //In the event of an error, the returned dictionary must be structured as correct one
  Dim d As New Xojo.Core.Dictionary
  d.Value("success")=False
  d.Value("status")=0
  d.Value("result")=err.Reason
  //Delete the object from the dictionary
  deRegister(Me)
  //return the reply
  callback.Invoke(d)
End Sub


Sub PageReceived(URL as Text, HTTPStatus as Integer, Content as Xojo.Core.MemoryBlock&gt;) Handles PageReceived
  #Pragma Unused url

  //evaluate the reply
  Dim d As Xojo.Core.Dictionary
  Dim t As Text
  Try
    t=Xojo.Core.TextEncoding.UTF8.ConvertDataToText(Content)
  Catch
    t=""
  End Try
  If Not t.Empty Then
    Try
      d=Xojo.Data.ParseJSON(t)
    Catch
      d=Nil
    End Try
  End If
  Dim reply As New Xojo.Core.Dictionary
  reply.Value("success")=HTTPStatus=200 And d&lt;&gt;Nil
  reply.Value("status")=HTTPStatus
  If d=Nil Then
    reply.Value("result")=t
  Else
    reply.Value("result")=d
  End If
  //Delete the object from the dictionary
  deRegister(Me)
  //return the reply
  callback.Invoke(reply)
End Sub</pre>
<p>Now you can create a subclass to classify the images: WatsonVisualRecognition as subclass of WastonAPI.</p>
<p>For the image classification you can use one or more of the classifiers and/or the default one or even those in beta (currently Food and Explicit). So let&#8217;s define the constants related to these classifiers:</p>
<pre>Public Const IBMDefault as Text =default
Public Const IBMExplicit as Text = explicit
Public Const IBMFood As Text = food</pre>
<p>&#8230; and the ones related to the services:</p>
<pre>//The current version of the service
Private Const version As Text = 2016-05-20

//The address actually depends on the user settings
Private Const kBaseUrl As Text = https://gateway.watsonplatform.net/visual-recognition/api/v3/

//The key to use the service
Private Const keyVision As Text = •••••••</pre>
<p>You can now define a public shared method for analyzing an image on the web:</p>
<pre>Public Shared Sub classifyImage(cb As WastonAPI.WatsonReplyFunction, imageUrl As Text, threshold As Single=0.5, paramArray classifiers As Text)
  //The method requires a method to be called to return the results,
  // the address of the image to be analyzed
  // the minimum value to be considered for recognition
  // a list of classifiers to use

  //Let's create the instance linking it to the callback
  Dim w As New WatsonVisualRecognition(cb)

  //threshold is the minimum acceptable value for classification
  //  must be between 0 and 1
  If threshold&lt;0.0 Then threshold=0.0
  If threshold&gt;1.0 Then threshold=1.0

  //For classifiers I can use both the ones provided and mine
  //none means the default one
  Dim useIBM As Boolean
  Dim usePersonal As Boolean
  Dim usedClassifiers() As Text
  For i As Integer=0 To classifiers.Ubound
    Select Case classifiers(i)
    Case IBMDefault
      useIBM=True
    Case IBMExplicit, IBMFood
      useIBM=True
      //These classifiers are in English only 
      w.RequestHeader("Accept-Language")="en"
    Else
      usePersonal=True
    End Select
    If usedClassifiers.IndexOf(classifiers(i))=-11 Then usedClassifiers.Append  classifiers(i)
  Next
  Dim classifierIds As Text=Text.Join(usedClassifiers, ",")

  //Set the kind of the classifiers used
  Dim usedOwners() As Text
  If useIBM Then usedOwners.Append "IBM"
  If usePersonal Then usedOwners.Append "me"
  Dim owners As Text=Text.Join(usedOwners, ",")

  //Create the URL to be called
  Dim url As Text=kBaseUrl+"classify"

  //I create the list of arguments
  Dim args() As Text
  args.Append "api_key="+keyVision
  args.Append "version="+version
  args.Append "url="+imageUrl
  If Not owners.Empty Then args.Append "owners="+owners
  If Not classifierIds.Empty Then args.Append "classifier_ids="+classifierIds
  If threshold&gt;0 Then args.Append "threshold="+threshold.ToText
  Dim parameters As Text=Text.&gt;Join(args, "&amp;")

  w.Send "GET", url+If(parameters.Empty, "", "?"+parameters)
End Sub</pre>
<p>Finally, you can request the classification of an image. For example, put a button in a Window and in the Action event put the following code:</p>
<pre>WatsonVisualRecognition.classifyImage(WeakAddressOf analyzeResponse, "https://watson-developer-cloud.github.io/doc-tutorial-downloads/visual-recognition/fruitbowl.jpg", .3)</pre>
<p>Where <em>analyzeResponse</em> is the method that will read the results translating the Dictionary into something useful like actions for a database, a textual list or a simple text message.</p>
<p>Starting from this simple method, it is possible to create all the others, adding a bit of utility functions to the WatsonAPI base class.</p>
<p>As an example, it is possible to obtain the basic information about the people in this image and display it as an overlay:</p>
<p><img decoding="async" class="aligncenter size-full wp-image-4295" src="https://blog.xojo.com/wp-content/uploads/2018/05/faces.png" alt="" width="1433" height="953" /></p>
<p>Or update a database of images with classifications to then find the images of a specific type:</p>
<p><img decoding="async" class="aligncenter size-full wp-image-4296" src="https://blog.xojo.com/wp-content/uploads/2018/05/food.png" alt="" width="2446" height="1054" /></p>
<h3><img />Create your own classifiers</h3>
<p>Starting from this object it is easy to create an application to generate, update, and verify a classifier that is specific to this solution. While you can do it with the provided web interface, you can create a Xojo app that can return the feedback in a much easier and manageable way; and you can add some methods to automate the process of automatically discarding bad images and adding new ones in order to refine your classifier better.</p>
<h3>Conclusions</h3>
<p>Watson&#8217;s API services allow you to add a bit of artificial intelligence to your Xojo projects. The simplicity of the classes required to do this are clear proof of Xojo&#8217;s versatility.</p>
<p>It&#8217;s important to keep in mind that this service is not instantaneous. This is due in large part to network traffic; generally for sending the data and receiving the answer.</p>
<p>A really interesting option if you develop for MacOS would be to download your classifier in CoreML format and use it offline with <a href="https://www.mbsplugins.eu/CoreMLOpenModel.shtml">MBS Core ML plugin</a>.</p>
<p><em>Antonio Rinaldi is a professional engineer, Xojo developer for almost twenty years, Xojo evangelist for Italy since 2014, consultant and teacher. He develops extensions for Xojo iOS that you can find in the Xojo Store, and manages <a href="http://www.xojoitaliablog.com">XojoItaliaBlog.com</a>. Musician, composer, lover of good food, traveler and constantly curious, he is always looking for new ideas to expand his knowledge.</em></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Good News: IBM is Pushing the Mac</title>
		<link>https://blog.xojo.com/2017/09/01/ibm-is-pushing-the-mac-xojo-users/</link>
		
		<dc:creator><![CDATA[Geoff Perlman]]></dc:creator>
		<pubDate>Fri, 01 Sep 2017 07:00:00 +0000</pubDate>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[Multi-Platform Development]]></category>
		<guid isPermaLink="false">http://blogtemp.xojo.com/2015/08/18/ibm-is-pushing-the-mac-why-is-that-good-for-xojo-users/</guid>

					<description><![CDATA[The more level the the desktop playing field is, the more important cross-platform becomes. This creates more opportunities for Xojo users to benefit from being able to easily create cross-platform solutions.]]></description>
										<content:encoded><![CDATA[<p>Before we dive into what it means for developers, and in particular Xojo and other cross-platform developers, that IBM is pushing the Mac, let&#8217;s look at the recent history of the computer market. 10 years ago, the Mac had market share in the low single digits and was ignored by most of the world. These days the Windows PC market is in decline while the market share for Mac is rising at the expense of Windows.</p>
<p>How does IBM fit into this?</p>
<p><span id="more-290"></span></p>
<p>In 2014, IBM <a href="http://www.apple.com/pr/library/2014/07/15Apple-and-IBM-Forge-Global-Partnership-to-Transform-Enterprise-Mobility.html" target="_blank" rel="noopener noreferrer">announced</a> their MobileFirst initative to build mobile enterprise applications on the iOS platform. They also announced that they would let IBM employees choose a Mac for their work computer if they so desired. At that time, IBM believed they would be purchasing about 50,000 Macs each year. MacRumors <a href="http://www.macrumors.com/2015/08/05/ibm-mac-deployment-service/" target="_blank" rel="noopener noreferrer">reported</a> on an IBM internal memo stating that IBM will likely be purchasing 3 to 4 times that number per year and expects 50% to 75% of IBM employees to choose a Mac. If that&#8217;s not enough, IBM <a href="https://www-03.ibm.com/press/us/en/pressrelease/47386.wss" target="_blank" rel="noopener noreferrer">announced</a> that they are offering a new service helping large corporations deploy Macs into their existing infrastructure. Think about that for a minute. IBM is not only adopting the Mac in mass internally, but they are promoting the Mac into the enterprise.</p>
<p>Why are these policy changes good for cross-platform developers like Xojo users? Simple: the more level the desktop playing field is, the more important cross-platform becomes. This creates more opportunities for Xojo users to benefit from being able to easily create cross-platform solutions.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
