<?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[Technology and Digital Media - Medium]]></title>
        <description><![CDATA[Technology and the Digital media, Web/Mobile application development, SEO and Social media marketing - Medium]]></description>
        <link>https://medium.com/technology-and-digital-media?source=rss----de37c90f230d---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Technology and Digital Media - Medium</title>
            <link>https://medium.com/technology-and-digital-media?source=rss----de37c90f230d---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 25 Nov 2026 00:28:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/technology-and-digital-media" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Track click outside a component in react custom hook]]></title>
            <link>https://medium.com/technology-and-digital-media/track-click-outside-a-component-in-react-custom-hook-64a4e0b519a8?source=rss----de37c90f230d---4</link>
            <guid isPermaLink="false">https://medium.com/p/64a4e0b519a8</guid>
            <category><![CDATA[hooks]]></category>
            <category><![CDATA[react-hook]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[modal]]></category>
            <dc:creator><![CDATA[Sarath DR]]></dc:creator>
            <pubDate>Thu, 10 Oct 2019 17:29:05 GMT</pubDate>
            <atom:updated>2019-10-10T17:21:48.348Z</atom:updated>
            <content:encoded><![CDATA[<p>The below custom hook helps to track click events outside a component. It will be useful when you create atomic components like modals</p><h3>Hook to track outside click events</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/418b692ade7665570ad83514754b1df9/href">https://medium.com/media/418b692ade7665570ad83514754b1df9/href</a></iframe><p>How to use the above hook?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e2a04fd2876d08954bb0c5a6e534961/href">https://medium.com/media/3e2a04fd2876d08954bb0c5a6e534961/href</a></iframe><p>Sample code</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstackblitz.com%2Fedit%2Freact-5nuprb%3Fembed%3D1%26file%3DContainer.js&amp;url=https%3A%2F%2Fstackblitz.com%2Fedit%2Freact-5nuprb%3Fembed%3D1%26file%3DContainer.js&amp;image=https%3A%2F%2Fc.staticblitz.com%2Fassets%2Ficon-664493542621427cc8adae5e8f50d632f87aaa6ea1ce5b01e9a3d05b57940a9f.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=stackblitz" width="745" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/e8cb6bf428bc8882987ec06e48947ad7/href">https://medium.com/media/e8cb6bf428bc8882987ec06e48947ad7/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64a4e0b519a8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/technology-and-digital-media/track-click-outside-a-component-in-react-custom-hook-64a4e0b519a8">Track click outside a component in react custom hook</a> was originally published in <a href="https://medium.com/technology-and-digital-media">Technology and Digital Media</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android transtion examples]]></title>
            <link>https://medium.com/technology-and-digital-media/android-transtion-examples-f8c4fc645d27?source=rss----de37c90f230d---4</link>
            <guid isPermaLink="false">https://medium.com/p/f8c4fc645d27</guid>
            <category><![CDATA[android-application]]></category>
            <category><![CDATA[android-apps]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android-development]]></category>
            <dc:creator><![CDATA[Sarath DR]]></dc:creator>
            <pubDate>Thu, 14 Jan 2016 14:12:31 GMT</pubDate>
            <atom:updated>2018-09-19T15:54:07.908Z</atom:updated>
            <content:encoded><![CDATA[<h3>Android transition examples</h3><p>Android transition framework provides some cool animations that will enhance your app user experience and give an excellent visual appeal. You can define multiple scenes for the layout and load it dynamically. You can do this via code and also by specifying the transition set in XML file. With Android transition framework you can simply animate different view hierarchy changes. This transition framework contains some built-in animations also you can create your own by using the transition callbacks.</p><p>You can download the sample code from the below link</p><figure><img alt="Git Hub Sarath DR" src="https://cdn-images-1.medium.com/max/70/0*K_f69GqYc80XymkE.png" /></figure><p>Git Project Link <a href="https://github.com/sarathdr/android-transition-sample">Download</a> <br>Social share plugin for Android Added support to Cordova 2</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8c4fc645d27" width="1" height="1" alt=""><hr><p><a href="https://medium.com/technology-and-digital-media/android-transtion-examples-f8c4fc645d27">Android transtion examples</a> was originally published in <a href="https://medium.com/technology-and-digital-media">Technology and Digital Media</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrate native library to Android gradle project — Sample project]]></title>
            <link>https://medium.com/technology-and-digital-media/integrate-native-library-to-android-gradle-project-sample-project-267db66eb420?source=rss----de37c90f230d---4</link>
            <guid isPermaLink="false">https://medium.com/p/267db66eb420</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[featured]]></category>
            <category><![CDATA[android-application]]></category>
            <category><![CDATA[android-apps]]></category>
            <dc:creator><![CDATA[Sarath DR]]></dc:creator>
            <pubDate>Thu, 11 Jun 2015 18:07:58 GMT</pubDate>
            <atom:updated>2017-05-30T20:58:02.885Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently I have tried to integrate native libraries with some project. I could not find any good example or a better blog which explains it properly, especially when you integrate NDK with Gradle, the configuration is always a nightmare.</p><p>You can follow the below steps to add an native libraries to your android projects. Before you start make sure that you have downloaded android native development kit(NDK). Please find more details from the below link.</p><p><a href="https://developer.android.com/tools/sdk/ndk/index.html">Android NDK | Android Developers</a></p><p><strong>Step 1:</strong> Create a project with Android studio and add below line to <strong>local.properties</strong> file to include the NDK build system.</p><pre>ndk.dir=/usr/local/android-ndk</pre><p><strong>Step 2:</strong> Create a new JNI folder in the main and then create Android.mk file as specified below.</p><pre># You can find more detail about this make file from the below link<br># <a href="http://www.kandroid.org/ndk/docs/ANDROID-MK.html">http://www.kandroid.org/ndk/docs/ANDROID-MK.html</a><br># It basically describes the shared libraries to the NDK build system</pre><pre>LOCAL_PATH := $(call my-dir)<br>include $(CLEAR_VARS)</pre><pre># Specify the module name<br>LOCAL_MODULE    := MyJni<br>LOCAL_SRC_FILES := my-jni.c</pre><p><strong>Step 3:</strong> Create my-jni.c inside your JNI folder with a method that returns a static string.</p><pre>#include <br>#include</pre><pre>jstring<br>Java_com_sarathdr_tech_nativeandroidapptest_MainActivity_stringFromJNI(JNIEnv* env, jobject callingObject)<br>{<br>    return (*env)-&gt;NewStringUTF(env, &quot;Fine! JNI is working &quot;);<br>}</pre><p><strong>Step 4:</strong> Add the local module in build.gradle</p><pre>defaultConfig {<br>        applicationId &quot;com.sarathdr.tech.nativeandroidapptest&quot;<br>        minSdkVersion 21<br>        targetSdkVersion 22<br>        versionCode 1<br>        versionName &quot;1.0&quot;</pre><pre>ndk {<br>            moduleName &quot;MyJni&quot;<br>        }<br>    }</pre><p><strong>Step 5:</strong> For testing, load the static module in main activity</p><pre>public class MainActivity extends Activity {</pre><pre>// Load native module here<br>    static {<br>        System.loadLibrary(&quot;MyJni&quot;);<br>    }</pre><pre>// Add interface to the native method<br>    public native String stringFromJNI();</pre><pre>@Override<br>    protected void onCreate(Bundle savedInstanceState) {<br>        super.onCreate(savedInstanceState);<br>        setContentView(R.layout.activity_main);</pre><pre>String testString = stringFromJNI();</pre><pre>TextView mainText = (TextView) findViewById(R.id.main_text);<br>        mainText.setText(testString);<br>    }<br>}</pre><p><strong>Finally:</strong> To import native shared libraries, follow below format. The below line imports OpenSL , android, log libraries to your project.</p><pre>defaultConfig {<br>        applicationId &quot;com.example.nativeaudio&quot;<br>        minSdkVersion 14<br>        targetSdkVersion 14</pre><pre>ndk {<br>            moduleName &quot;MyJni&quot;<br>            ldLibs &quot;OpenSLES&quot;, &quot;android&quot;, &quot;log&quot;<br>        }<br>    }</pre><p>Add below line in the make file to load the shared libraries</p><pre>include $(BUILD_SHARED_LIBRARY)</pre><p>I have shared the sample project in GitHub, download it for more details. Google I/O 2015 announces that Android Studio 1.3 provides support for Native codes. So this will be much easier ;)</p><p>Git Project Link <a href="https://github.com/sarathdr/NDKAndroidApp">Download</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=267db66eb420" width="1" height="1" alt=""><hr><p><a href="https://medium.com/technology-and-digital-media/integrate-native-library-to-android-gradle-project-sample-project-267db66eb420">Integrate native library to Android gradle project — Sample project</a> was originally published in <a href="https://medium.com/technology-and-digital-media">Technology and Digital Media</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Download emails from Gmail as CSV file — PHP ]]></title>
            <link>https://medium.com/technology-and-digital-media/download-emails-from-gmail-as-csv-file-php-121fdf7eb048?source=rss----de37c90f230d---4</link>
            <guid isPermaLink="false">https://medium.com/p/121fdf7eb048</guid>
            <category><![CDATA[gmail]]></category>
            <category><![CDATA[email]]></category>
            <category><![CDATA[featured]]></category>
            <category><![CDATA[internet]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Sarath DR]]></dc:creator>
            <pubDate>Fri, 06 Feb 2015 14:51:03 GMT</pubDate>
            <atom:updated>2017-05-30T20:58:06.097Z</atom:updated>
            <content:encoded><![CDATA[<h3>Download emails from Gmail as CSV file — PHP</h3><p>This is a fun project that I did to test Google API. If you follow the simple steps you can simply download emails as CSV from your Google account.</p><p><strong>Step 1:</strong> Click the below url to open Google console.(sign up if you haven’t an account.) Create Google API authentication credential. Create a new project in the console and create Client ID for application type Web Application.</p><p><a href="https://console.developers.google.com/">Google Cloud Platform</a></p><p><strong>Step 2:</strong> Download the sample code from below link and add your client ID and secret key.</p><p><a href="https://code.google.com/p/google-mail-oauth2-tools/wiki/PhpSampleCode">google/gmail-oauth2-tools</a></p><p>I have also made some customisation in the above code to download it as CSV. You either download that code from the below link.</p><p><a href="https://github.com/sarathdr/gmailtocsv">sarathdr/gmailtocsv</a></p><p>The code comes with a Zend IMAP module to read the files. To read more click the below link.</p><p><a href="http://framework.zend.com/manual/1.12/en/zend.mail.read.html">Manual - Documentation - Zend Framework</a></p><p>From the below link you can test the functionality. It is just a proof of concept and it is not storing any private data locally. Please comment under the post if you have any questions.</p><p><a href="http://gmailtocsv.sarathdr.com/">http://gmailtocsv.sarathdr.com/</a></p><p>You have to specify the email again and folder name (label name eg: inbox ) to get the emails as CSV.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=121fdf7eb048" width="1" height="1" alt=""><hr><p><a href="https://medium.com/technology-and-digital-media/download-emails-from-gmail-as-csv-file-php-121fdf7eb048">Download emails from Gmail as CSV file — PHP </a> was originally published in <a href="https://medium.com/technology-and-digital-media">Technology and Digital Media</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generate Codova.jar file from Phonegap project using ant]]></title>
            <link>https://medium.com/technology-and-digital-media/generate-codova-jar-file-from-phonegap-project-using-ant-fb333ff86107?source=rss----de37c90f230d---4</link>
            <guid isPermaLink="false">https://medium.com/p/fb333ff86107</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-apps]]></category>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[cordova]]></category>
            <dc:creator><![CDATA[Sarath DR]]></dc:creator>
            <pubDate>Mon, 08 Dec 2014 18:11:14 GMT</pubDate>
            <atom:updated>2017-05-30T20:57:48.331Z</atom:updated>
            <content:encoded><![CDATA[<p>There might be a simple method already available for this, but I would like to write down this method somewhere. This will be useful when you do Phonegap development for Android in Android studio.</p><p>You can generate library file by following the below steps.</p><p><strong>Step 1:</strong> Make sure that you have installed apache cordova in your machine. You can follow the below link to install cordova using node.js.</p><p><a href="http://cordova.apache.org/docs/en/4.0.0//guide_cli_index.md.html#The%20Command-Line%20Interface">Creating your first Cordova app - Apache Cordova</a></p><p><strong>Step 2: </strong>Create a new project and add platform android platform files inside the project</p><pre>$ cordova create hello com.sarathdr.hello HelloWorld</pre><pre>$ cd hello</pre><pre>$ cordova platform add android</pre><p><strong>Step 3:</strong> Go to the CodovaLib folder and run the following command</p><pre>$ android update project</pre><p><strong>Step 4: </strong>If you check the folder, you can see that a <strong>build.xml</strong> file is auto generated and add the below lines into that file.</p><pre>basedir=&quot;bin/classes&quot;<br>		excludes=&quot;org/apache/cordova/R.class,org/apache/cordova/R$*.class&quot;<br>		jarfile=&quot;cordova.jar&quot; /&gt;</pre><p><strong>Step 5:</strong> Run the below command to generate the jar files.</p><pre>$ ant jar</pre><p>This will create a jar file inside your CordovaLib folder.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb333ff86107" width="1" height="1" alt=""><hr><p><a href="https://medium.com/technology-and-digital-media/generate-codova-jar-file-from-phonegap-project-using-ant-fb333ff86107">Generate Codova.jar file from Phonegap project using ant</a> was originally published in <a href="https://medium.com/technology-and-digital-media">Technology and Digital Media</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google map javascript client to find the geographic co-ordinates from Address or post code]]></title>
            <link>https://medium.com/technology-and-digital-media/google-map-javascript-client-to-find-the-geographic-co-ordinates-from-address-or-post-code-6b4bad231504?source=rss----de37c90f230d---4</link>
            <guid isPermaLink="false">https://medium.com/p/6b4bad231504</guid>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[google-maps]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[internet]]></category>
            <dc:creator><![CDATA[Sarath DR]]></dc:creator>
            <pubDate>Fri, 17 Oct 2014 15:30:51 GMT</pubDate>
            <atom:updated>2017-05-30T20:57:44.927Z</atom:updated>
            <content:encoded><![CDATA[<p>Its very simple with Google api to find geographic co-ordinates of a place. I just wrote a sample code, you can add/improve it if you want.</p><p>You have to create a new api project on Google apps. Click the below link and create a new project.</p><p><a href="https://console.developers.google.com/">Google Cloud Platform</a></p><p>Click on Apis and enable Geocode api service.</p><p>Click on Credentials to create the Api Key. (Server api Key)</p><p>Use the Api key in the below code to access the Google maps api. JQuery library is required to execute the code.</p><pre>function Geocoder(apiKey) {</pre><pre>this.apiKey = apiKey;<br>    this.url = &quot;https://maps.google.com/maps/api/geocode/json&quot;;<br>    this.address = &quot;&quot;;<br>    _sendData = function (urlMap, callBack) {</pre><pre>$.ajax({<br>            url: urlMap,<br>            type: &#39;GET&#39;,<br>            dataType: &#39;json&#39;,<br>            success: function (data) {                                          <br>              if(data.status == &quot;OK&quot;){                <br>                 callBack( data.results[0].geometry.location);  <br>                  <br>              }                             <br>            }<br>        });<br>    };<br>    <br>   <br>}</pre><pre>Geocoder.prototype.getLocation = function (postCode, country, callBack ) {</pre><pre>urlMap = this.url + &quot;?key=&quot; + this.apiKey + &quot;&amp;address=&quot; + postCode + &quot; &quot; + country;<br>    _sendData(urlMap, callBack);<br>}</pre><pre>var loc = new Geocoder(&quot;apikey&quot;);</pre><pre>loc.getLocation(&quot;your-postcode-or-address&quot;, &quot;united kingdom&quot;, function( geometry ){<br>    console.log(geometry);<br>    alert(geometry.lat);<br>});</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b4bad231504" width="1" height="1" alt=""><hr><p><a href="https://medium.com/technology-and-digital-media/google-map-javascript-client-to-find-the-geographic-co-ordinates-from-address-or-post-code-6b4bad231504">Google map javascript client to find the geographic co-ordinates from Address or post code</a> was originally published in <a href="https://medium.com/technology-and-digital-media">Technology and Digital Media</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learn Python — Quick notes]]></title>
            <link>https://medium.com/technology-and-digital-media/learn-python-quick-notes-37baa4cc24de?source=rss----de37c90f230d---4</link>
            <guid isPermaLink="false">https://medium.com/p/37baa4cc24de</guid>
            <category><![CDATA[internet]]></category>
            <category><![CDATA[learn-python]]></category>
            <category><![CDATA[featured]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Sarath DR]]></dc:creator>
            <pubDate>Wed, 17 Sep 2014 15:59:18 GMT</pubDate>
            <atom:updated>2017-05-30T20:57:42.184Z</atom:updated>
            <content:encoded><![CDATA[<p>The following article will be helpful for all beginners of python language. This also a quick reference note for all keywords, lists, data types and classes. Learn Python quickly ;)</p><h4><strong>1. Print something</strong></h4><pre><strong>print</strong> &quot;Hello World&quot;<br> <br>x = 7 <br><strong>print</strong> x <br> <br>str  = &quot;Technology World&quot;<br><strong>print</strong> str<br> <br><em># Print float value - adjust for 2 decimal places</em><br><strong>print</strong>(&quot;%.2f&quot; % sum )<br> <br>fruit = &quot;Apple&quot;<br><strong>print</strong> &quot;A for  %s.&quot; % (fruit)</pre><h4><strong>2. Console Input</strong></h4><pre>name = raw_input(&quot;What is your name?&quot;)<br><strong>print</strong> name</pre><h4><strong>3. Boolean variables</strong></h4><pre>x = True<br>y = False</pre><h4><strong>4. Comment Code</strong></h4><pre><em># Single line</em><br> <br>&quot;&quot;&quot; <br>Multiple lines <br>comments in Python.<br> <br>Use triple quotes<br> <br>&quot;&quot;&quot;</pre><h4><strong>5. Operands</strong></h4><pre><em># Add</em><br>c = a + b<br> <br><em># Subtract</em><br>c = a  - b<br> <br><em># Multiply</em><br>c = a * b<br> <br><em># Divide </em><br>c = a / b<br> <br><em># Mod </em><br>c = a % b <br> <br><em># Exponent - a to the power b</em><br>c  = a ** b</pre><h4><strong>6. Strings</strong></h4><pre><em># Prints 3rd letter of a string </em><br><strong>print</strong> &quot;TECH&quot;[2]<br> <br><em># Length of a string  - Prints 4</em><br><strong>print</strong> len(&quot;TECH&quot;)<br> <br><em>#  To Lower - Prints tech</em><br><strong>print</strong> &quot;TECH&quot;.lower()<br> <br><em>#  To Upper - Prints TECH</em><br><strong>print</strong> &quot;tech&quot;.upper()<br> <br><em># To get string value</em><br>val = 5.33 <br><em># prints &quot;5.33&quot;</em><br><strong>print</strong> str(val)<br> <br><em># Concatenate two strings </em><br><strong>print</strong> &quot;Technology &quot; + &quot;and&quot; + &quot; Digital media&quot;<br> <br><strong>print</strong> &quot;Total value = &quot; + str(33.33)<br> <br>temp_string = &quot;digital&quot;<br> <br><em># The first three characters of temp_string</em><br>temp_string[:3]</pre><h4><strong>7. Lists</strong></h4><pre><em># List of numbers </em><br>numbers = [11, 10, 1, 2, 3, 4 ]<br> <br><em># Printing second element </em><br><strong>print</strong> numbers[1]<br> <br><em># Sort list</em><br>numbers.sort()<br> <br><em># Sum of numbers </em><br><strong>print</strong> sum(numbers)<br> <br><em># List of strings </em><br>fruits = [&quot;orange&quot;, &quot;apple&quot;, &quot;mango&quot;, &quot;plum&quot;, &quot;peach&quot; ]<br> <br><em># To get the length of the list </em><br><strong>print</strong> len(fruits)<br> <br><em># Printing second element </em><br><strong>print</strong> fruits[1]<br> <br><em># Adding another element to the list </em><br>fruits.append(&quot;banana&quot;)<br> <br><em># Slice list </em><br><em># [start:end:stride]</em><br> <br><em># Prints [1, 3]</em><br><strong>print</strong> numbers[2:6:2]<br> <br><em># Reverse list </em><br><strong>print</strong> numbers[::-1]<br> <br><em># The first and second elements</em><br>fruits[0:2]  <br> <br><em># Third and fourth elements</em><br>fruits[2:4]              <br> <br><em># The last two items </em><br>fruits[4:6]              <br> <br><em># Get list index</em><br><strong>print</strong> fruits.index(&quot;mango&quot;)<br> <br><em># Replace an element in an index </em><br>fruits.insert(3, &quot;strawberry&quot; )<br> <br><em># Remove an item </em><br>fruits.remove(&#39;mango&#39;)<br> <br><em># Join two lists </em><br>list1 = [1,2,4,5]<br>list2 = [6,7,8,9]<br> <br>new_list = list1+list2<br> <br><em># join string array as string </em><br><strong>print</strong>  &quot; &quot; . join(fruits)<br> <br><em># Build list </em><br>even_numbers = [i <strong>for</strong> i <strong>in</strong> range(100) <strong>if</strong> i % 2 == 0]</pre><h4><strong>8. Dictionary</strong></h4><pre>fruits_count = {&#39;apple&#39;: 34, &#39;orange&#39;: 55, &#39;mango&#39;: 6}<br><strong>print</strong> fruits_count[&#39;apple&#39;]<br> <br>temp = { &quot;tech&quot;: &quot;Technology and Digital media&quot;}<br> <br><em># Dump dictionary </em><br>fruits_count.items()<br>fruits_count.keys()<br>fruits_count.values()</pre><h4><strong>9. Loops</strong></h4><pre><em># For loop </em><br><strong>for</strong> num <strong>in</strong> numbers:<br>    <strong>print</strong> num<br> <br><strong>for</strong> fruit <strong>in</strong> fruits:<br>    <strong>print</strong> fruit<br> <br><em># Looping through a string</em><br>sentence = &quot;I love technology and digital media&quot;<br> <br><em># Print the letter in a string if it is equal to &quot;t&quot;</em><br><strong>for</strong> l <strong>in</strong> sentence:<br>    <strong>if</strong> l == &quot;t&quot;:<br>        <strong>print</strong> l<br> <br><em># With dictionaries </em><br>fruits_count = {&#39;apple&#39;: 34, &#39;orange&#39;: 55, &#39;mango&#39;: 6}<br><strong>for</strong> key <strong>in</strong> fruits_count:<br>    <strong>print</strong> key + &quot; &quot; + fruits_count[key]<br> <br><em># For loop to iterate with index and element </em><br><strong>for</strong> index, element <strong>in</strong> enumerate(fruits_count):<br>    <strong>print</strong> index+1, element<br> <br><em># For loop for multiple arrays</em><br>list_x = [1,2,4,5,9]<br>list_y = [6,7,8,9]<br> <br><strong>for</strong> x, y <strong>in</strong> zip(list_x, list_y):<br>     <strong>if</strong>  x == y :<br>         <strong>print</strong> x<br>     <strong>else</strong>:<br>        <strong>print</strong> y<br><strong>else</strong>: <br>  <strong>print</strong> &quot;End of loop&quot;<br> <br><em># While loop</em><br>i = 0  <br><strong>while</strong> i &lt;= 9:<br>    <strong>print</strong> i<br>    i += 1<br><em># With break </em><br><strong>while</strong> i &lt;= 9:<br>    <strong>print</strong> i<br>    <strong>if</strong> i == 6 <br>       <strong>break</strong><br>    i += 1<br> <br><em># With else  </em><br><strong>while</strong> i &lt;= 9:<br>    <strong>print</strong> i<br>    <strong>if</strong> i == 6 <br>       <strong>break</strong><br>    i += 1<br><strong>else</strong>:<br>  <strong>print</strong> &quot;Exit loop&quot;</pre><h4><strong>10. Comparators</strong></h4><pre><em># Equal to (==)</em><br><strong>if</strong> a == b:<br>   <strong>print</strong> True<br> <br><em># Not equal to (!=)</em><br><strong>if</strong> a != b:<br>   <strong>print</strong> True<br> <br><em># Less than (&lt;)</em><br><strong>if</strong> a &lt; b:<br>   <strong>print</strong> True<br> <br><em># Less than or equal to (&lt;=)</em><br><strong>if</strong> a &lt;= b:<br>   <strong>print</strong> True<br> <br><em># Greater than (&gt;)</em><br><strong>if</strong> a &gt; b:<br>   <strong>print</strong> True<br> <br><em># Greater than or equal to (&gt;=)</em><br><strong>if</strong> a &gt;= b:<br>   <strong>print</strong> True</pre><h4><strong>11. Control flows</strong></h4><pre><em># if else syntax </em><br> <br><strong>if</strong> myVar == &quot;tech&quot; <strong>or</strong> myVar == &quot;techno&quot;:<br>   <strong>print</strong> &quot;Technology&quot;<br><strong>elif</strong> myVar == &quot;And&quot; <strong>and</strong> pre == &quot;A&quot;:<br>   <strong>print</strong> &quot;and&quot;<br><strong>else</strong>:<br>   <strong>print</strong> &quot;Digital&quot;<br> <br><strong>if</strong> <strong>not</strong> a &gt; b:<br>   <strong>print</strong> &quot;a is not greater than b &quot;<br> <br><strong>if</strong> a &gt; b <strong>and</strong> <strong>not</strong> b == 0:<br>   <strong>print</strong> &quot;a is not greater than b and b is not zero&quot;</pre><h4><strong>12. Functions</strong></h4><pre><strong>def</strong> add(a,b):   <br>    <strong>return</strong> a+b<br> <br><strong>print</strong> add(5,4)<br> <br><em># Pass a list of arguments </em><br><strong>def</strong> get_max(*args):<br>    <strong>return</strong> max(args)<br> <br><em># Pass a list of arguments </em><br>get_max(0, -2 , -4, 5 , 7 )<br> <br><em># Function to return the absolute value </em><br><strong>def</strong> get_abs(val):<br>    <strong>return</strong> abs(val)</pre><h4><strong>13. Inbuilt functions</strong></h4><pre><em># Returns data  type  </em><br>type(var) <br> <br><em># Prints int </em><br><strong>print</strong> type(5)<br> <br><em># Prints str</em><br><strong>print</strong> type(&quot;Tech&quot;)<br> <br><em># Returns max from arguments  </em><br>max()<br><strong>print</strong> max(2,3,5,6)<br><em># Returns min from arguments  </em><br>min()<br><strong>print</strong> min(2,3,5,6)<br> <br><em># Return absolute value </em><br>abs()<br> <br><em># Array of numbers from 0 to 9 </em><br>range(0,10) <br> <br><em># Generates a random integer between 0 and 999  </em><br>randint(0, 999)<br> <br><em># Round for two decimal numbers </em><br>round(12.5489, 2)</pre><h4><strong>14. Anonymous Functions</strong></h4><pre>numbers = [11, 10, 1, 2, 3, 4 ]<br><em># Filers all the numbers divisible by 2 </em><br><strong>print</strong> filter(<strong>lambda</strong> x: x % 2 == 0, numbers )<br> <br><em># lambda - Writes functions that does not bound a  name.</em></pre><h4><strong>15. Import Library Time</strong></h4><pre><strong>from</strong> datetime <strong>import</strong> datetime<br><strong>from</strong> module <strong>import</strong> *<br> <br><strong>import</strong> math <br> <br><em># List everything in a module </em><br>all = dir(math)<br><strong>print</strong>  all</pre><h4><strong>16. Date time</strong></h4><pre><strong>from</strong> datetime <strong>import</strong> datetime<br> <br><em># Current date </em><br>current_date = datetime.now() <br><strong>print</strong> current_date<br> <br><em># Day </em><br>current_date.day()<br> <br><em># Month </em><br>current_date.month()<br> <br><em># Year </em><br>current_date.year()<br> <br> <br><em># Hour</em><br>current_date.hour()<br> <br> <br><em># Minute</em><br>current_date.minute()<br> <br> <br><em># Seconds</em><br>current_date.second()</pre><h4><strong>17. Bitwise Operators</strong></h4><pre><em># Shift Right</em><br><strong>print</strong> 5 &gt;&gt; 3 <br> <br><em># Shift Left</em><br><strong>print</strong> 4 &lt;&lt; 2<br> <br><em># AND  </em><br><strong>print</strong> 3 &amp; 2 <br> <br><em># OR</em><br><strong>print</strong> 7 | 3  <br> <br><em># XOR</em><br><strong>print</strong> 23 ^ 12 <br> <br><em># NOT</em><br><strong>print</strong> ~45     <br> <br><em># Convert to binary - 0b11</em><br><strong>print</strong> bin(3)</pre><h4><strong>18. Classes</strong></h4><pre><strong>class</strong> Student(object):<br>    <em># Initialize </em><br>    <strong>def</strong> __init__(self, name, age, sex ):<br>        self.name = name<br>        self.age  = age<br>        self.sex  = sex<br>    <em># Short representation of the class object </em><br>    <strong>def</strong> __repr__(self):<br>        <strong>return</strong> &quot;(%d, %d, %d)&quot; % (self.name, self.age, self.sex )<br> <br>    <strong>def</strong> get_age(self):<br>        <strong>return</strong> self.age<br> <br>    <strong>def</strong> is_male(self):<br>       <strong>if</strong> sex == &quot;m&quot;<br>          <strong>return</strong> True<br>       <strong>else</strong> <br>          <strong>return</strong> False<br> <br>stud = Student(&quot;Sarath&quot;, 30 , &quot;London&quot;)<br> <br><strong>print</strong> stud <br><strong>print</strong> stud.get_age()<br> <br> <br><em># Inheritance </em><br><strong>class</strong> University(object):   <br>  <strong>def</strong> __init__(self, student_id):<br>      self.student_id = student_id<br>  <strong>def</strong> get_class(self):<br>      <strong>return</strong> &quot;A&quot; <br> <br>  <strong>def</strong> calculate_grade(self):<br>      <strong>return</strong> &quot;Super Class&quot;<br> <br><strong>class</strong> Students_details(University):<br>  <strong>def</strong> get_grade(self):<br>      <strong>return</strong> &quot;Grades not available&quot;  <br> <br>  <em># Overrides function</em><br>  <strong>def</strong> calculate_grade(self):<br>      <strong>return</strong> &quot;Child Class&quot;<br> <br> <br>obj = Students_details(&quot;STUD_123&quot;)<br> <br>obj.get_class()<br>obj.get_grade()<br>obj.calculate_grade()</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37baa4cc24de" width="1" height="1" alt=""><hr><p><a href="https://medium.com/technology-and-digital-media/learn-python-quick-notes-37baa4cc24de">Learn Python — Quick notes</a> was originally published in <a href="https://medium.com/technology-and-digital-media">Technology and Digital Media</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Update Android main UI from Webview — Phonegap Plugin]]></title>
            <link>https://medium.com/technology-and-digital-media/update-android-main-ui-from-webview-phonegap-plugin-ab6b6fd4065e?source=rss----de37c90f230d---4</link>
            <guid isPermaLink="false">https://medium.com/p/ab6b6fd4065e</guid>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[android-apps]]></category>
            <dc:creator><![CDATA[Sarath DR]]></dc:creator>
            <pubDate>Fri, 20 Jun 2014 14:41:17 GMT</pubDate>
            <atom:updated>2017-05-30T20:57:57.301Z</atom:updated>
            <content:encoded><![CDATA[<h3>Update Android main UI from WebView -PhoneGap Plugin</h3><p>Recently we have developed an Android hybrid application which uses native action bar along with PhoneGap WebView. For several occasions it was necessary for the WebView element to communicate with with main UI thread. This can be achieved by creating a phone gap plugin. The below code is a simple example for this.</p><p>I have named the file as Helper.java under the package name com.plugins.ui</p><pre>package com.plugins.ui;</pre><pre>import android.content.Context;<br>import android.content.Intent;<br>import android.util.Log;<br>import android.widget.Toast;</pre><pre>import com.sarathdr.app.MyApp;<br>import com.sarathdr.ui.MainActivity;<br>import com.sarathdr.ui.TeamSelectionActivity;</pre><pre>import org.apache.cordova.CallbackContext;<br>import org.apache.cordova.CordovaPlugin;<br>import org.json.JSONArray;<br>import org.json.JSONException;</pre><pre>/**<br> * Created by Sarath DR on 15/04/2014.<br> */<br>public class Helpers extends CordovaPlugin<br>{<br>    CallbackContext callbackContext;<br>    private Context context;<br>    private Integer tabIndex;</pre><pre>@Override<br>    public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException<br>    {<br>        this.context = cordova.getActivity().getApplicationContext();<br>        this.callbackContext =  callbackContext;</pre><pre>if (action.equals(&quot;moveTab&quot;)) {<br>            tabIndex = args.getInt(0);<br>            this.moveTab();<br>            return true;<br>        }else if(action.equals(&quot;showToast&quot;)){<br>            String message = args.getString(0);<br>            this.showToast( message );<br>        }<br>        return false;<br>    }</pre><pre>public void moveTab()<br>    {<br>        // Calls a function in the main activity to move the action bar tab</pre><pre>cordova.getActivity().runOnUiThread(new Runnable(){<br>                public void run() {<br>                    MainActivity.moveTab(tabIndex);<br>                    callbackContext.success();<br>                } });<br>    }</pre><pre>// Show toast message <br>    public void showToast(String message) {<br>        if (message != null &amp;&amp; message.length() &gt; 0) {<br>            Toast.makeText(cordova.getActivity().getApplicationContext(),<br>                    message, Toast.LENGTH_LONG).show();<br>            callbackContext.success(message);<br>        } else {<br>            callbackContext.error(&quot;Expected one non-empty string argument.&quot;);<br>        }<br>    }</pre><pre>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab6b6fd4065e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/technology-and-digital-media/update-android-main-ui-from-webview-phonegap-plugin-ab6b6fd4065e">Update Android main UI from Webview — Phonegap Plugin</a> was originally published in <a href="https://medium.com/technology-and-digital-media">Technology and Digital Media</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Get Recent Callers Android Phonegap Plugin]]></title>
            <link>https://medium.com/technology-and-digital-media/get-recent-callers-android-phonegap-plugin-1e9add71b9c1?source=rss----de37c90f230d---4</link>
            <guid isPermaLink="false">https://medium.com/p/1e9add71b9c1</guid>
            <category><![CDATA[android-apps]]></category>
            <category><![CDATA[featured]]></category>
            <dc:creator><![CDATA[Sarath DR]]></dc:creator>
            <pubDate>Fri, 20 Jun 2014 13:52:39 GMT</pubDate>
            <atom:updated>2017-05-30T20:57:56.916Z</atom:updated>
            <content:encoded><![CDATA[<h3>Get Recent Callers Android PhoneGap Plugin</h3><p>This one is a simple PhoneGap plugin to fetch recent callers from phone. You can just follow the below steps to configure the plugin on your project.</p><p><strong>Step 1:</strong> Download the plugin file from below.</p><p><a href="https://github.com/sarathdr/recent-callers-phonegap/blob/master/RecentCallers.java">sarathdr/recent-callers-phonegap</a></p><p><strong>Step 2:</strong> Create new package “com.plugins.recentCallers” and add RecentCallers.java under the package.</p><p><strong>Step 3:</strong> Add the below line in res/xml/config.xml file</p><p><strong>Step 4:</strong> Now you can call the plugin from your jave script file as below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/06abb8e5a89e1d38e8b7b274c692cb19/href">https://medium.com/media/06abb8e5a89e1d38e8b7b274c692cb19/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e9add71b9c1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/technology-and-digital-media/get-recent-callers-android-phonegap-plugin-1e9add71b9c1">Get Recent Callers Android Phonegap Plugin</a> was originally published in <a href="https://medium.com/technology-and-digital-media">Technology and Digital Media</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Symfony 2 deployment with Rsync — Similar to Symfony 1.4 deployment]]></title>
            <link>https://medium.com/technology-and-digital-media/symfony-2-deployment-with-rsync-similar-to-symfony-1-4-deployment-d3ba55cdce7e?source=rss----de37c90f230d---4</link>
            <guid isPermaLink="false">https://medium.com/p/d3ba55cdce7e</guid>
            <category><![CDATA[featured]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Sarath DR]]></dc:creator>
            <pubDate>Wed, 05 Mar 2014 18:19:58 GMT</pubDate>
            <atom:updated>2017-05-30T20:57:59.744Z</atom:updated>
            <content:encoded><![CDATA[<p>As mentioned in the <a href="http://symfony.com/doc/current/cookbook/deployment-tools.html">Symfony 2</a> website, there are many tools available to deploy the source code to remote server. I made this simple hack to follow the previous Symfony 1.4 deployment process. We have been using rsync to deploy all of our Symfony 1.4 projects and it is automated with some shell scripting. In order to keep the same settings, I have been forced to use the same commands that we use for Symfony 1.4. I would not recommend this solution, it is always better to use Phing or other deployment tools to make things more perfect. However this one is a quick solution and easy to implement.</p><p>Mainly you have to follow the below four steps.</p><p><strong>Step 1:</strong> Configure your remote server details. Create two files “<em>properties.yml</em>” and “<em>rsync_exclude.txt</em>” in the “<em>app/config</em>” folder of your Symfony2 project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/441/1*pkt3YyCeR_hPOj8SQHn0kQ.png" /></figure><p><strong>Step 2:</strong> <em>properties.yml</em> file format. Please follow the below format for server details configuration.</p><pre># Development environment<br>development:<br>   host: dev.sarathdr.com<br>   port: 22<br>   user: devuser<br>   dir: /srv/www/dev.sarathdr.com/</pre><pre>production:<br>   host: prod.sarathdr.com<br>   port: 22<br>   user: produser<br>   dir: /srv/www/dev.sarathdr.com/</pre><p><strong>Step 3:</strong> Create a new file &quot;<em>symfony</em>&quot; and save that your project root folder. Copy the below code and paste it in that file. Or <a href="https://github.com/sarathdr/symfony2-deployment/archive/master.zip">Click here to download the file</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/294/1*tbwaYkpM1i_XyWUYd__Egg.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ed8af1e547b77ffc256d81dbb421cf29/href">https://medium.com/media/ed8af1e547b77ffc256d81dbb421cf29/href</a></iframe><p><strong>Step 4:</strong> The set up is now finished and you can try a dry run with the below command from the root folder.</p><pre>php symfony project:deploy development -t</pre><pre>#dry-run</pre><p>Use the below command to deploy the files</p><pre>php symfony project:deploy development --go</pre><pre>#deploy</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3ba55cdce7e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/technology-and-digital-media/symfony-2-deployment-with-rsync-similar-to-symfony-1-4-deployment-d3ba55cdce7e">Symfony 2 deployment with Rsync — Similar to Symfony 1.4 deployment</a> was originally published in <a href="https://medium.com/technology-and-digital-media">Technology and Digital Media</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>