<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sarah Saunders on Medium]]></title>
        <description><![CDATA[Stories by Sarah Saunders on Medium]]></description>
        <link>https://medium.com/@sasaunde?source=rss-122ed57385d5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*GIA0D6wujAgjq22Q.jpeg</url>
            <title>Stories by Sarah Saunders on Medium</title>
            <link>https://medium.com/@sasaunde?source=rss-122ed57385d5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 23:58:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sasaunde/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Connecting to Azure Data Lake and Azure SQL Server Database using Mulesoft]]></title>
            <link>https://medium.com/@sasaunde/connecting-to-azure-data-lake-and-azure-sql-server-database-using-mulesoft-6b11bdde46c8?source=rss-122ed57385d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b11bdde46c8</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[mulesoft]]></category>
            <category><![CDATA[microsoft-sql-server]]></category>
            <category><![CDATA[mac]]></category>
            <category><![CDATA[hadoop]]></category>
            <dc:creator><![CDATA[Sarah Saunders]]></dc:creator>
            <pubDate>Mon, 10 Jul 2017 10:08:49 GMT</pubDate>
            <atom:updated>2017-07-18T09:09:14.534Z</atom:updated>
            <content:encoded><![CDATA[<p>Microsoft host Apache Hadoop in the cloud, under the name “Azure Data Lake”. My challenge today is to connect to a Data Lake Store via its REST API, using Mulesoft, and stick in some data pulled from an Azure hosted SQL server database.</p><p>I have Anypoint Studio and the basic set of connectors, I haven’t found or attempted to use any other connector.</p><p>I found that when connecting to Azure REST APIs protected with OAuth2, I couldn’t use the HTTP Connector and configure Authentication to be OAuth2 — Client Credentials. A bit of sniffing with <a href="https://requestb.in/">https://requestb.in</a> showed me that what Mulesoft builds for this is a HTTP POST, with grant_type=client_credentials as a request parameter, and the client ID and client secret base-64 encoded in the basic auth header. Unfortunately, Microsoft’s OAuth token dispenser doesn’t recognise this — it expects the client ID and client secret as parameters in the HTTP post body request. So I had to manage the OAuth “Dance” myself with two calls.</p><p>Step 1 — get Microsoft Azure cloud account and set up a Data Lake Store and a SQL database.</p><p>Step 2 — create an Azure application account and make sure it has permissions to the data lake store and the database. You do this from the Azure Portal Active Directory page — select App Registrations. Set up a Key for your application user too, using the Keys sub menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*84mw5CWgwTKf71vpfypSBw.png" /></figure><p>For Data Lake, I used this tutorial <a href="https://docs.microsoft.com/en-us/azure/data-lake-store/data-lake-store-get-started-rest-api">https://docs.microsoft.com/en-us/azure/data-lake-store/data-lake-store-get-started-rest-api</a> to get set up. For SQL server I followed <a href="https://docs.microsoft.com/en-us/azure/sql-database/sql-database-get-started-portal">https://docs.microsoft.com/en-us/azure/sql-database/sql-database-get-started-portal</a> and</p><p>For both apps, use the Access Control (IAM) to make sure that the application user ID is present as a Contributor for the resource.</p><p>Step 3 — create a Mulesoft flow, add connectors. Let’s talk about Azure data lake first. It is secured with OAuth, and you will need service-to-service authentication, so you need to first call to get a token.</p><p><a href="https://docs.microsoft.com/en-us/azure/data-lake-store/data-lake-store-authenticate-using-active-directory">Service-to-service authentication: Data Lake Store with Azure Active Directory</a></p><p>The token call is a HTTP POST call, with the four parameters embedded in the POST body. So you need to add a Set Properties component to your flow, and configure it to set the body params</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cc6Awil07_cmWJZImEiPjA.png" /></figure><p>Your client ID is your Azure Data Lake Application ID, and the client secret is your Azure Key — created via Azure Active Directory on the Azure portal as above. I found that the tutorial I followed was incorrect regarding the Resource, and I had to set it to <a href="https://management.core.windows.net/">https://management.core.windows.net/</a> — when I set it to the value specified by the tutorial (which was the App ID URI from the application user properties page) I got an error telling me to change the resource to the above.</p><p>I discovered how to use parameters so that I didn’t have to write the client credentials into my flow here: <a href="https://docs.mulesoft.com/mule-user-guide/v/3.5/using-parameters-in-your-configuration-files">https://docs.mulesoft.com/mule-user-guide/v/3.5/using-parameters-in-your-configuration-files</a></p><p>Pass the output from Set Properties into a HTTP request to get the token. The HTTP connection settings are as follows:</p><p>Protocol: HTTPS</p><p>Host: login.microsoftonline.com</p><p>Port: 443</p><p>The URL is /&lt;your-tenant-id&gt;/oauth2/token — you can get the tenant ID from the Azure Active Directory Manage -&gt; Properties page on the Azure portal, it’s called the Directory ID there.</p><p>This should succeed and you should get a response in this format:</p><p>{“token_type”:”Bearer”,”expires_in”:”3600&quot;,”ext_expires_in”:”0&quot;,”expires_on”:”1499176066&quot;,”not_before”:”1499172166&quot;,”resource”:”https://&lt;your Azure portal&gt;.com/&lt;your tenant ID&gt;&quot;,&quot;access_token&quot;:&quot;&lt;very long token string here&quot;}</p><p>All you need to extract is the token — store it as a flow variable, perhaps. You should probably implement some kind of try-catch block which refreshes the token when it expires, but I haven’t done that yet — I’m creating a new token for each flow and assuming it’ll live longer than the flow.</p><p>Now to try and use the Data Lake REST API. To start with, maybe try something like read the directories.</p><p>Create a new HTTP connector with a new HTTP Request Configuration. Your Azure URL will be something like mylake.azuredatalakestore.net — you can get this from the data lake page of the portal. The protocol is HTTPS and the port is 443.</p><p>The URL for getting directories is a HTTP GET call to /webhdfs/v1/ and then you need to add the parameters:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lNIaR-QTfQ0O3MZmBRBluQ.png" /></figure><p>The Authorization header contains your token. The op query parameter must be set to LISTSTATUS to list the data lake folders. Not sure if Content-Type is actually needed. If you do not set the Host header yourself, it will be set to include the port, and Azure data lake will throw an error like:</p><p>{“RemoteException”:{“exception”:”IllegalArgumentException”,”message”:”LISTSTATUS failed with error 0x83090a1a (Bad request. The operation is not supported on the provided URL type.). [48147b66-f3d6–4fec-80c2–3dc1dc9708e3][2017–07–10T02:57:40.2568465–07:00]”,”javaClassName”:”java.lang.IllegalArgumentException”}}</p><p>Pretty tricky to figure that one out I can tell you! So, set the Host to the correct value (ie yourlake.azuredatalake.com) but without the port appended, and all should be fine.</p><p>Now to connect to Azure SQL server. This is quite straightforward using JDBC, following the tutorial here <a href="https://blogs.mulesoft.com/dev/anypoint-platform-dev/building-apis-around-microsoft-azure-sql-databases/">https://blogs.mulesoft.com/dev/anypoint-platform-dev/building-apis-around-microsoft-azure-sql-databases/</a>, except that you have to make sure that your computer’s IP is whitelisted in the firewall — to set the firewall values, use the Azure portal and go to SQL databases, there’s a tab for firewall settings: “Set server firewall”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lOV2bgnA1We63KY09h-y_Q.png" /></figure><p>If you don’t know your computer’s IP, you can go to <a href="https://httpbin.org/ip">https://httpbin.org/ip</a> and it will show it to you.</p><p>One final gotcha that didn’t hit me on day one but appeared later, when using MacOS you need to ensure that the HostName property is set. Otherwise, when connecting to Azure SQL database, you get the error:</p><p>the connection has been closed ClientConnectionId</p><p>To check if HostName is set, from a terminal run scutil --get HostName.</p><p>If you get the reply: HostName: not set, then that is the issue. Run</p><p>sudo scutil --set HostName “somehostname”</p><p>Then you’lll find the Azure JDBC connection works just fine.</p><h3>REST access to SQL Server</h3><p>What if my project isn’t going to allow JDBC access to the SQL server? Can I create a REST API for it? There’s a nice query editor in Azure Cloud, but I couldn’t figure out how to generate the necessary auth token to access it programatically (I got close). So I think I may have to use an API App hosted in Azure to access the database. This is fairly straightforward and you can use <a href="https://docs.microsoft.com/en-us/azure/app-service-web/app-service-web-get-started-java">this tutorial</a> to get you started on creating the API app, and <a href="https://docs.microsoft.com/en-us/azure/sql-database/sql-database-connect-query-java">this tutorial</a> to get you started on connecting to an Azure SQL Server database.</p><p>Basically you use Swagger to define your API, then you can use something like jax-rs to turn your Swagger API into a Java service, then wade in and add database connection logic to your service implementation and pull/push data to the Azure database from your service implementation code. Interestingly I have no idea whether the JDBC connection loops out to the internet in order to connect to the Azure database, but I didn’t have to add any firewall rules to my Azure database to allow access which suggests that the Azure cloud is well-configured enough to route internal connections internally.</p><p>When you create an Azure API app, you can configure it to host Java applications on Tomcat. Then to push to Tomcat you can use Git, which is pretty cool — just tell the API app that you want to use a local Git repository and it’ll set one up for you and give you the remote URL. Everything you push to this repository goes into the Tomcat root directory, so you need to push webapps/&lt;your-war&gt;.war to get Tomcat to pick up and expand the webapp. If you call your webapp ROOT, you don’t then have an app context path in your URL.</p><p>The only difficulty I found was with the JDBC driver. I’d included the driver JAR file in my WAR, but Tomcat couldn’t find it. Experimenting with a local Tomcat showed that even if I put the driver JAR in the catalina lib/ folder, Tomcat couldn’t find it. I had to add the line:</p><p>DriverManager.registerDriver(new com.microsoft.sqlserver.jdbc.SQLServerDriver());</p><p>into my service implementation constructor and then Tomcat could find it and the application worked just fine.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b11bdde46c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Survive the Revolution]]></title>
            <link>https://medium.com/@sasaunde/how-to-survive-the-revolution-25e5151aeb66?source=rss-122ed57385d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/25e5151aeb66</guid>
            <category><![CDATA[food]]></category>
            <category><![CDATA[foraging]]></category>
            <dc:creator><![CDATA[Sarah Saunders]]></dc:creator>
            <pubDate>Mon, 03 Oct 2016 21:42:25 GMT</pubDate>
            <atom:updated>2016-10-03T21:42:25.551Z</atom:updated>
            <content:encoded><![CDATA[<p>I went on a fantastic foraging trip yesterday, with James Wood, wild food expert extraordinaire. Who knew you could eat hawthorn berries? (But.. wait! Not the pips!) And who knew how tasty a lamb’s sorrel salad could be — as long as you don’t mistake it for the similar leaf shape of the Deadly Nightshade (“Tastes like eating broken glass”, I’m reliably informed).</p><p>Best tip of all was how to tap silver birch trees. You can only tap a tree with a diameter of 20cm or more, and you should only do it once every three years or the tree might die, but apparently you’ll get about 5l of sap in a night which will boil down to 1/2 a litre of the sweetest syrup you ever did taste.</p><p>The distinctive rowan berry taste is still on my tongue. Yes, they are poisonous raw, but only in quantity so we were allowed a nibble. Makes a delicious jelly, apparently, which goes well with game. I can believe it.</p><p>The might oak is even mightier than I suspected. Oak wine can be made simply by bunging a bunch of young oak leaves in a bottle with some sugar! Bonus! It’s the high quantity of tannin, apparently, which also accounts for the inedibility of acorns. You need to “wash” them thoroughly by holding them in flowing water for hours. In the old days people would have stuck them in a bag in the river, now you can simply put them in your toilet cistern!</p><p>James had some fine tales of derring-do in the first world war involving using oak galls. The galls have a particularly high concentration of tannin, and can be used to make a black ink, but only when combined with iron. So messages could be written across the chest of a man, who could walk across enemy lines, and only when he was coated with iron filings would the message become visible!</p><p>Lots of exclamation marks in this post, but it was a very fun and enjoyable day out.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=25e5151aeb66" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Who was the first Prime Minister?]]></title>
            <link>https://medium.com/@sasaunde/who-was-the-first-prime-minister-2862542733a0?source=rss-122ed57385d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/2862542733a0</guid>
            <category><![CDATA[islam]]></category>
            <category><![CDATA[brexit]]></category>
            <category><![CDATA[revolution]]></category>
            <category><![CDATA[christianity]]></category>
            <category><![CDATA[roman]]></category>
            <dc:creator><![CDATA[Sarah Saunders]]></dc:creator>
            <pubDate>Mon, 03 Oct 2016 21:28:56 GMT</pubDate>
            <atom:updated>2016-10-03T21:28:56.365Z</atom:updated>
            <content:encoded><![CDATA[<p>Common quiz question, we’ve all seen it, the answer is rather debatable but the one I’d go for is: Margaret Thatcher. She was the first one who, instead of acting as figurehead for her cabinet, used the role to carry out her own personal goals.</p><p>Roll on to 2016, and it’s one of those cases where the latest Prime Minister is so mad/bad/incompetent that you look back at the previous Prime Minister, who at the time you despised, and reflect that perhaps they were the “good old days”…. At least Cameron, for all his general ineptitude, or in fact because of it, was forced to delegate to his various ministers, and because of this some good things crept through (I’m thinking of kicking off devolution, for example, and tentative investment in infrastructure).</p><p>Blair falls into this category too. It’s widely known that he really wanted to be a rock star, and that “Politician” was his second choice, and so he was happy searching for adulation of the masses and sipping beer with the Gallaghers, again leaving the decisions to the cabinet. I don’t think Theresa May will be like this, complete control freak and micro manager that she is.</p><p>Thinking about Prime Ministers of course leads me to the topic of revolution. We’ve never had a socio-political revolution in the UK, ever, in our known history. The civil war was as close as we got and that didn’t last very long at all before we slipped back into the norm of serfdom. Post industrial revolution the middle class appeared, and post second world war the socialist class had a quick look-in, but both these mini-revolutions are being swiftly beaten back by <a href="https://www.theguardian.com/commentisfree/2014/dec/03/landowners-scotland-britain-feudal-highland-spring">Those Who Own The Land</a>. Why is it that we don’t overthrow our insect overlords? Is it because our country is corruption-free and a fair place to live? No it bloody isn’t! Being crushed is just part of our nature. It is absolutely incredible what the average Brit will bear without revolt. I honestly believe that if presented with the kind of inbalance we see between, say, London and the rest of the country (for example, in <a href="https://www.theguardian.com/news/datablog/2014/aug/07/london-gets-24-times-as-much-infrastructure-north-east-england">2014</a> each Londoner received <strong>£5,203 </strong>more per head on capital investment than people in the North-East) any African nation would instantly rise up in protest (and, sadly, probably be horribly slaughtered, but they’d DO it.) We don’t. We bear more and more and more, and then something like the Brexit vote happens and people use that as the closest thing to revolt, the closest thing to being able to be heard, that they can. Brexit was nothing but a protest vote, and I can’t say I’m sorry to see such a huge spanner thrown in the works of the happy politicians — even though it was a stupid vote and a stupid outcome. Is this a good thing that Brits are so stoic? It’s been the case for thousands and thousands of years, has it done us some good?</p><p>Fairly recently, the Chinese government conducted a <a href="https://frbkirk.wordpress.com/2015/05/22/chinese-academy-of-social-sciences-study-of-west-concludes-that-christianity-is-responsible-for-its-global-success/">survey</a> into what made Britain great. Their conclusion? Christianity. They deduced that the morals and attitudes ingrained in us by Christianity were the underlying reason for the success of Victorian Britain and the global British empire of the last century. This is pretty interesting — I’m an atheist, but I “believe” in Jesus the philosopher, I try to bring my kids up with Christian morals and to follow the teachings of Jesus myself. I like to imagine the utter amazement of the Jews back in the day, when they were expecting a knight in shining armour and instead get a man in a toga on a donkey. Now that’s revolutionary! It’s pleasing to think that Christianity is a factor in the success of Great Britain, but I don’t think it’s really the whole story. It’s a happy coincidence of the intersection of many factors — genetic and social and cultural. Now it’s hard to pin genes on Britain, what with us being a fairly small island and hence being awash with incoming genes from all directions since time began. But I feel that Christian morality is in my genes. When someone wrongs me, or when I wrong someone, I physically feel it. I feel hollow; sick. Yes a lot of this is due to my upbringing, my parents instilling moral values in me, but it feels so physical I can’t help but think that morality has a genetic aspect. Not specific to one particular genetic set, but to humans as a whole, okay possibly EXCEPT psychopaths. The sad part about capitalism in the UK today is that the psychopaths, the ones who can ignore their moral compass, are the ones most likely to rise to the top. It’s not just the cream, as Terry Pratchett would <a href="https://books.google.co.uk/books?id=0gUgmOyu0JEC&amp;pg=PA45&amp;lpg=PA45&amp;dq=terry+pratchett+not+just+the+cream+rises+to+the+top&amp;source=bl&amp;ots=gnyu3f4jGU&amp;sig=0vQB5xvMPUTLui0D05kz492XcTA&amp;hl=en&amp;sa=X&amp;ved=0ahUKEwjv2vb9vL_PAhXKtxQKHRlaAZgQ6AEIKjAC#v=onepage&amp;q=terry%20pratchett%20not%20just%20the%20cream%20rises%20to%20the%20top&amp;f=false">say</a>….</p><p>But, rambling onwards, I think the Romans have a lot to answer for. I believe we are still all Romans today, we still have armies designed to fight on flat plains and we still focus on fantastic transport infrastructure and a democratic government (convinced yet??). And nowhere is more Roman than the United States of America and France. Two countries that put state before religion. Here’s where I think the Chinese were wrong about Christianity — a successful Roman empire (as GB was) must put its own identity before its religious identity. And what I’m wondering about one of the latest bunches of immigrants into the UK, Muslims from North Africa and the middle/far east, is that they are not being encouraged to pick up another identity but to focus on being a Muslim first. I was pretty disappointed with the phrase “British Muslims”. When people are encouraged to out-group like that, rather than integrate, it will lead by definition to confrontation with other groups. I read a fascinating Facebook status by a California resident recently, she was bemoaning — hang on, let me get the actual text.</p><p><em>“So….. where can I move to so I can get away from alllll this???? Tahiti? Costa Rica? Papua New Guinea? Where? (and it can’t be cold.)</em></p><p><em>Sick to death of Hilary, Trump, taxes, war, ISIS, terrorism, money, greed, self righteousness, pollution, torture of animals and humans, killing the unborn infant, evil, smug people, ignorance, racism, brutality, destruction, dogma, lies, control, bribery…. </em><a href="https://www.facebook.com/hashtag/takemetoanewplace?source=feed_text&amp;story_id=10154472629200097"><em>#takemetoanewplace</em></a><em> </em><a href="https://www.facebook.com/hashtag/getmeouttahere?source=feed_text&amp;story_id=10154472629200097"><em>#getmeouttahere</em></a><em>”</em></p><p>Someone suggested Spain to her. Her response:</p><p>“<em>Too near the Middle East… There will be ever increasing terrorism there and all over Europe as they convert the continent to Islam. So unfortunately no.”</em></p><p>Ha, brilliant! Now she’s wrong about conversion, (And of course wrong about terrorism — there’s no more than there has always been and at least terrorism doesn’t discriminate towards any one religion — it’s more about “Defeating the Romans by not fighting on the open plains”, Caracatus and Boadicea could have a few things to say about that for example) but on population balance she’s actually right. Muslims are having more kids than Christians on average, ergo soon there will be more Muslims than Christians. Is this a bad thing? I don’t know. I’m kinda attached to my British Christian culture (Shhh don’t tell them I’m an atheist, they’ll never guess) but what does it matter to me? I’m a little stoic about this to be honest. What will be, will be. But am I right to be like that? Should I not stand up for my culture? Or should I rely on our temperate island to adapt its future occupants towards beer, tolerance, mediocrity and altruism? I don’t know much about Islam, although novels such as <a href="https://www.amazon.com/Finding-Nouf-Zo%C3%AB-Ferraris/dp/0547237782/ref=pd_sbs_14_t_0/164-3738885-7679500?ie=UTF8&amp;psc=1&amp;refRID=JVHE46XRRBZXZX7RK1PR">this one</a> by Zoe Ferraris are really helping me understand how vast the cultural difference is, and how changing this in our country would be a Really Big Thing.</p><p>Okay well — there’s one thing we can do. Prevent ourselves from falling into a single category. I’m a Muslim, AND a Manchester United fan. I’m a woman, AND I’m a geek. Think of Colin Jackson, and what do you think? Olympian. Welsh. Gay. Black. Presenter. What religion is he? No bloody idea! Think Jasper Carrot. Comedian, Brummie, White, .. Bald? And Lenny Henry — Comedian, Brummie, Black, Dawn French’s ex — religion doesn’t come into it. I’ve met a new person, I can’t group myself with them along religious lines BUT I’m sure there are plenty of other ones, if only they were visible to me. The BBC needs to step up its act and not try and divide us down religious lines. For fuck’s sake!</p><p>Anyway. Just to discredit Ms California a little more, when asked why she didn’t go to New Zealand she replied, “They have a points system, you need a skill to get in there”. :D Over and out.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2862542733a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>