<?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>Star Trek &#8211; Xojo Programming Blog</title>
	<atom:link href="https://blog.xojo.com/tag/star-trek/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.xojo.com</link>
	<description>Blog about the Xojo programming language and IDE</description>
	<lastBuildDate>Tue, 02 Mar 2021 17:51:38 +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>Revisiting SQL Injections on the Final Frontier</title>
		<link>https://blog.xojo.com/2019/03/20/revisiting-sql-injections-on-the-final-frontier/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Wed, 20 Mar 2019 10:00:00 +0000</pubDate>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Star Trek]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=5551</guid>

					<description><![CDATA[In the fictional 23rd century relational databases and SQL are still in use not only by the United Federation of Planets but also by alien probes from the future! ]]></description>
										<content:encoded><![CDATA[<p>In a recent <a href="https://www.imdb.com/title/tt8288440/?ref_=ttep_ep8">Star Trek Discovery episode</a>, the crew was investigating how a probe (from the future!) was attempting to hack into their systems. This is what was said about it:</p>
<figure id="attachment_5552" aria-describedby="caption-attachment-5552" style="width: 800px" class="wp-caption aligncenter"><img fetchpriority="high" decoding="async" class="wp-image-5552" src="https://blog.xojo.com/wp-content/uploads/2019/03/IMG_1808.jpg" alt="" width="800" height="600" /><figcaption id="caption-attachment-5552" class="wp-caption-text">&#8220;The probe used multiple SQL injections&#8221;</figcaption></figure>
<p><span id="more-5551"></span></p>
<p>Apparently, in the fictional 23rd century relational databases and SQL are still in use not only by the United Federation of Planets but also by alien probes from the future! Normally Star Trek creates some technobabble gibberish for this sort of thing, so I certainly found this line surprising. Perhaps the writers thought it was just gibberish or that it would sound like gibberish to the average person.</p>
<p>But anyone who uses databases knows that SQL Injections can be a real issue. A SQL Injection refers to an issue when your app inadvertently allows a user to inject their own SQL into one of its database queries. Read <a href="https://blog.xojo.com/2016/02/18/avoiding-sql-injection/">this post</a> on how to avoid them.</p>
<p>Essentially, it can occur when you use standard string concatenation to create an SQL query from user-provided text. If you prompt the user for a name so you can show their tasks, for example then you&#8217;d normally get SQL like this:</p>
<pre>SELECT * FROM Task WHERE Name = 'Paul';</pre>
<p>But what if the user provides malicious input, such as this: Paul&#8217; OR 1</p>
<p>Then your concatenation code might create SQL like this:</p>
<pre>SELECT * FROM Task WHERE Name = 'Paul' OR 1;</pre>
<p>And this will return a lot more data. Obviously this is a simple example, but this type of exploit can be much more sophisticated. And apparently also something that alien probes from the future might try to use.</p>
<p>You can avoid this problem by taking advantage of a feature called database binding so that you do not use string concatenation to generate the SQL. With Xojo you do this by creating a <strong>prepared statement</strong> with placeholders for input strings and then let the database create the query itself using binding. So the SQL might look something like this:</p>
<pre>SELECT * FROM Task WHERE Name = ?</pre>
<p>Read the User Guide topic to more about how to avoid SQL injection by using prepared statements with your Xojo database code:</p>
<p><a href="https://documentation.xojo.com/topics/databases/protecting_your_database_from_attack.html">UserGuide:SQL Injection</a></p>
<p>And of course, <a href="https://xkcd.com/327/">relevant XKCD</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>The Klingon Translator App You Definitely Need</title>
		<link>https://blog.xojo.com/2019/03/07/the-klingon-translator-app-you-definitely-need/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Thu, 07 Mar 2019 10:00:02 +0000</pubDate>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Star Trek]]></category>
		<category><![CDATA[Translation]]></category>
		<category><![CDATA[Xojo Programming Language]]></category>
		<guid isPermaLink="false">https://blog.xojo.com/?p=5512</guid>

					<description><![CDATA[chay' tlhIngan Hol mughwI' chenmoH qaStaHvIS 20 tlhegh ngoq xojo je ghoj

Qapla']]></description>
										<content:encoded><![CDATA[<p>I love the new Star Trek Discovery and there are a fair amount of Klingons in it, from time to time. It occurred to me that someone has probably built a web service to translate English to Klingon and if so, I <em>needed</em> to build a Xojo app to use it.</p>
<p>A quick Google search turned up an API by FunTranslations: <a href="https://funtranslations.com/api/klingon">https://funtranslations.com/api/klingon</a></p>
<p>It has simple usage where you send along the text in English and you get back a JSON result containing the text translated to Klingon. Here&#8217;s the result of my 15 minutes of effort to use this in a Xojo desktop app:</p>
<p><span id="more-5512"></span></p>
<p><img decoding="async" class="wp-image-5513 aligncenter" src="https://blog.xojo.com/wp-content/uploads/2019/03/2019-03-06_15-34-28.png" alt="" width="600" height="422" /></p>
<p>This is a pretty simple project with less than 20 lines of code.</p>
<p>You can recreate the layout using a couple TextFields and a Button. I used <a href="https://documentation.xojo.com/api/networking/urlconnection.html">URLConnection</a> to connect to the web service. You can also add that to the layout by dragging an Object from the Library and changing its Super property to &#8220;URLConnection&#8221;. I named this object &#8220;KlingonAPI&#8221;.</p>
<p>In the Button&#8217;s Action event the code sets up the call to the web service using the text entered in the first TextArea:</p>
<pre>Dim url As String = "https://api.funtranslations.com/translate/klingon.json"

Dim param As String = "text=" + EncodeURLComponent(EnglishArea.Text)

KlingonAPI.SetRequestContent(param, "application/x-www-form-urlencoded")
KlingonAPI.Send("POST", url)</pre>
<p>In the KlingonAPI URLConnection object, add the ContentReceived event. This code grabs the translated Klingon text from the JSON and displays it in the 2nd TextArea:</p>
<pre>Try
  Dim json As New JSONItem(content)
  Dim contents As JSONItem
  contents = json.Value("contents")
  Dim klingonTranslation As String = contents.Value("translated")
  KlingonArea.Text = klingonTranslation
Catch e As JSONException
  MsgBox("Error processing API call. Content=" + content)
End Try</pre>
<p>You can also add the Error event and have it display an error in case there&#8217;s a problem with the API call:</p>
<pre>MsgBox("API Error: " + e.Message)</pre>
<p>And that&#8217;s all there is to it.</p>
<p>You can download the project from here: <a href="http://files.xojo.com/BlogExamples/KlingonTranslator.xojo_binary_project">KlingonTranslator Project</a>, just remember some things can&#8217;t be translated!</p>
<p><a href="https://imgflip.com/i/1rqwov"><img decoding="async" class="aligncenter" title="made at imgflip.com" src="https://i.imgflip.com/1rqwov.jpg" width="438" height="329" /></a></p>
<p>I&#8217;ll leave it up to you to implement a Klingon to English translator, although you may want to make that a mobile app in case you are ever teleported to the bridge of a Klingon vessel.</p>
<p>Qapla&#8217;</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
