<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-1309467374034010002</atom:id><lastBuildDate>Fri, 13 Sep 2024 12:21:35 +0000</lastBuildDate><title>Cross Linked Coder</title><description>Programming knowledge at your fingertips</description><link>https://crosslinkedcoder.blogspot.com/</link><managingEditor>noreply@blogger.com (Unknown)</managingEditor><generator>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1309467374034010002.post-2677959471560595086</guid><pubDate>Sun, 12 May 2019 18:49:00 +0000</pubDate><atom:updated>2019-05-12T12:11:04.391-07:00</atom:updated><title>How I turned Facebook Comments Plugin into a FREE Web Chat using Vue.js</title><description>&lt;div class=&quot;graf graf--p&quot; name=&quot;1f77&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;figure class=&quot;graf graf--figure graf--layoutFillWidth&quot; name=&quot;138a&quot;&gt;&lt;img class=&quot;graf-image&quot; data-height=&quot;3648&quot; data-image-id=&quot;0*NlkRGAftzkyEFA1M&quot; data-is-featured=&quot;true&quot; data-unsplash-photo-id=&quot;ra4vJwxnvAo&quot; data-width=&quot;5472&quot; height=&quot;263&quot; src=&quot;https://cdn-images-1.medium.com/max/2600/0*NlkRGAftzkyEFA1M&quot; width=&quot;400&quot; /&gt;&lt;figcaption class=&quot;imageCaption&quot;&gt;Photo by &lt;a class=&quot;markup--anchor markup--figure-anchor&quot; data-href=&quot;https://unsplash.com/@glencarrie?utm_source=medium&amp;amp;utm_medium=referral&quot; href=&quot;https://unsplash.com/@glencarrie?utm_source=medium&amp;amp;utm_medium=referral&quot; rel=&quot;photo-creator noopener noopener&quot; target=&quot;_blank&quot;&gt;Glen Carrie&lt;/a&gt; on&amp;nbsp;&lt;a class=&quot;markup--anchor markup--figure-anchor&quot; data-href=&quot;https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral&quot; href=&quot;https://unsplash.com/?utm_source=medium&amp;amp;utm_medium=referral&quot; rel=&quot;photo-source noopener noopener&quot; target=&quot;_blank&quot;&gt;Unsplash&lt;/a&gt;&lt;/figcaption&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;66fd&quot;&gt;
Recently I was on the lookout for a reactive chat experience to integrate with my site songxy.com. It had to be free with a small visual footprint.&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;39b9&quot;&gt;
I tried disqus — it was great as a footer on a webpage but it didn’t look great as a chat box. A friend of mine mentioned chatango but the mobile experience wasn’t there.&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;d519&quot;&gt;
Eventually I took a look at discord and slack but decided against it because I didn’t want to use a 3rd party embed such as chatlio.&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;94ee&quot;&gt;
Searching further I found out about Facebook comments plugin. Works on mobile, free and easy to integrate. Sounds great. Here is an official link to it: &lt;a class=&quot;markup--anchor markup--p-anchor&quot; data-href=&quot;https://developers.facebook.com/products/social-plugins/comments/&quot; href=&quot;https://developers.facebook.com/products/social-plugins/comments/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;https://developers.facebook.com/products/social-plugins/comments/&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;22f3&quot;&gt;
I started the task of initializing the Facebook JavaScript SDK and setting up the comment plugin as an SFC (single file component) inside a Vue.js SPA framework.&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;2318&quot;&gt;
These are the steps I came up with in order to pull this off.&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;62e9&quot;&gt;
Let’s take a look at how to initialize the Facebook JavaScript SDK inside of your index.html.&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/armedoctopus/6f338804aaa967716fb5feb819d5ad71.js&quot;&gt;&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;a48a&quot;&gt;
Here is the official link on initialization: &lt;a class=&quot;markup--anchor markup--p-anchor&quot; data-href=&quot;https://developers.facebook.com/docs/javascript/quickstart&quot; href=&quot;https://developers.facebook.com/docs/javascript/quickstart&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;https://developers.facebook.com/docs/javascript/quickstart&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;0b5d&quot;&gt;
Next I attempted to insert the &amp;lt;div&amp;gt; structure of the FB SDK comments which is what we want to be reactive. In my implementation I went twith a refresh button to update the chat box. If you want to update the comments in realtime without a refresh button or timed auto-refresh you will need to use the webhook Facebook provides here: &lt;a class=&quot;markup--anchor markup--p-anchor&quot; data-href=&quot;https://developers.facebook.com/docs/plugins/comments&quot; href=&quot;https://developers.facebook.com/docs/plugins/comments&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;https://developers.facebook.com/docs/plugins/comments&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;fb6b&quot;&gt;
Here is my SFC vue file with the reactive &amp;lt;div&amp;gt; for Facebook comments&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/armedoctopus/27c6914f84a1f39f989ccc6f13a2e765.js&quot;&gt;&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;be0a&quot;&gt;
The trick here to make the comments reactive in the way we expect is to initialize Facebook sdk whenever we mount the vue component. Without this step nothing will happen because the init brings in the JavaScript code that grabs the Facebook comments. Here is more about init: &lt;a class=&quot;markup--anchor markup--p-anchor&quot; data-href=&quot;https://developers.facebook.com/docs/javascript/reference/FB.init/v3.3&quot; href=&quot;https://developers.facebook.com/docs/javascript/reference/FB.init/v3.3&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;https://developers.facebook.com/docs/javascript/reference/FB.init/v3.3&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;ba6b&quot;&gt;
Once we have that component setup in our Vue.js SPA we need to make sure we mount it when we hit our refresh button.&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;dcf8&quot;&gt;
The trick with the button @click is to use the v-if directive. Here is some information about it: &lt;a class=&quot;markup--anchor markup--p-anchor&quot; data-href=&quot;https://vuejs.org/v2/guide/conditional.html#v-if&quot; href=&quot;https://vuejs.org/v2/guide/conditional.html#v-if&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;https://vuejs.org/v2/guide/conditional.html#v-if&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;dd35&quot;&gt;
I decided to use the Quasar Framework for my button example you can take a look at how the v-if directive is used with @click&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/armedoctopus/777fae6fc413b6954d61e0fba0eaeaaa.js&quot;&gt;&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
I had to use the $nextTick function in order to toggle the reactive state of the v-if directive on the Facebook Comments Plugin component.&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;0218&quot;&gt;
Visit my sandbox landing page at &lt;a class=&quot;markup--anchor markup--p-anchor&quot; data-href=&quot;https://songxy.com&quot; href=&quot;https://songxy.com/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;https://songxy.com&lt;/a&gt; to try out the chat. Overall I think it looks great and the q-slide-transition really works well.&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;figure class=&quot;graf graf--figure&quot; name=&quot;71ea&quot;&gt;&lt;img class=&quot;graf-image&quot; data-height=&quot;994&quot; data-image-id=&quot;1*_mQKRYGWvUwCa8jvXwynSg.png&quot; data-width=&quot;722&quot; height=&quot;400&quot; src=&quot;https://cdn-images-1.medium.com/max/1600/1*_mQKRYGWvUwCa8jvXwynSg.png&quot; width=&quot;290&quot; /&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;0193&quot;&gt;
I decided to write this article because I felt like there is minimal documentation on how to get Facebook Plugins to be reactive in Vue.js and calling FB.init at the right time was a challenge.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;4ef5&quot;&gt;
Please check out my personal blog to get more coder insight&lt;/div&gt;
&lt;div class=&quot;graf graf--mixtapeEmbed&quot; name=&quot;a278&quot;&gt;
&lt;a class=&quot;markup--anchor markup--mixtapeEmbed-anchor&quot; data-href=&quot;http://crosslinkedcoder.blogspot.com/&quot; href=&quot;http://crosslinkedcoder.blogspot.com/&quot; title=&quot;http://crosslinkedcoder.blogspot.com/&quot;&gt;&lt;strong class=&quot;markup--strong markup--mixtapeEmbed-strong&quot;&gt;Cross Linked Coder&lt;/strong&gt;&lt;br /&gt;
&lt;em class=&quot;markup--em markup--mixtapeEmbed-em&quot;&gt;You might be asking yourself why you would choose smaato to monetize with in-app ads. Firstly, smaato supports many…&lt;/em&gt;crosslinkedcoder.blogspot.com&lt;/a&gt;&lt;a class=&quot;js-mixtapeImage mixtapeImage u-ignoreBlock&quot; data-media-id=&quot;a4be3848fef06a7e19a9bc3282c93642&quot; data-thumbnail-img-id=&quot;0*kyN1w4JwUVeZ5gOK&quot; href=&quot;http://crosslinkedcoder.blogspot.com/&quot; style=&quot;background-image: url(https://cdn-images-1.medium.com/fit/c/320/320/0*kyN1w4JwUVeZ5gOK);&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;400a&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>https://crosslinkedcoder.blogspot.com/2019/05/how-i-turned-facebook-comments-plugin.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1309467374034010002.post-2515543170228536689</guid><pubDate>Mon, 22 Apr 2019 21:37:00 +0000</pubDate><atom:updated>2019-04-22T15:02:29.299-07:00</atom:updated><title>Integrating New PayPal Smart Buttons with Vue.js Quasar and iOS</title><description>&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;section class=&quot;section section--body&quot; name=&quot;76a4&quot;&gt;&lt;div class=&quot;section-divider&quot;&gt;
&lt;hr class=&quot;section-divider&quot; /&gt;
&lt;/div&gt;
&lt;div class=&quot;section-content&quot;&gt;
&lt;div class=&quot;section-inner sectionLayout--insetColumn&quot;&gt;
&lt;h3 class=&quot;graf graf--h3&quot; name=&quot;e061&quot;&gt;
Integrating New PayPal Smart Buttons with Vue.js Quasar and&amp;nbsp;iOS&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;section-inner sectionLayout--fullWidth&quot;&gt;
&lt;br /&gt;
&lt;figure class=&quot;graf graf--figure graf--layoutFillWidth&quot; name=&quot;0d59&quot;&gt;&lt;img class=&quot;graf-image&quot; data-height=&quot;3744&quot; data-image-id=&quot;0*Yg6mlkM9bKoLEAr8&quot; data-unsplash-photo-id=&quot;rItGZ4vquWk&quot; data-width=&quot;5616&quot; height=&quot;265&quot; src=&quot;https://cdn-images-1.medium.com/max/2560/0*Yg6mlkM9bKoLEAr8&quot; width=&quot;400&quot; /&gt;&lt;figcaption class=&quot;imageCaption&quot;&gt;Photo by &lt;a class=&quot;markup--anchor markup--figure-anchor&quot; data-href=&quot;https://unsplash.com/@sharonmccutcheon?utm_source=medium&amp;amp;utm_medium=referral&quot; href=&quot;https://unsplash.com/@sharonmccutcheon?utm_source=medium&amp;amp;utm_medium=referral&quot; rel=&quot;photo-creator noopener noopener&quot; target=&quot;_blank&quot;&gt;Sharon McCutcheon&lt;/a&gt; on&amp;nbsp;&lt;a class=&quot;markup--anchor markup--figure-anchor&quot; data-href=&quot;https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral&quot; href=&quot;https://unsplash.com/?utm_source=medium&amp;amp;utm_medium=referral&quot; rel=&quot;photo-source noopener noopener&quot; target=&quot;_blank&quot;&gt;Unsplash&lt;/a&gt;&lt;/figcaption&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div class=&quot;section-inner sectionLayout--insetColumn&quot;&gt;
&lt;blockquote class=&quot;graf graf--blockquote&quot; name=&quot;1935&quot;&gt;
This is my personal experience integrating the new PayPal Smart Payment Buttons with a reactive Vue.js framework called Quasar — I ran into problems and found solutions.&lt;/blockquote&gt;
&lt;h3 class=&quot;graf graf--h3&quot; name=&quot;ad4c&quot;&gt;
Today let’s code a PayPal Smart Payment Button Checkout.&lt;/h3&gt;
&lt;br /&gt;
&lt;figure class=&quot;graf graf--figure&quot; name=&quot;82fa&quot;&gt;&lt;img class=&quot;graf-image&quot; data-height=&quot;4000&quot; data-image-id=&quot;0*cNSw5Bnc7ZCMT79O&quot; data-unsplash-photo-id=&quot;CZ9AjMGKIFI&quot; data-width=&quot;6000&quot; height=&quot;266&quot; src=&quot;https://cdn-images-1.medium.com/max/800/0*cNSw5Bnc7ZCMT79O&quot; width=&quot;400&quot; /&gt;&lt;figcaption class=&quot;imageCaption&quot;&gt;Photo by &lt;a class=&quot;markup--anchor markup--figure-anchor&quot; data-href=&quot;https://unsplash.com/@joeel56?utm_source=medium&amp;amp;utm_medium=referral&quot; href=&quot;https://unsplash.com/@joeel56?utm_source=medium&amp;amp;utm_medium=referral&quot; rel=&quot;photo-creator noopener noopener noopener noopener&quot; target=&quot;_blank&quot;&gt;Nicole Wolf&lt;/a&gt; on&amp;nbsp;&lt;a class=&quot;markup--anchor markup--figure-anchor&quot; data-href=&quot;https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral&quot; href=&quot;https://unsplash.com/?utm_source=medium&amp;amp;utm_medium=referral&quot; rel=&quot;photo-source noopener noopener noopener noopener&quot; target=&quot;_blank&quot;&gt;Unsplash&lt;/a&gt;&lt;/figcaption&gt;&lt;/figure&gt;&lt;figure class=&quot;graf graf--figure&quot; name=&quot;c316&quot;&gt;&lt;img class=&quot;graf-image&quot; data-height=&quot;253&quot; data-image-id=&quot;1*3vuGlj4-p1ZTt7T7GZ11oQ.png&quot; data-width=&quot;672&quot; height=&quot;150&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*3vuGlj4-p1ZTt7T7GZ11oQ.png&quot; width=&quot;400&quot; /&gt;&lt;/figure&gt;&lt;figure class=&quot;graf graf--figure&quot; name=&quot;e351&quot;&gt;&lt;img class=&quot;graf-image&quot; data-height=&quot;135&quot; data-image-id=&quot;1*iu1gKtb2Y2HVxsxbyr68dA.png&quot; data-width=&quot;771&quot; height=&quot;70&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*iu1gKtb2Y2HVxsxbyr68dA.png&quot; width=&quot;400&quot; /&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;7b59&quot;&gt;
At quick glance everything looks great; &lt;a class=&quot;markup--anchor markup--p-anchor&quot; data-href=&quot;https://developer.paypal.com/docs/checkout/#add-the-buttons-to-your-website&quot; href=&quot;https://developer.paypal.com/docs/checkout/#add-the-buttons-to-your-website&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;copy the code&lt;/a&gt; into your project and mission complete.&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;7a92&quot;&gt;
&lt;strong class=&quot;markup--strong markup--p-strong&quot;&gt;Easy…&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;5bf2&quot;&gt;
What if you are using reactive UI components such as &lt;a class=&quot;markup--anchor markup--p-anchor&quot; data-href=&quot;https://quasar-framework.org/components/button-dropdown.html&quot; href=&quot;https://quasar-framework.org/components/button-dropdown.html&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;QBtnDropdown&lt;/a&gt; for a shopping cart list?&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;cdfa&quot;&gt;
Some developer background: my sandbox &lt;a class=&quot;markup--anchor markup--p-anchor&quot; data-href=&quot;https://songxy.com/&quot; href=&quot;https://songxy.com/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;songxy.com&lt;/a&gt; uses &lt;a class=&quot;markup--anchor markup--p-anchor&quot; data-href=&quot;https://quasar-framework.org/&quot; href=&quot;https://quasar-framework.org/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;Quasar&lt;/a&gt; (thanks to creator &lt;a class=&quot;markup--user markup--p-user&quot; data-action-type=&quot;hover&quot; data-action-value=&quot;80ef067b375&quot; data-action=&quot;show-user-card&quot; data-anchor-type=&quot;2&quot; data-href=&quot;https://medium.com/u/80ef067b375&quot; data-user-id=&quot;80ef067b375&quot; href=&quot;https://medium.com/u/80ef067b375&quot; target=&quot;_blank&quot;&gt;Razvan Stoenescu&lt;/a&gt;) a reactive &lt;a class=&quot;markup--anchor markup--p-anchor&quot; data-href=&quot;https://vuejs.org/&quot; href=&quot;https://vuejs.org/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;Vue.js&lt;/a&gt; framework. It supports many platforms and browsers out of the box.&lt;/div&gt;
&lt;br /&gt;
&lt;figure class=&quot;graf graf--figure&quot; name=&quot;d7c6&quot;&gt;&lt;img class=&quot;graf-image&quot; data-height=&quot;440&quot; data-image-id=&quot;1*WeVweqyOzHEAxIgSAt_xGw.png&quot; data-width=&quot;768&quot; height=&quot;228&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*WeVweqyOzHEAxIgSAt_xGw.png&quot; width=&quot;400&quot; /&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;cc44&quot;&gt;
Understanding my requirements I continued with the PayPal example to step &lt;a class=&quot;markup--anchor markup--p-anchor&quot; data-href=&quot;https://developer.paypal.com/docs/checkout/integrate/#3-render-the-smart-payment-buttons&quot; href=&quot;https://developer.paypal.com/docs/checkout/integrate/#3-render-the-smart-payment-buttons&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;3: render the button into my UI element&lt;/a&gt;.&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;fdd4&quot;&gt;
&lt;em class=&quot;markup--em markup--p-em&quot;&gt;Attempt #1&lt;/em&gt; call PayPal render button function to render &amp;lt;div id=“paypal-button-container” /&amp;gt; inside of the drop down box whenever @click event was triggered by drop down button.&lt;/div&gt;
&lt;br /&gt;
&lt;figure class=&quot;graf graf--figure graf--layoutOutsetLeft&quot; name=&quot;786c&quot;&gt;&lt;img class=&quot;graf-image&quot; data-height=&quot;148&quot; data-image-id=&quot;1*OWJSrqqCVLZDRll0pAAdcw.png&quot; data-width=&quot;365&quot; src=&quot;https://cdn-images-1.medium.com/max/600/1*OWJSrqqCVLZDRll0pAAdcw.png&quot; /&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;215c&quot;&gt;
As you can see from the screenshot and the error message below this did not work.&lt;/div&gt;
&lt;br /&gt;
&lt;figure class=&quot;graf graf--figure&quot; name=&quot;a900&quot;&gt;&lt;img class=&quot;graf-image&quot; data-height=&quot;41&quot; data-image-id=&quot;1*kgUF5GbQuehI8LtMushwZA.png&quot; data-width=&quot;599&quot; height=&quot;26&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*kgUF5GbQuehI8LtMushwZA.png&quot; width=&quot;400&quot; /&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;6e4d&quot;&gt;
It turns out &amp;lt;div id=“paypal-button-container” /&amp;gt; in my dropdown box is rendered dynamically and reactive on click events meaning it only exists when it dropped down. The PayPal smart buttons cannot find the div to render into.&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;a2d0&quot;&gt;
&lt;em class=&quot;markup--em markup--p-em&quot;&gt;Attempt #2&lt;/em&gt; clicking a checkout button inside the dialog box calling the PayPal render button.&lt;/div&gt;
&lt;br /&gt;
&lt;figure class=&quot;graf graf--figure&quot; name=&quot;ae6e&quot;&gt;&lt;img class=&quot;graf-image&quot; data-height=&quot;358&quot; data-image-id=&quot;1*aOg8ZpjTBcuSwTKdPO4QJQ.png&quot; data-width=&quot;752&quot; height=&quot;190&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*aOg8ZpjTBcuSwTKdPO4QJQ.png&quot; width=&quot;400&quot; /&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;26d4&quot;&gt;
&lt;strong class=&quot;markup--strong markup--p-strong&quot;&gt;Clicked!&lt;/strong&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;figure class=&quot;graf graf--figure&quot; name=&quot;e19b&quot;&gt;&lt;img class=&quot;graf-image&quot; data-height=&quot;268&quot; data-image-id=&quot;1*M8FDDVj56-IJpikfKjiaLA.png&quot; data-width=&quot;540&quot; height=&quot;198&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*M8FDDVj56-IJpikfKjiaLA.png&quot; width=&quot;400&quot; /&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;fd48&quot;&gt;
That worked because the button and div existed in the drop down when clicked. However, an extra click reduces customer conversion rates.&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;ea61&quot;&gt;
&lt;strong class=&quot;markup--strong markup--p-strong&quot;&gt;There must be a better way…&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;e00c&quot;&gt;
&lt;em class=&quot;markup--em markup--p-em&quot;&gt;Attempt #3&lt;/em&gt; add some more code Vue function &lt;a class=&quot;markup--anchor markup--p-anchor&quot; data-href=&quot;https://vuejs.org/v2/api/#Vue-nextTick&quot; href=&quot;https://vuejs.org/v2/api/#Vue-nextTick&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;$nextTick&lt;/a&gt; with PayPal render button.&lt;/div&gt;
&lt;br /&gt;
&lt;figure class=&quot;graf graf--figure&quot; name=&quot;32c6&quot;&gt;&lt;img class=&quot;graf-image&quot; data-height=&quot;120&quot; data-image-id=&quot;1*IJfE1daOI8EQOSnrGib-Ew.png&quot; data-width=&quot;828&quot; height=&quot;57&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*IJfE1daOI8EQOSnrGib-Ew.png&quot; width=&quot;400&quot; /&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;53fe&quot;&gt;
&lt;strong class=&quot;markup--strong markup--p-strong&quot;&gt;Works!&lt;/strong&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;figure class=&quot;graf graf--figure&quot; name=&quot;9c89&quot;&gt;&lt;img class=&quot;graf-image&quot; data-height=&quot;394&quot; data-image-id=&quot;1*dXm-DMgGleh0miuo_A_-5A.png&quot; data-width=&quot;750&quot; height=&quot;210&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*dXm-DMgGleh0miuo_A_-5A.png&quot; width=&quot;400&quot; /&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;1f08&quot;&gt;
But what happens when you run this on an iOS device such as iPad or iPhone?&lt;/div&gt;
&lt;br /&gt;
&lt;figure class=&quot;graf graf--figure&quot; name=&quot;31db&quot;&gt;&lt;img class=&quot;graf-image&quot; data-height=&quot;2653&quot; data-image-id=&quot;0*isgyZwtpaTFjbS9f&quot; data-unsplash-photo-id=&quot;tEMU4lzAL0w&quot; data-width=&quot;3993&quot; height=&quot;265&quot; src=&quot;https://cdn-images-1.medium.com/max/800/0*isgyZwtpaTFjbS9f&quot; width=&quot;400&quot; /&gt;&lt;figcaption class=&quot;imageCaption&quot;&gt;Photo by &lt;a class=&quot;markup--anchor markup--figure-anchor&quot; data-href=&quot;https://unsplash.com/@hhh13?utm_source=medium&amp;amp;utm_medium=referral&quot; href=&quot;https://unsplash.com/@hhh13?utm_source=medium&amp;amp;utm_medium=referral&quot; rel=&quot;photo-creator noopener noopener&quot; target=&quot;_blank&quot;&gt;FuYong Hua&lt;/a&gt; on&amp;nbsp;&lt;a class=&quot;markup--anchor markup--figure-anchor&quot; data-href=&quot;https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral&quot; href=&quot;https://unsplash.com/?utm_source=medium&amp;amp;utm_medium=referral&quot; rel=&quot;photo-source noopener noopener&quot; target=&quot;_blank&quot;&gt;Unsplash&lt;/a&gt;&lt;/figcaption&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;3fab&quot;&gt;
&lt;strong class=&quot;markup--strong markup--p-strong&quot;&gt;Broken…&lt;/strong&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;figure class=&quot;graf graf--figure graf--layoutOutsetLeft&quot; name=&quot;e5c8&quot;&gt;&lt;img class=&quot;graf-image&quot; data-height=&quot;2208&quot; data-image-id=&quot;1*tgDUegOj-zSBf8wl71c0OA.png&quot; data-width=&quot;1242&quot; height=&quot;640&quot; src=&quot;https://cdn-images-1.medium.com/max/600/1*tgDUegOj-zSBf8wl71c0OA.png&quot; width=&quot;360&quot; /&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;3bd8&quot;&gt;
Every time your drop down box drops you will get a new blank space at the top that pushes your new working button down.&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;ca3d&quot;&gt;
It keeps moving down indefinitely.&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;2099&quot;&gt;
How do we solve this problem?&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/section&gt;&lt;section class=&quot;section section--body&quot; name=&quot;9768&quot;&gt;&lt;div class=&quot;section-divider&quot;&gt;
&lt;hr class=&quot;section-divider&quot; /&gt;
&lt;/div&gt;
&lt;div class=&quot;section-content&quot;&gt;
&lt;div class=&quot;section-inner sectionLayout--insetColumn&quot;&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;056d&quot;&gt;
The solution here is to clear out the empty dynamic code that was left over by the PayPal Smart Button and not cleared for us by iOS. You can do it with the code below:&lt;/div&gt;
&lt;br /&gt;
&lt;figure class=&quot;graf graf--figure&quot; name=&quot;a59b&quot;&gt;&lt;img class=&quot;graf-image&quot; data-height=&quot;66&quot; data-image-id=&quot;1*VUuyfc3MWAaE0DwuvVhN2g.png&quot; data-width=&quot;1004&quot; height=&quot;25&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*VUuyfc3MWAaE0DwuvVhN2g.png&quot; width=&quot;400&quot; /&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;17c0&quot;&gt;
&lt;strong class=&quot;markup--strong markup--p-strong&quot;&gt;Next… Show me the money&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;76c8&quot;&gt;
Creating the checkout experience with UI customization — here we have itemized billing controlling item name, quantity, sku#, tax, price and currency.&lt;/div&gt;
&lt;br /&gt;
&lt;figure class=&quot;graf graf--figure&quot; name=&quot;8c3f&quot;&gt;&lt;img class=&quot;graf-image&quot; data-height=&quot;561&quot; data-image-id=&quot;1*6ORcYzZaRBCuJS_CntE5ug.png&quot; data-width=&quot;438&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*6ORcYzZaRBCuJS_CntE5ug.png&quot; /&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;59a1&quot;&gt;
The documentation at PayPal was difficult for me to navigate through. I eventually worked out a way to do it.&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;603a&quot;&gt;
&lt;strong class=&quot;markup--strong markup--p-strong&quot;&gt;How did I do it?&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;2858&quot;&gt;
I passed the function paypal.Button() a dictionary it can understand.&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;7b45&quot;&gt;
Let’s begin with “style” — we wanted a responsive pill shaped button with a checkout label and no tagline. Gold was a nice color and our view was horizontal giving us a basic button. If you want to try different UI shapes and designs take a look at the link below for inspiration:&lt;/div&gt;
&lt;div class=&quot;graf graf--mixtapeEmbed&quot; name=&quot;a4c2&quot;&gt;
&lt;a class=&quot;markup--anchor markup--mixtapeEmbed-anchor&quot; data-href=&quot;https://developer.paypal.com/docs/archive/checkout/how-to/customize-button/#button-styles&quot; href=&quot;https://developer.paypal.com/docs/archive/checkout/how-to/customize-button/#button-styles&quot; title=&quot;https://developer.paypal.com/docs/archive/checkout/how-to/customize-button/#button-styles&quot;&gt;&lt;strong class=&quot;markup--strong markup--mixtapeEmbed-strong&quot;&gt;Customize the PayPal Checkout Button - PayPal Developer&lt;/strong&gt;&lt;br /&gt;
&lt;em class=&quot;markup--em markup--mixtapeEmbed-em&quot;&gt;PayPal Checkout offers several style options to customize the look and feel of your smart payment button. You can also…&lt;/em&gt;developer.paypal.com&lt;/a&gt;&lt;a class=&quot;js-mixtapeImage mixtapeImage mixtapeImage--empty u-ignoreBlock&quot; data-media-id=&quot;3fd2223c533cdea8e7a5f82565b55fa9&quot; href=&quot;https://developer.paypal.com/docs/archive/checkout/how-to/customize-button/#button-styles&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;be4a&quot;&gt;
Follow the code gist below demonstrating style and itemized billing in the checkout window:&lt;/div&gt;
&lt;script src=&quot;https://gist.github.com/armedoctopus/0e4d0da3995483a26ea19268fc30f0cf.js&quot;&gt;&lt;/script&gt;&lt;br /&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;bcec&quot;&gt;
If you see Amazon AWS Amplify references in there it’s because that is my current backend and I wanted a way to store identifiable customer data within the checkout process and keep track of who paid what, when, where, and how.&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;1ad3&quot;&gt;
I hope this helps people integrate with the new PayPal Smart Buttons.&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;b8f2&quot;&gt;
If you know any other gotchas or special cases like the ones above please let me know and I’ll add them to the list.&lt;/div&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;52af&quot;&gt;
Here is the official integration guide from PayPal&lt;/div&gt;
&lt;div class=&quot;graf graf--mixtapeEmbed&quot; name=&quot;cc86&quot;&gt;
&lt;a class=&quot;markup--anchor markup--mixtapeEmbed-anchor&quot; data-href=&quot;https://developer.paypal.com/docs/archive/checkout/&quot; href=&quot;https://developer.paypal.com/docs/archive/checkout/&quot; title=&quot;https://developer.paypal.com/docs/archive/checkout/&quot;&gt;&lt;strong class=&quot;markup--strong markup--mixtapeEmbed-strong&quot;&gt;PayPal Checkout Overview - PayPal Developer&lt;/strong&gt;&lt;br /&gt;
&lt;em class=&quot;markup--em markup--mixtapeEmbed-em&quot;&gt;Checkout Add checkout buttons to your page and more&lt;/em&gt;developer.paypal.com&lt;/a&gt;&lt;a class=&quot;js-mixtapeImage mixtapeImage mixtapeImage--empty u-ignoreBlock&quot; data-media-id=&quot;6ab5c7c0c90dee4b260f8b96f05f28b7&quot; href=&quot;https://developer.paypal.com/docs/archive/checkout/&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/section&gt;&lt;section class=&quot;section section--body&quot; name=&quot;a025&quot;&gt;&lt;div class=&quot;section-divider&quot;&gt;
&lt;hr class=&quot;section-divider&quot; /&gt;
&lt;/div&gt;
&lt;div class=&quot;section-content&quot;&gt;
&lt;div class=&quot;section-inner sectionLayout--insetColumn&quot;&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;516f&quot;&gt;
&lt;div class=&quot;graf graf--p&quot; name=&quot;400a&quot;&gt;
If I helped you in some way please clap and subscribe below:&lt;/div&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;embedly-card&quot;&gt;
&lt;h4&gt;
&lt;a href=&quot;https://upscri.be/0d4f8a-2/&quot;&gt;Sign up for the newsletter!&lt;/a&gt;&lt;/h4&gt;
Get solid gold sent to your inbox. Every week!&lt;/blockquote&gt;
&lt;script async=&quot;&quot; charset=&quot;UTF-8&quot; src=&quot;//cdn.embedly.com/widgets/platform.js&quot;&gt;&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;graf graf--p graf--empty&quot; name=&quot;e77f&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/section&gt;</description><link>https://crosslinkedcoder.blogspot.com/2019/04/integrating-new-paypal-smart-buttons.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1309467374034010002.post-7149599428124166289</guid><pubDate>Tue, 18 Nov 2014 22:55:00 +0000</pubDate><atom:updated>2014-11-18T14:55:01.522-08:00</atom:updated><title>How to get Aptana Studio 3 to run on Yosemite 10.10.1</title><description>I was getting a very cryptic Java error message when attempting to start Aptana Studio 3 on Yosemite 10.10.1&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The key to solving the problem was found here:&lt;/div&gt;
&lt;div&gt;
http://support.apple.com/kb/DL1572?viewlocale=en_US&amp;amp;locale=en_US&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This is the official Java that is supported by Apple and fixed the issue after it was installed.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjM62a5aZqrmuJtYMa0xp8vD_IOXXSdZNRv2yCoXKjYh9ZEK6946c-c9ewLgTsPfcEUb-qIoBK0BZlAlJN_YUa6FezhBcnF4V4dMo7WQPhRj02KsJ9IizP3NQi6nmCFGvnlch9st5Uprs/s1600/Screen+Shot+2014-11-18+at+2.53.37+PM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjM62a5aZqrmuJtYMa0xp8vD_IOXXSdZNRv2yCoXKjYh9ZEK6946c-c9ewLgTsPfcEUb-qIoBK0BZlAlJN_YUa6FezhBcnF4V4dMo7WQPhRj02KsJ9IizP3NQi6nmCFGvnlch9st5Uprs/s1600/Screen+Shot+2014-11-18+at+2.53.37+PM.png&quot; height=&quot;227&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>https://crosslinkedcoder.blogspot.com/2014/11/how-to-get-aptana-studio-3-to-run-on.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjM62a5aZqrmuJtYMa0xp8vD_IOXXSdZNRv2yCoXKjYh9ZEK6946c-c9ewLgTsPfcEUb-qIoBK0BZlAlJN_YUa6FezhBcnF4V4dMo7WQPhRj02KsJ9IizP3NQi6nmCFGvnlch9st5Uprs/s72-c/Screen+Shot+2014-11-18+at+2.53.37+PM.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1309467374034010002.post-4636548493632270621</guid><pubDate>Fri, 17 Jan 2014 01:22:00 +0000</pubDate><atom:updated>2014-07-18T17:06:18.978-07:00</atom:updated><title>How to Fix Gradle Build Errors with Android Studio</title><description>Hi Cross Linked Coders,&lt;br /&gt;
&lt;br /&gt;
I was trying to build an old ADT project for Android with Android Studio 0.4.2 and I faced a whole bunch of error messages.&lt;br /&gt;
&lt;br /&gt;
The errors were all related to an older gradle version.&lt;br /&gt;
&lt;br /&gt;
Essentially deleting the gradle 1.8 folder and placing the gradle 1.9 folder was one of the many steps to fix this.&lt;br /&gt;
&lt;br /&gt;
Build.gradle needed to be changed to: &lt;br /&gt;
&lt;blockquote&gt;
classpath &#39;com.android.tools.build:gradle:0.7.+&#39;&lt;/blockquote&gt;
and &lt;br /&gt;
&lt;blockquote&gt;
buildToolsVersion &quot;19&quot;&lt;/blockquote&gt;
The final error message was the most cryptic essentially the build was error free but when attempting to run the application there was a gradle sync error message.  What solved this was clicking on the &quot;Sync Project with Gradle Files&quot; button. Which looks like this on the toolbar:&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXG_9d6HdzcQUw1iwIQ609LH70LT3COquU2MzsGIWv0FsvdTIqWP689jbJSTs1hJBICP362LpQWnQxKU4XzH4suJw6nHcPfobdnj21vXqjmCbi9WEVdmz3F36Fw9sZZ7OC0Ncbr8bExpA/s1600/Screen+Shot+2014-01-16+at+5.18.07+PM.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXG_9d6HdzcQUw1iwIQ609LH70LT3COquU2MzsGIWv0FsvdTIqWP689jbJSTs1hJBICP362LpQWnQxKU4XzH4suJw6nHcPfobdnj21vXqjmCbi9WEVdmz3F36Fw9sZZ7OC0Ncbr8bExpA/s320/Screen+Shot+2014-01-16+at+5.18.07+PM.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After going through all this I found a somewhat interesting list to fix the gradle issues here:&lt;br /&gt;
&lt;a href=&quot;http://tools.android.com/recent/androidstudio040released&quot;&gt;http://tools.android.com/recent/androidstudio040released&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
However 0.4.2 is the latest Android Studio so their list is a little out of date but is still helpful.&lt;br /&gt;
&lt;br /&gt;
One thing to note is adding external .jar libraries to projects that don&#39;t use gradle you can drag the jar files into the project and then right click on the file and add as a library to the project. If the project is using gradle simply create a &quot;libs&quot; folder in the project and add all the .jar libraries to that folder.&lt;br /&gt;
&lt;br /&gt;
Update 1:&lt;br /&gt;
If you have multiple modules in your project to solve gradle errors it is best to use the same version for the following structures:&lt;br /&gt;
dependencies {&lt;br /&gt;
classpath &#39;com.android.tools.build:gradle:0.12.+&#39;&lt;br /&gt;
}&lt;br /&gt;
android {&lt;br /&gt;
buildToolsVersion &quot;20.0.0&quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Update 2:&lt;br /&gt;
If you get an error such as:&lt;br /&gt;
UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define...&lt;br /&gt;
&lt;br /&gt;
Any Dex errors in my case have always been because a library has been included twice in the module or project, either through copying the .jar file to the project file space or through module library linking.&lt;br /&gt;
&lt;br /&gt;
Update 3 -- Slightly off-topic:&lt;br /&gt;
If you have any Android SDK Manager errors when either downloading from a repository or repository information is not showing up or is out of date -- then the best thing to do is to delete all termporary files which is done through the JAVA settings of your computer.</description><link>https://crosslinkedcoder.blogspot.com/2014/01/gradle-build-errors-with-android-studio.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXG_9d6HdzcQUw1iwIQ609LH70LT3COquU2MzsGIWv0FsvdTIqWP689jbJSTs1hJBICP362LpQWnQxKU4XzH4suJw6nHcPfobdnj21vXqjmCbi9WEVdmz3F36Fw9sZZ7OC0Ncbr8bExpA/s72-c/Screen+Shot+2014-01-16+at+5.18.07+PM.png" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1309467374034010002.post-9190683744102921369</guid><pubDate>Sun, 18 Sep 2011 18:22:00 +0000</pubDate><atom:updated>2011-09-18T12:06:20.577-07:00</atom:updated><title>New Syntax to Array Indexing with C++</title><description>I was amazed to find a new syntax for indexing into arrays.

&lt;br /&gt;&lt;PRE&gt;&lt;FONT COLOR=&quot;#000099&quot;&gt;#include &amp;lt;iostream&amp;gt;
&lt;/FONT&gt;&lt;FONT COLOR=&quot;#FF6633&quot;&gt;
int&lt;/FONT&gt; a&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;[] = {&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#999900&quot;&gt;1&lt;/FONT&gt;&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;,&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#999900&quot;&gt; 12&lt;/FONT&gt;&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;,&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#999900&quot;&gt; 2&lt;/FONT&gt;&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;,&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#999900&quot;&gt; 8&lt;/FONT&gt;&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;};&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#FF6633&quot;&gt;

int&lt;/FONT&gt; b&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;[] = {&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#999900&quot;&gt;23&lt;/FONT&gt;&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;,&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#999900&quot;&gt; 11&lt;/FONT&gt;&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;,&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#999900&quot;&gt; 2&lt;/FONT&gt;&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;,&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#999900&quot;&gt; 3&lt;/FONT&gt;&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;};&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#FF6633&quot;&gt;

int&lt;/FONT&gt;&lt;FONT COLOR=&quot;#990000&quot;&gt; main&lt;/FONT&gt;&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;()
{&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#FF6633&quot;&gt;
    int&lt;/FONT&gt; ind&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt; =&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#999900&quot;&gt; 3&lt;/FONT&gt;&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#FF6633&quot;&gt;
    int&lt;/FONT&gt; c&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt; =&lt;/FONT&gt;&lt;/B&gt; ind&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;[&lt;/FONT&gt;&lt;/B&gt;b&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;][&lt;/FONT&gt;&lt;/B&gt;a&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;];&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#FF6633&quot;&gt;

    int&lt;/FONT&gt; d&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt; =&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#999900&quot;&gt; 2&lt;/FONT&gt;&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;[&lt;/FONT&gt;&lt;/B&gt;a&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;][&lt;/FONT&gt;&lt;/B&gt;b&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;];&lt;/FONT&gt;&lt;/B&gt;

    cout&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt; &amp;lt;&amp;lt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#009900&quot;&gt; &quot;c = &quot;&lt;/FONT&gt;&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt; &amp;lt;&amp;lt;&lt;/FONT&gt;&lt;/B&gt; c&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt; &amp;lt;&amp;lt;&lt;/FONT&gt;&lt;/B&gt; std&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;::&lt;/FONT&gt;&lt;/B&gt;endl&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt; &amp;lt;&amp;lt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#009900&quot;&gt;&quot;d = &quot;&lt;/FONT&gt;&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt; &amp;lt;&amp;lt;&lt;/FONT&gt;&lt;/B&gt; d&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT COLOR=&quot;#FF0000&quot;&gt;

    return&lt;/FONT&gt;&lt;FONT COLOR=&quot;#999900&quot;&gt; 0&lt;/FONT&gt;&lt;B&gt;&lt;FONT COLOR=&quot;#663300&quot;&gt;;
}&lt;/FONT&gt;&lt;/B&gt;&lt;/PRE&gt;
The Magic here is that the arrays are evaluated and indexed from left to right using integer variables or intrinsic integers.&lt;br /&gt;
&lt;br /&gt;
c&amp;nbsp; =&amp;nbsp; 8&lt;br /&gt;
d&amp;nbsp; =&amp;nbsp; 2</description><link>https://crosslinkedcoder.blogspot.com/2011/09/lambda-style-array-indexing-with-c.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1309467374034010002.post-1455398792276804739</guid><pubDate>Mon, 02 May 2011 04:54:00 +0000</pubDate><atom:updated>2011-05-01T21:56:47.218-07:00</atom:updated><title>C++ polymorphic shock of passing derived object arrays into a base object pointer function parameter</title><description>Code example:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;strong&gt;#include &lt;span style=&quot;color: green;&quot;&gt;&amp;lt;cstdio&amp;gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;

&lt;strong&gt;class&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;Mammal&lt;/span&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/span&gt;
&lt;strong&gt;public&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;:&lt;/span&gt;
    &lt;strong&gt;virtual&lt;/strong&gt; &lt;strong&gt;bool&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;IsFurry&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;

&lt;strong&gt;class&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;Dog&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;:&lt;/span&gt; &lt;strong&gt;public&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;Mammal&lt;/span&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/span&gt;
    &lt;strong&gt;bool&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;isFurryBreed&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;
&lt;strong&gt;public&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;:&lt;/span&gt;
    &lt;span style=&quot;color: #2040a0;&quot;&gt;Dog&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;isFurryBreed&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;=&lt;/span&gt; &lt;strong&gt;false&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/span&gt;

    &lt;strong&gt;virtual&lt;/strong&gt; &lt;strong&gt;bool&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;IsFurry&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/span&gt;
        &lt;strong&gt;return&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;isFurryBreed&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/span&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;

&lt;span style=&quot;color: #444444;&quot;&gt;//the line below didn&#39;t compile&lt;/span&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;//int FindFurryMammal(Mammal pMammals[], int arraySize)&lt;/span&gt;
&lt;strong&gt;int&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;FindFurryMammal&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;Mammal *&lt;/span&gt;&lt;span style=&quot;color: #2040a0;&quot;&gt;pMammals&lt;/span&gt;, &lt;strong&gt;int&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;arraySize&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/span&gt;
    &lt;strong&gt;for&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt; &lt;strong&gt;int&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;i&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;i&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;arraySize&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/span&gt;
        &lt;strong&gt;if&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;pMammals&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #2040a0;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;]&lt;/span&gt;.&lt;span style=&quot;color: #2040a0;&quot;&gt;IsFurry&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt;
        &lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/span&gt;
            &lt;strong&gt;return&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/span&gt;
    &lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/span&gt;
    &lt;strong&gt;return&lt;/strong&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/span&gt;

&lt;strong&gt;int&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt;&lt;strong&gt;int&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;argc&lt;/span&gt;, &lt;strong&gt;char&lt;/strong&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;argv&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/span&gt;
    &lt;span style=&quot;color: #2040a0;&quot;&gt;Dog&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;dogs&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;
    &lt;strong&gt;int&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;found&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: #2040a0;&quot;&gt;found&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;FindFurryMammal&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(dog&lt;/span&gt;&lt;span style=&quot;color: #2040a0;&quot;&gt;s&lt;/span&gt;, &lt;span style=&quot;color: red;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: #2040a0;&quot;&gt;printf&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&quot;Furry mammal found at index %d&lt;span style=&quot;color: #77dd77;&quot;&gt;\n&lt;/span&gt;&quot;&lt;/span&gt;, &lt;span style=&quot;color: #2040a0;&quot;&gt;found&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;
    
    &lt;strong&gt;return&lt;/strong&gt; &lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;br /&gt;
The code above suffers from polymorphic shock. Indexing through pMammals would be ok if polymorphism&amp;nbsp;downcasted all the indices of&amp;nbsp;Dog into the&amp;nbsp;Mammal base class. However, polymorphism can only cast one index at a time even if passed as a parameter to a function.&lt;br /&gt;
So two issues ensue where only the first index of&amp;nbsp;Dog is casted to&amp;nbsp;Mammal, and therefore, any indexing beyond index 0 of pMammals&amp;nbsp;will result in the indexing of incorrect&amp;nbsp;memory location. This&amp;nbsp;results in an exception error thrown at run-time when the function IsFurry is called since that function does not exist at that memory location.</description><link>https://crosslinkedcoder.blogspot.com/2011/05/polymorphic-shock-of-passing-derived.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1309467374034010002.post-7501987108819141965</guid><pubDate>Mon, 02 May 2011 02:17:00 +0000</pubDate><atom:updated>2011-05-01T19:48:00.489-07:00</atom:updated><title>The dangers of C++ string literals and non-const pointers</title><description>&lt;span style=&quot;color: red;&quot;&gt;Foreword:&lt;/span&gt; I originally gained insight into this issue from&amp;nbsp;Pete Isensee&#39;s blog post &quot;When it Rains&quot;.&lt;br /&gt;
&lt;br /&gt;
For years I used to take this line of C++ code for granted:&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;const&lt;/strong&gt; &lt;strong&gt;char&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;str&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;&quot;abcdef&quot;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
However, &lt;strong&gt;const &lt;/strong&gt;protects you from&amp;nbsp;altering the defined&amp;nbsp;string literal values which is a good programmer habbit. &lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;Question:&lt;/span&gt;&lt;br /&gt;
Why is this important, and why do most programmers use it?&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;Answer:&lt;/span&gt;&lt;br /&gt;
It&#39;s very important because according to the standard &lt;span style=&quot;color: red;&quot;&gt;2.13.4&lt;/span&gt;/&lt;span style=&quot;color: red;&quot;&gt;2&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;&quot;the effect of attempting to modify a string literal is undefined&quot;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;Question:&lt;/span&gt;&lt;br /&gt;
What is the correct way to alter strings?&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;Answer:&lt;/span&gt;&lt;br /&gt;
If you want to dynamically change string values use a character array because it creates a copy of the&amp;nbsp;string.&amp;nbsp;Moreover,&amp;nbsp;the character array&amp;nbsp;will&amp;nbsp;terminate nicely with&amp;nbsp;the null character &lt;span style=&quot;color: green;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: #77dd77;&quot;&gt;\0&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#39;&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;Correct declaration and defintion:&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;char&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;str&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;&quot;abcdef&quot;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;Don&#39;t do this because it is undefined:&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;char&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;str&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;&quot;abcdef&quot;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #2040a0;&quot;&gt;str&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;&#39;k&#39;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;Do this instead:&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;char&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;str&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;&quot;abcdef&quot;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #2040a0;&quot;&gt;str&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;&#39;k&#39;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;</description><link>https://crosslinkedcoder.blogspot.com/2011/05/dangers-of-string-literals-and-non.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1309467374034010002.post-3981404944848369426</guid><pubDate>Mon, 02 May 2011 01:19:00 +0000</pubDate><atom:updated>2011-05-01T22:28:16.485-07:00</atom:updated><title>C++ post and pre-increment operator overloading does not behave like intrinsic type operators</title><description>&lt;span style=&quot;color: #444444;&quot;&gt;//C++ post and pre-increment operator overloading does not behave like intrinsic types&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;//Version: 1.00&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;strong&gt;#include &lt;span style=&quot;color: green;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;using&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;std&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #2040a0;&quot;&gt;cout&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;using&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;std&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #2040a0;&quot;&gt;endl&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;using&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;std&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #2040a0;&quot;&gt;ostream&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;class&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;IntWrapper&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&amp;nbsp; friend&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;ostream&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;strong&gt;operator&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;ostream&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;amp;&lt;/span&gt;, &lt;strong&gt;const&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;IntWrapper&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&amp;nbsp; public&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #2040a0;&quot;&gt;&amp;nbsp; IntWrapper&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt; &lt;strong&gt;int&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;val&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2040a0;&quot;&gt;val&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #2040a0;&quot;&gt;&amp;nbsp; IntWrapper&lt;/span&gt; &lt;strong&gt;operator&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt; &lt;strong&gt;const&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;IntWrapper&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;rhs&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt; &lt;strong&gt;const&lt;/strong&gt;&lt;br /&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;&amp;nbsp; {&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //use RVO&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;IntWrapper&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt; &lt;strong&gt;this&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #2040a0;&quot;&gt;i&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;rhs&lt;/span&gt;.&lt;span style=&quot;color: #2040a0;&quot;&gt;i&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;&amp;nbsp; }&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #2040a0;&quot;&gt;&amp;nbsp; IntWrapper&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;strong&gt;operator&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;&amp;nbsp; {&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; +&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt;&lt;strong&gt;this&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #2040a0;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/strong&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;*&lt;/span&gt;&lt;strong&gt;this&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;&amp;nbsp; }&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #2040a0;&quot;&gt;&amp;nbsp; IntWrapper&lt;/span&gt; &lt;strong&gt;operator&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt;&lt;strong&gt;int&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;&amp;nbsp; {&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #2040a0;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IntWrapper&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;tmp&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;*&lt;/span&gt;&lt;strong&gt;this&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;strong&gt;operator&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;tmp&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;&amp;nbsp; }&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&amp;nbsp; private&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&amp;nbsp; int&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #2040a0;&quot;&gt;ostream&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;strong&gt;operator&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;ostream&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;amp;&lt;/span&gt;, &lt;strong&gt;const&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;IntWrapper&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;int&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp; //interesting results of the post and pre increment operators&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #2040a0;&quot;&gt;&amp;nbsp; IntWrapper&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;test&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&amp;nbsp; int&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;i&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #2040a0;&quot;&gt;&amp;nbsp; IntWrapper&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;test1&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;test&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;test&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&amp;nbsp; int&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;test2&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;i&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp; //test1 should be the same as test2 but they are not&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #2040a0;&quot;&gt;&amp;nbsp; cout&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;test1&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;&quot;&amp;nbsp;for intrinsic types test1 should be the same as&amp;nbsp;test2 but is not since&amp;nbsp;they are not intrinsic types&amp;nbsp;&quot;&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #2040a0;&quot;&gt;&amp;nbsp; test2&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;endl&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #2040a0;&quot;&gt;&amp;nbsp; cout&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;i&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;test&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;test&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;endl&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #2040a0;&quot;&gt;&amp;nbsp; system&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&quot;pause&quot;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #2040a0;&quot;&gt;ostream&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;strong&gt;operator&lt;/strong&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;(&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;ostream&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #2040a0;&quot;&gt;output&lt;/span&gt;, &lt;strong&gt;const&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;IntWrapper&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #2040a0;&quot;&gt;r&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #2040a0;&quot;&gt;&amp;nbsp; output&lt;/span&gt; &lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;r&lt;/span&gt;.&lt;span style=&quot;color: #2040a0;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&amp;nbsp; return&lt;/strong&gt; &lt;span style=&quot;color: #2040a0;&quot;&gt;output&lt;/span&gt;&lt;span style=&quot;color: #4444ff;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #4444ff;&quot;&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The conclusion to this experiment is that&amp;nbsp;due to the unspecified behavior according to clause [5/4]&lt;br /&gt;
of the standard the assumption that overloading post and pre increment operators will behave in the same&amp;nbsp;manner as the intrinsic type operators&amp;nbsp;is incorrect and not waranted by the standard.</description><link>https://crosslinkedcoder.blogspot.com/2011/05/c-post-and-pre-increment-operator.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1309467374034010002.post-1780044313088632725</guid><pubDate>Sun, 01 May 2011 01:12:00 +0000</pubDate><atom:updated>2011-05-01T21:07:22.259-07:00</atom:updated><title>Setup Windows Phone 7 apps with Smaato ads for Microsoft XNA framework</title><description>&lt;span style=&quot;color: black;&quot;&gt;You might be asking yourself why you would choose smaato to monetize with in-app ads. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;Firstly,&amp;nbsp;smaato supports many countries&amp;nbsp;and it has the SOMA SDK that&amp;nbsp;is compatible with XNA.&lt;/span&gt;&lt;br /&gt;
Secondly, it allows for transfering of ad revenue through &lt;a href=&quot;http://www.paypal.com/&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;http://www.paypal.com/&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;Note&lt;/span&gt;: this tutorial is for Windows Phone 7 XNA framework and not for Silverlight framework.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) Sign up for a smaato account at &lt;a href=&quot;http://www.smaato.com/&quot;&gt;http://www.smaato.com/&lt;/a&gt;&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
2) Generate AdSpace under the tab My Sites &amp;amp; Apps&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;separator&quot; style=&quot;margin: 0in 0in 0pt; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhme2IzEzQOOsT7mYlyuKdwE20VnuhFE75UhD_LKasuDmorANeF5m0dX3T0tbndd1G-B8HXPD9h52lx9v5VJQr8G8LCv1uydT8NE7XHiIpTEnqM3z2jyuAybYZtGl5TEvEqPfv4F_yi_jk/s1600/appAndPublisherID.jpg&quot;&gt;&lt;span style=&quot;mso-no-proof: yes; text-decoration: none; text-underline: none;&quot;&gt;&lt;shapetype coordsize=&quot;21600,21600&quot; filled=&quot;f&quot; id=&quot;_x0000_t75&quot; o:preferrelative=&quot;t&quot; o:spt=&quot;75&quot; path=&quot;m@4@5l@4@11@9@11@9@5xe&quot; stroked=&quot;f&quot;&gt;&lt;stroke joinstyle=&quot;miter&quot;&gt;&lt;/stroke&gt;&lt;formulas&gt;&lt;f eqn=&quot;if lineDrawn pixelLineWidth 0&quot;&gt;&lt;/f&gt;&lt;f eqn=&quot;sum @0 1 0&quot;&gt;&lt;/f&gt;&lt;f eqn=&quot;sum 0 0 @1&quot;&gt;&lt;/f&gt;&lt;f eqn=&quot;prod @2 1 2&quot;&gt;&lt;/f&gt;&lt;f eqn=&quot;prod @3 21600 pixelWidth&quot;&gt;&lt;/f&gt;&lt;f eqn=&quot;prod @3 21600 pixelHeight&quot;&gt;&lt;/f&gt;&lt;f eqn=&quot;sum @0 0 1&quot;&gt;&lt;/f&gt;&lt;f eqn=&quot;prod @6 1 2&quot;&gt;&lt;/f&gt;&lt;f eqn=&quot;prod @7 21600 pixelWidth&quot;&gt;&lt;/f&gt;&lt;f eqn=&quot;sum @8 21600 0&quot;&gt;&lt;/f&gt;&lt;f eqn=&quot;prod @7 21600 pixelHeight&quot;&gt;&lt;/f&gt;&lt;f eqn=&quot;sum @10 21600 0&quot;&gt;&lt;/f&gt;&lt;/formulas&gt;&lt;path gradientshapeok=&quot;t&quot; o:connecttype=&quot;rect&quot; o:extrusionok=&quot;f&quot;&gt;&lt;/path&gt;&lt;lock aspectratio=&quot;t&quot; v:ext=&quot;edit&quot;&gt;&lt;/lock&gt;&lt;/shapetype&gt;&lt;shape alt=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhme2IzEzQOOsT7mYlyuKdwE20VnuhFE75UhD_LKasuDmorANeF5m0dX3T0tbndd1G-B8HXPD9h52lx9v5VJQr8G8LCv1uydT8NE7XHiIpTEnqM3z2jyuAybYZtGl5TEvEqPfv4F_yi_jk/s320/appAndPublisherID.jpg&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhme2IzEzQOOsT7mYlyuKdwE20VnuhFE75UhD_LKasuDmorANeF5m0dX3T0tbndd1G-B8HXPD9h52lx9v5VJQr8G8LCv1uydT8NE7XHiIpTEnqM3z2jyuAybYZtGl5TEvEqPfv4F_yi_jk/s1600/appAndPublisherID.jpg&quot; id=&quot;Picture_x0020_2&quot; o:button=&quot;t&quot; o:spid=&quot;_x0000_i1032&quot; style=&quot;height: 48pt; mso-wrap-style: square; visibility: visible; width: 240pt;&quot; type=&quot;#_x0000_t75&quot;&gt;&lt;fill o:detectmouseclick=&quot;t&quot;&gt;&lt;/fill&gt;&lt;imagedata o:title=&quot;appAndPublisherID&quot; src=&quot;file:///C:\Users\pahope\AppData\Local\Temp\msohtmlclip1\01\clip_image001.jpg&quot;&gt;&lt;/imagedata&gt;&lt;/shape&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHlFXWB12G0Lq6HQpagENzZIPMt9i0K8RdH0fcabbpkY-WYg2DEDW_C5-CZi_qTV3wluSevPNGK67PfCqONi0buhoBzlr8I1U-ctN48vJ4WWO6oYfEYZpD4EJ7iIJD_Bb73yPENQqihcE/s1600/appAndPublisherID.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;64&quot; j8=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHlFXWB12G0Lq6HQpagENzZIPMt9i0K8RdH0fcabbpkY-WYg2DEDW_C5-CZi_qTV3wluSevPNGK67PfCqONi0buhoBzlr8I1U-ctN48vJ4WWO6oYfEYZpD4EJ7iIJD_Bb73yPENQqihcE/s320/appAndPublisherID.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
3)&amp;nbsp;Select - App (Windows Phone 7)&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;Note:&lt;/span&gt; This will generate your PublisherID and AdSpaceID -- these are very important and will be required as identifiers for you and your app.&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
4) Download the SOMA SDK for Windows Phone 7&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;separator&quot; style=&quot;margin: 0in 0in 0pt; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEit7cO67JmWuuCoqNxpfaw5iCghDysaNxrKo8_dBb2efXhdxFdYCN-ImXHVFOFpPwwOmxFOQmT_ZrvPjoweNjlNXnGrIcwqS_a08sYjscwO7yrZizTZK5TNc10oNDJ7FRsepuUsTtf8_lI/s1600/sdkSelect.jpg&quot;&gt;&lt;span style=&quot;mso-no-proof: yes; text-decoration: none; text-underline: none;&quot;&gt;&lt;shape alt=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEit7cO67JmWuuCoqNxpfaw5iCghDysaNxrKo8_dBb2efXhdxFdYCN-ImXHVFOFpPwwOmxFOQmT_ZrvPjoweNjlNXnGrIcwqS_a08sYjscwO7yrZizTZK5TNc10oNDJ7FRsepuUsTtf8_lI/s320/sdkSelect.jpg&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEit7cO67JmWuuCoqNxpfaw5iCghDysaNxrKo8_dBb2efXhdxFdYCN-ImXHVFOFpPwwOmxFOQmT_ZrvPjoweNjlNXnGrIcwqS_a08sYjscwO7yrZizTZK5TNc10oNDJ7FRsepuUsTtf8_lI/s1600/sdkSelect.jpg&quot; id=&quot;Picture_x0020_3&quot; o:button=&quot;t&quot; o:spid=&quot;_x0000_i1031&quot; style=&quot;height: 194.25pt; mso-wrap-style: square; visibility: visible; width: 240pt;&quot; type=&quot;#_x0000_t75&quot;&gt;&lt;fill o:detectmouseclick=&quot;t&quot;&gt;&lt;/fill&gt;&lt;imagedata o:title=&quot;sdkSelect&quot; src=&quot;file:///C:\Users\pahope\AppData\Local\Temp\msohtmlclip1\01\clip_image002.jpg&quot;&gt;&lt;/imagedata&gt;&lt;/shape&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmkLnaJkSk3XJTp2nEyCx3qrpQgE-PSC9u9ND8795mUg8m9jb0PEdtPjMD9N1nuna4s-tzcThWHMi4wAIMtK-nKlRwjR2KseULonL0Uc-JsN7RQE7rb3Fyaj-L_9BxegQD7xUb9EVXXBk/s1600/sdkSelect.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;259&quot; j8=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmkLnaJkSk3XJTp2nEyCx3qrpQgE-PSC9u9ND8795mUg8m9jb0PEdtPjMD9N1nuna4s-tzcThWHMi4wAIMtK-nKlRwjR2KseULonL0Uc-JsN7RQE7rb3Fyaj-L_9BxegQD7xUb9EVXXBk/s320/sdkSelect.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;separator&quot; style=&quot;margin: 0in 0in 0pt; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;separator&quot; style=&quot;margin: 0in 0in 0pt; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
﻿5)&amp;nbsp;From the SOMA SDK zip file place the SOMAWP7.dll and SOMAWP7.pdb files into your Windows Phone 7 project where the projectname.csproj file is located.&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;separator&quot; style=&quot;margin: 0in 0in 0pt; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggnoJqecwDh9QjVc19AqmuNjLSrP7Z_nG58k-q9sP1ShvFYc9IYOQZLwKpBEu45lCsW5zS7fqLCMgN-IsKoavxll2yDPAkDaeuImxdxOUfq9PVp4LRM8iA3qQBaHt9R4_bGvv_u6dpmUQ/s1600/dllAndpdb.jpg&quot;&gt;&lt;span style=&quot;mso-no-proof: yes; text-decoration: none; text-underline: none;&quot;&gt;&lt;shape alt=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggnoJqecwDh9QjVc19AqmuNjLSrP7Z_nG58k-q9sP1ShvFYc9IYOQZLwKpBEu45lCsW5zS7fqLCMgN-IsKoavxll2yDPAkDaeuImxdxOUfq9PVp4LRM8iA3qQBaHt9R4_bGvv_u6dpmUQ/s320/dllAndpdb.jpg&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggnoJqecwDh9QjVc19AqmuNjLSrP7Z_nG58k-q9sP1ShvFYc9IYOQZLwKpBEu45lCsW5zS7fqLCMgN-IsKoavxll2yDPAkDaeuImxdxOUfq9PVp4LRM8iA3qQBaHt9R4_bGvv_u6dpmUQ/s1600/dllAndpdb.jpg&quot; id=&quot;Picture_x0020_4&quot; o:button=&quot;t&quot; o:spid=&quot;_x0000_i1030&quot; style=&quot;height: 81.75pt; mso-wrap-style: square; visibility: visible; width: 240pt;&quot; type=&quot;#_x0000_t75&quot;&gt;&lt;fill o:detectmouseclick=&quot;t&quot;&gt;&lt;/fill&gt;&lt;imagedata o:title=&quot;dllAndpdb&quot; src=&quot;file:///C:\Users\pahope\AppData\Local\Temp\msohtmlclip1\01\clip_image003.jpg&quot;&gt;&lt;/imagedata&gt;&lt;/shape&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj789Ff2bNn6WbYA8B5rIG_Dhx5g6D9pDz0hPgCe21ZJjIAmYk4vyMRdOeIYFEMtdyDn0q2RlkTMUiKqstbdn7TwYcmbMJxcjXERwSjiAJJFx0GE9LB-khl8gmEK2AE_przIjywONBxm8k/s1600/dllAndpdb.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;109&quot; j8=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj789Ff2bNn6WbYA8B5rIG_Dhx5g6D9pDz0hPgCe21ZJjIAmYk4vyMRdOeIYFEMtdyDn0q2RlkTMUiKqstbdn7TwYcmbMJxcjXERwSjiAJJFx0GE9LB-khl8gmEK2AE_przIjywONBxm8k/s320/dllAndpdb.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;separator&quot; style=&quot;margin: 0in 0in 0pt; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;separator&quot; style=&quot;margin: 0in 0in 0pt; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
6) In your Windows Phone 7 project Right click on References in your Solution Explorer and ad SOMAWP7.DLL from Add Reference Browse tab and Microsoft.Phone from Add Reference .Net tab&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8Y2P1y2frDTJJw6VsshOapyHowqXYIiexpcOP1ocwGeDzBhgGAWAIsufk0BUpytL6BLKXWQ6jT9nbR64fklyFNhFBbJvotB8Si-ADHKTJMey-Yms_dmNLN1sqpTkuzBM1U_5dj-3LpeI/s1600/projectReference.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; cssfloat: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; j8=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8Y2P1y2frDTJJw6VsshOapyHowqXYIiexpcOP1ocwGeDzBhgGAWAIsufk0BUpytL6BLKXWQ6jT9nbR64fklyFNhFBbJvotB8Si-ADHKTJMey-Yms_dmNLN1sqpTkuzBM1U_5dj-3LpeI/s320/projectReference.jpg&quot; width=&quot;272&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy2S9QBS_nxMXh6H_hJkwKp5_3GDdj1QdqIZMuQvEaYr-ZqjmQF3XUd-VrgCFfda7xiz01YK5xCBQTYSlIZbMU8b2wtcTPp8r0jhi8TGHGo_tBDjQfZfY7NmypG5B9tzIs3gGqr7rtOhQ/s1600/addReference.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;270&quot; j8=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy2S9QBS_nxMXh6H_hJkwKp5_3GDdj1QdqIZMuQvEaYr-ZqjmQF3XUd-VrgCFfda7xiz01YK5xCBQTYSlIZbMU8b2wtcTPp8r0jhi8TGHGo_tBDjQfZfY7NmypG5B9tzIs3gGqr7rtOhQ/s320/addReference.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7)&amp;nbsp;Create a&amp;nbsp;480x79 png file called sampleAd.png in the project content folder and&amp;nbsp;add sampleAd.png into the project&#39;s Content area inside the Solution Explorer.&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;separator&quot; style=&quot;margin: 0in 0in 0pt; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjISdsAuYIICSU-h07VgWA0__mm9176qlP-xAaSCsyjICWhXXSSdzNuBP8jNxmrGotxN5jsfRPkt3_QqeqQCX5YpcMCaBv5N8MlyXnYrrrHQvDDaJls8zNG548-F74flcTz1UrGwBkA0ms/s1600/sampleAd.jpg&quot;&gt;&lt;span style=&quot;mso-no-proof: yes; text-decoration: none; text-underline: none;&quot;&gt;&lt;shape alt=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjISdsAuYIICSU-h07VgWA0__mm9176qlP-xAaSCsyjICWhXXSSdzNuBP8jNxmrGotxN5jsfRPkt3_QqeqQCX5YpcMCaBv5N8MlyXnYrrrHQvDDaJls8zNG548-F74flcTz1UrGwBkA0ms/s320/sampleAd.jpg&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjISdsAuYIICSU-h07VgWA0__mm9176qlP-xAaSCsyjICWhXXSSdzNuBP8jNxmrGotxN5jsfRPkt3_QqeqQCX5YpcMCaBv5N8MlyXnYrrrHQvDDaJls8zNG548-F74flcTz1UrGwBkA0ms/s1600/sampleAd.jpg&quot; id=&quot;Picture_x0020_7&quot; o:button=&quot;t&quot; o:spid=&quot;_x0000_i1027&quot; style=&quot;height: 106.5pt; mso-wrap-style: square; visibility: visible; width: 240pt;&quot; type=&quot;#_x0000_t75&quot;&gt;&lt;fill o:detectmouseclick=&quot;t&quot;&gt;&lt;/fill&gt;&lt;imagedata o:title=&quot;sampleAd&quot; src=&quot;file:///C:\Users\pahope\AppData\Local\Temp\msohtmlclip1\01\clip_image006.jpg&quot;&gt;&lt;/imagedata&gt;&lt;/shape&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgasWZdjadhDtIfOdqZMCAH28F_dAGWuaXR90CtYPyi8r4ICoJLQjBqJskfD1vVVLjZj-xgc5E19Zzy5kFn6qPTXvOnYT8XPtgf97J55Or8YsKKlH3oFX-KX5IW_fTpeD5zZcn1fF5A8yE/s1600/sampleAd.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;142&quot; j8=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgasWZdjadhDtIfOdqZMCAH28F_dAGWuaXR90CtYPyi8r4ICoJLQjBqJskfD1vVVLjZj-xgc5E19Zzy5kFn6qPTXvOnYT8XPtgf97J55Or8YsKKlH3oFX-KX5IW_fTpeD5zZcn1fF5A8yE/s320/sampleAd.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;separator&quot; style=&quot;margin: 0in 0in 0pt; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
8) In your project.cs file place the following line of code at the top your file&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; Microsoft.Phone.Tasks;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; System.IO.IsolatedStorage;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; SOMAWP7;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
9) In your project class that inherits the XNA framework place the following code&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10pt;&quot;&gt;namespace &lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 10pt;&quot;&gt;Project&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 10pt;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;Project1&lt;/span&gt; : Microsoft.Xna.Framework.&lt;span style=&quot;color: #2b91af;&quot;&gt;Game&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: 10pt;&quot;&gt;SomaAd&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt; somaAd;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Texture2D&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt; textureSomaAd;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #2b91af; font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SpriteBatch&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt; spriteBatch;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
10) Initialize SOMA SDK using the AdSpaceID and PublisherID&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHlFXWB12G0Lq6HQpagENzZIPMt9i0K8RdH0fcabbpkY-WYg2DEDW_C5-CZi_qTV3wluSevPNGK67PfCqONi0buhoBzlr8I1U-ctN48vJ4WWO6oYfEYZpD4EJ7iIJD_Bb73yPENQqihcE/s1600/appAndPublisherID.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;64&quot; j8=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHlFXWB12G0Lq6HQpagENzZIPMt9i0K8RdH0fcabbpkY-WYg2DEDW_C5-CZi_qTV3wluSevPNGK67PfCqONi0buhoBzlr8I1U-ctN48vJ4WWO6oYfEYZpD4EJ7iIJD_Bb73yPENQqihcE/s320/appAndPublisherID.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10pt;&quot;&gt;protected override&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10pt;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 10pt;&quot;&gt; Initialize()&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Consolas; font-size: 10pt;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;//Set up SomaAd to get ads&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp; somaAd =&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;SomaAd&lt;/span&gt;();&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp; somaAd.Adspace =&amp;nbsp;12345678;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp; somaAd.Pub = 12345678;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;//gets user location from device&lt;/span&gt;&lt;br /&gt;&amp;nbsp; somaAd.LocationUseOK = &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; //information about the app running&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; somaAd.Kws = &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: x-small;&quot;&gt;&quot;games, windows phone, entertainment&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; //search string for ads to show&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;somaAd.Qs =&amp;nbsp;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;games, windows phone, entertainment, fun, exciting&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: green;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;&amp;nbsp; //Ask the user this informaton about them&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; //somaAd.Age = 30;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; //somaAd.Gender = &quot;m&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; //By default, the SDK sets&amp;nbsp;this to the current location&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; //somaAd.City = &quot;Fremont&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; //somaAd.State = &quot;Ca&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; //somaAd.Zip = &quot;94539&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; //somaAd.Country = &quot;United States&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; //somaAd.Countrycode = &quot;us&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp; //By default, adInterval will&amp;nbsp;deliver ads after 60 seconds.&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp; //somaAd.adInterval = 60000;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp; somaAd.GetAd();&lt;br /&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; base&lt;/span&gt;.Initialize();&lt;br /&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;separator&quot; style=&quot;margin: 0in 0in 0pt; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
11) Load content into app for SOMA&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; LoadContent()&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;// Create a new SpriteBatch, which can be used to draw textures.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;spriteBatch = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;SpriteBatch&lt;/span&gt;(GraphicsDevice);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;textureSomaAd = &lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;// setup touch&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;TouchPanel&lt;/span&gt;.EnabledGestures = &lt;span style=&quot;color: #2b91af;&quot;&gt;GestureType&lt;/span&gt;.Tap;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, &amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;12) Make sure to Dispose SOMA with the UnloadContent&amp;nbsp;function&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt; &lt;br /&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; UnloadContent()&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;somaAd.Dispose();&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, &amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;13)&amp;nbsp;Check for&amp;nbsp;screen touch &lt;/span&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, &amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;the SOMA image. Get the &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, &amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;file name &lt;/span&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;of the SOMA image &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, &amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;and load up browser with link if touch detected.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt; &lt;br /&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt; currentAdImageFileName = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;&quot;&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Update(&lt;span style=&quot;color: #2b91af;&quot;&gt;GameTime&lt;/span&gt; gameTime)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;// if the back button is pressed then go back to the main menu&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #2b91af;&quot;&gt;GamePad&lt;/span&gt;.GetState(&lt;span style=&quot;color: #2b91af;&quot;&gt;PlayerIndex&lt;/span&gt;.One).Buttons.Back == &lt;span style=&quot;color: #2b91af;&quot;&gt;ButtonState&lt;/span&gt;.Pressed)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Exit();&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;}&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;Vector2&lt;/span&gt; somaAdPosition = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;Vector2&lt;/span&gt;(0, GraphicsDevice.PresentationParameters.BackBufferHeight - 80);&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;Vector2&lt;/span&gt; somaAdSize = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;Vector2&lt;/span&gt;(GraphicsDevice.PresentationParameters.BackBufferWidth, 80);&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;while&lt;/span&gt; (&lt;span style=&quot;color: #2b91af;&quot;&gt;TouchPanel&lt;/span&gt;.IsGestureAvailable)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;GestureSample&lt;/span&gt; gestureSample = &lt;span style=&quot;color: #2b91af;&quot;&gt;TouchPanel&lt;/span&gt;.ReadGesture();&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt; (gestureSample.GestureType == &lt;span style=&quot;color: #2b91af;&quot;&gt;GestureType&lt;/span&gt;.Tap &amp;amp;&amp;amp; somaAd.Uri != &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;&quot;&lt;/span&gt; &amp;amp;&amp;amp; textureSomaAd != &lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;Vector2&lt;/span&gt; touchPosition = gestureSample.Position;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (touchPosition.X &amp;gt;= 0 &amp;amp;&amp;amp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;touchPosition.X &amp;lt; somaAdSize.X &amp;amp;&amp;amp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;touchPosition.Y &amp;gt;= somaAdPosition.Y &amp;amp;&amp;amp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;touchPosition.Y &amp;lt; (somaAdPosition.Y + somaAdSize.Y))&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;WebBrowserTask&lt;/span&gt; webBrowserTask = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;WebBrowserTask&lt;/span&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;webBrowserTask.URL = somaAd.Uri;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;webBrowserTask.Show();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;// if there is a new ad, get it from Isolated Storage and&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;show it&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (somaAd.Status == &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;success&quot;&lt;/span&gt; &amp;amp;&amp;amp; somaAd.AdImageFileName != &lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt; &amp;amp;&amp;amp; somaAd.ImageOK)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;try&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (currentAdImageFileName != somaAd.AdImageFileName)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;currentAdImageFileName = somaAd.AdImageFileName;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;IsolatedStorageFile&lt;/span&gt; myIsoStore = &lt;span style=&quot;color: #2b91af;&quot;&gt;IsolatedStorageFile&lt;/span&gt;.GetUserStoreForApplication();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;IsolatedStorageFileStream&lt;/span&gt; myAd = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;IsolatedStorageFileStream&lt;/span&gt;(somaAd.AdImageFileName, &lt;span style=&quot;color: #2b91af;&quot;&gt;FileMode&lt;/span&gt;.Open, myIsoStore);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;textureSomaAd = &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.Content.Load&amp;lt;&lt;span style=&quot;color: #2b91af;&quot;&gt;Texture2D&lt;/span&gt;&amp;gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;sampleAd&quot;&lt;/span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;textureSomaAd = &lt;span style=&quot;color: #2b91af;&quot;&gt;Texture2D&lt;/span&gt;.FromStream(&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.GraphicsDevice, myAd);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;myAd.Close();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;myAd.Dispose();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;myIsoStore.Dispose();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #2b91af;&quot;&gt;IsolatedStorageException&lt;/span&gt; ise)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; message = ise.Message;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;base&lt;/span&gt;.Update(gameTime);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, &amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;14)&amp;nbsp;Draw&amp;nbsp;the texture of the SOMA image&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Draw(&lt;span style=&quot;color: #2b91af;&quot;&gt;GameTime&lt;/span&gt; gameTime)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;// draw ad&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;//cubeToDraw.RenderToDevice(GraphicsDevice);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (textureSomaAd != &lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.spriteBatch.Begin();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.spriteBatch.Draw(textureSomaAd, &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;Rectangle&lt;/span&gt;(0, GraphicsDevice.PresentationParameters.BackBufferHeight - 80, GraphicsDevice.PresentationParameters.BackBufferWidth, 80), &lt;span style=&quot;color: #2b91af;&quot;&gt;Color&lt;/span&gt;.White);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.spriteBatch.End();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;base&lt;/span&gt;.Draw(gameTime);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; mso-fareast-language: EN-US;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
15)&amp;nbsp;Create your app on Microsoft App Hub and submit it.&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
16) Go&amp;nbsp;to &lt;a href=&quot;http://www.smaato.com/&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;, &amp;quot;sans-serif&amp;quot;; font-size: 11pt;&quot;&gt;http://www.smaato.com/&lt;/span&gt;&lt;/a&gt;&amp;nbsp;and click on Add New App. For the Download URL field copy and paste the Deep link example from your App Hub app information page.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHlFXWB12G0Lq6HQpagENzZIPMt9i0K8RdH0fcabbpkY-WYg2DEDW_C5-CZi_qTV3wluSevPNGK67PfCqONi0buhoBzlr8I1U-ctN48vJ4WWO6oYfEYZpD4EJ7iIJD_Bb73yPENQqihcE/s1600/appAndPublisherID.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;64&quot; j8=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHlFXWB12G0Lq6HQpagENzZIPMt9i0K8RdH0fcabbpkY-WYg2DEDW_C5-CZi_qTV3wluSevPNGK67PfCqONi0buhoBzlr8I1U-ctN48vJ4WWO6oYfEYZpD4EJ7iIJD_Bb73yPENQqihcE/s320/appAndPublisherID.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div align=&quot;center&quot; class=&quot;separator&quot; style=&quot;margin: 0in 0in 0pt; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhme2IzEzQOOsT7mYlyuKdwE20VnuhFE75UhD_LKasuDmorANeF5m0dX3T0tbndd1G-B8HXPD9h52lx9v5VJQr8G8LCv1uydT8NE7XHiIpTEnqM3z2jyuAybYZtGl5TEvEqPfv4F_yi_jk/s1600/appAndPublisherID.jpg&quot;&gt;&lt;span style=&quot;mso-no-proof: yes; text-decoration: none; text-underline: none;&quot;&gt;&lt;shape alt=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhme2IzEzQOOsT7mYlyuKdwE20VnuhFE75UhD_LKasuDmorANeF5m0dX3T0tbndd1G-B8HXPD9h52lx9v5VJQr8G8LCv1uydT8NE7XHiIpTEnqM3z2jyuAybYZtGl5TEvEqPfv4F_yi_jk/s320/appAndPublisherID.jpg&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhme2IzEzQOOsT7mYlyuKdwE20VnuhFE75UhD_LKasuDmorANeF5m0dX3T0tbndd1G-B8HXPD9h52lx9v5VJQr8G8LCv1uydT8NE7XHiIpTEnqM3z2jyuAybYZtGl5TEvEqPfv4F_yi_jk/s1600/appAndPublisherID.jpg&quot; id=&quot;Picture_x0020_8&quot; o:button=&quot;t&quot; o:spid=&quot;_x0000_i1026&quot; style=&quot;height: 48pt; mso-wrap-style: square; visibility: visible; width: 240pt;&quot; type=&quot;#_x0000_t75&quot;&gt;&lt;fill o:detectmouseclick=&quot;t&quot;&gt;&lt;/fill&gt;&lt;imagedata o:title=&quot;appAndPublisherID&quot; src=&quot;file:///C:\Users\pahope\AppData\Local\Temp\msohtmlclip1\01\clip_image001.jpg&quot;&gt;&lt;/imagedata&gt;&lt;/shape&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
17) Something to be aware of is that your phone must have 3G or a WIFI connection to the internet for your ads to show up.&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;Note&lt;/span&gt;: when you are debugging your app and the phone is connected to Visual Studio 2010 Express for Windows Phone the ads do not show up even with a working internet connection on the phone. You must disconnect the phone from the computer in order for the ads to appear.&lt;br /&gt;
&lt;br /&gt;
Written by: Paul&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;</description><link>https://crosslinkedcoder.blogspot.com/2011/04/setup-windows-phone-7-apps-with-smaato.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHlFXWB12G0Lq6HQpagENzZIPMt9i0K8RdH0fcabbpkY-WYg2DEDW_C5-CZi_qTV3wluSevPNGK67PfCqONi0buhoBzlr8I1U-ctN48vJ4WWO6oYfEYZpD4EJ7iIJD_Bb73yPENQqihcE/s72-c/appAndPublisherID.jpg" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1309467374034010002.post-6518235656122742511</guid><pubDate>Thu, 28 Apr 2011 03:24:00 +0000</pubDate><atom:updated>2011-05-05T16:47:47.818-07:00</atom:updated><title>How to compile STLport with Visual Studio 7 (.NET)</title><description>&lt;style type=&quot;text/css&quot;&gt;
.comment { color: #990099; font-style: italic; }
.pre { color: #000099; }
.string { color: #009900; }
.char { color: #009900; }
.float { color: #996600; }
.int { color: #999900; }
.bool { color: #000000; font-weight: bold; }
.type { color: #FF6633; }
.flow { color: #FF0000; }
.keyword { color: #990000; }
.operator { color: #663300; font-weight: bold; }
.operator { color: #663300; font-weight: bold; }
&lt;/style&gt;&lt;br /&gt;
&lt;br /&gt;
STLport is a fast, portable, free, multi-featured and opensource version of the standard library. In this tutorial I will demonstrate how to get it working under Visual Studio C++ 7 (.NET).&lt;br /&gt;
&lt;br /&gt;
1. Download the windows version of STLport from www.stlport.org.&lt;br /&gt;
&lt;br /&gt;
2. Unzip it into any directory go to the src directory and rename the file vc7.mak to makefile.&lt;br /&gt;
&lt;br /&gt;
3. Go to your command prompt and change directory to the Visual C++ bin directory like this&lt;span class=&quot;string&quot;&gt; &quot;cd Program Files\Microsoft Visual Studio .NET\Vc7\bin &quot;&lt;/span&gt; this is where you find the vcvars32.bat file. Now enter in vcvars32.bat. Then change to the directory where you unzipped STLport.&lt;br /&gt;
&lt;br /&gt;
4. Now enter&lt;span class=&quot;string&quot;&gt; &quot;nmake clean all&quot;&lt;/span&gt; and STLport will build itself as a release build. To get a debug build enter&lt;span class=&quot;string&quot;&gt; &quot;nmake debug_static&quot;&lt;/span&gt; and then&lt;span class=&quot;string&quot;&gt; &quot;nmake debug_dynamic&quot;&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
5. After building enter&lt;span class=&quot;string&quot;&gt; &quot;nmake install&quot;&lt;/span&gt; and it will install all necessary headers, libs and dlls into their appropriate directories.&lt;br /&gt;
&lt;br /&gt;
6. Now open Visual Studio. Then go to the&lt;span class=&quot;string&quot;&gt; &quot;Options&quot;&lt;/span&gt; menu and find the&lt;span class=&quot;string&quot;&gt; &quot;Projects&quot;&lt;/span&gt; heading, click on that and go to the&lt;span class=&quot;string&quot;&gt; &quot;VC++ directories&quot;&lt;/span&gt; heading. There you select&lt;span class=&quot;string&quot;&gt; &quot;Include Files&quot;&lt;/span&gt; and you add the STLport header directory which should be&lt;span class=&quot;string&quot;&gt; &quot;Program Files\Microsoft Visual Studio .NET\Vc7\include\stlport&quot;&lt;/span&gt;. Then click on the up arrow and make sure that the directory goes all the way to the top of the list.&lt;br /&gt;
&lt;br /&gt;
7. To get STLport to run in debug mode for debug builds write the following preprocessor code before including any stl headers. Also you have to get rid of windows.h macros max and min because they interfere with numeric limits max and min functions. Here is how you can setup your headers.
&lt;span class=&quot;pre&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#ifdef   NDEBUG&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;# undef   _STLP_DEBUG&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#else&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;# define   _STLP_DEBUG   1&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#endif&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#ifdef   WIN32&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;# undef   max&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;# undef   min&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#endif&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;comment&quot;&gt;//STL   includes&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#include   &amp;lt;limits&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#include   &amp;lt;vector&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#include   &amp;lt;map&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#include   &amp;lt;string&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#include   &amp;lt;set&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#include   &amp;lt;memory&amp;gt; 
&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;comment&quot;&gt;//Stream   includes 
&lt;/span&gt;&lt;span class=&quot;pre&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#include   &amp;lt;fstream&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#include   &amp;lt;iostream&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#include   &amp;lt;iomanip&amp;gt; 
&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;keyword&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;operator&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;operator&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;comment&quot;&gt;//C   Library   includes 
&lt;/span&gt;&lt;span class=&quot;pre&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#include   &amp;lt;stdio.h&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#include   &amp;lt;stdlib.h&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;
#include   &amp;lt;time.h&amp;gt; 
&lt;/span&gt;&lt;span class=&quot;operator&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;operator&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pre&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#include   &amp;lt;assert.h&amp;gt; 
&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;keyword&quot;&gt;using namespace&lt;/span&gt; _STL;&lt;br /&gt;
&lt;br /&gt;
8. If you want to use stream includes from STLport you have to get rid of Microsoft&#39;s std libs from the build. You do this by going to the property sheet for the project you are building and go to the headings &lt;span class=&quot;string&quot;&gt;&quot;Linker&quot;&lt;/span&gt; and then &lt;span class=&quot;string&quot;&gt;&quot;Input&quot;&lt;/span&gt; and use the ignore specific library feature and type &lt;span class=&quot;string&quot;&gt;&quot;libcmt.lib&quot;&lt;/span&gt; for Release builds and &lt;span class=&quot;string&quot;&gt;&quot;libcmtd.lib&quot;&lt;/span&gt; for Debug builds. 

Other useful self defining features of STLport are: 
&lt;span class=&quot;pre&quot;&gt;

&lt;span class=&quot;comment&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;&lt;span class=&quot;comment&quot;&gt;//changes its namespace _STL into std&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#define   _STLP_NO_OWN_NAMESPACE&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;&lt;span class=&quot;comment&quot;&gt;//with this define you don&#39;t need to rely on using namespace_STL;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#define   _STLP_NO_NAMESPACES&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#define   _STLP_USE_SYSTEM_ASSERT&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;&lt;span class=&quot;comment&quot;&gt;//define this with MFC and include &amp;lt;stl/_config.h&amp;gt; then include &amp;lt;afx.h&amp;gt; instead of &amp;lt;windows.h&amp;gt;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#define   _STLP_USE_MFC 
&lt;span class=&quot;comment&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;&lt;span class=&quot;comment&quot;&gt;//bounds checker needs this defined but makes your app run slower&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#define   _STLP_USE_MALLOC  
&lt;span class=&quot;comment&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;&lt;span class=&quot;comment&quot;&gt;//bounds checker needs this defined but makes your app run slower&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#define   _STLP_USE_NEWALLOC  
&lt;span class=&quot;comment&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;&lt;span class=&quot;comment&quot;&gt;//set this if you don&#39;t want multithreading&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#define   _STLP_NO_THREADS&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#define   _STLP_USE_STATIC_LIB&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#define   _STLP_USE_DYNAMIC_LIB 
&lt;span class=&quot;comment&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;&lt;span class=&quot;comment&quot;&gt;//debug for memory allocations&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#define   _STLP_DEBUG_ALLOC 
&lt;span class=&quot;comment&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;&lt;span class=&quot;comment&quot;&gt;//does not initialize allocated memory to zero like release builds&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#define   _STLP_DEBUG_UNINITIALIZED 
&lt;span class=&quot;comment&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;&lt;span class=&quot;comment&quot;&gt;//if you are having trouble building in debug mode try this&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;pre&quot;&gt;#define   _STLP_USE_ABBREVS 
&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Written by: Paul</description><link>https://crosslinkedcoder.blogspot.com/2011/04/how-to-compile-stlport-with-visual.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>0</thr:total></item></channel></rss>