Practical notes on building software.
Java, Angular, cloud, security and building software with AI: real problems, working code, and what I'd do differently next time.
Same address, new home
tech.sarathdr.com is no longer hosted on Medium. Every post has moved across, old links still work, and there's more to come.
More posts
Track Clicks Outside a Component with a React Custom Hook
A custom React hook that detects clicks outside a component. Useful for building components such as modals and dropdowns.
Android Transition Examples
A sample project showing the Android transition framework: scenes, built-in animations and transitions defined in XML.
Integrate a Native Library into an Android Gradle Project — Sample Project
Step-by-step setup for building and loading an NDK native library in an Android Studio Gradle project, with a sample project.
Download Emails from Gmail as a CSV File — PHP
A fun proof of concept that uses OAuth 2.0 and IMAP to download the emails from a Gmail folder as a CSV file in PHP.
Generate the Cordova JAR File from a PhoneGap Project Using Ant
Build cordova.jar from the CordovaLib project with Ant, so you can use Cordova as a library in Android Studio.
Find Geographic Coordinates from an Address or Postcode with the Google Maps API
A small JavaScript client that uses the Google Geocoding API to find the latitude and longitude of an address or postcode.
Learn Python — Quick Notes
Quick reference notes for Python beginners: printing, strings, lists, dictionaries, loops, functions, dates and classes.
Update the Android Main UI from a WebView — PhoneGap Plugin
A simple PhoneGap plugin that lets JavaScript in a WebView update the native Android UI, such as the action bar.
Get Recent Callers — Android PhoneGap Plugin
A simple PhoneGap plugin that fetches recent callers from an Android phone, with setup steps.
Symfony 2 Deployment with Rsync — Like Symfony 1.4 Deployment
A simple script that deploys a Symfony 2 project with rsync, using the same project:deploy workflow as Symfony 1.4.
PhoneGap Android — Contact Image Problem with Android 4.4
Android 4.4 KitKat won't display contact photo URIs in a WebView. A workaround that reads the image natively and returns it as Base64.
jPlayer Not Working in the HTC One Android 4.3 Browser
A workaround for jPlayer's media load bug on some Android browsers: add a short delay before calling media.load().
Regular Expression to Validate Mobile Numbers Starting with + (Plus) — PHP
A PHP regular expression that validates mobile numbers with or without a leading + sign.
Methods Called from a WebView Need the @JavascriptInterface Annotation — Android Development
Since Android 4.2, native methods called from JavaScript in a WebView must be annotated with @JavascriptInterface.
Simple Pagination Script for PHP
A ready-to-use PHP pagination function. Copy it into your project and adapt it as needed.
Useful ADB (Android Debug Bridge) Commands
A quick reference for common adb commands: install and uninstall apps, filter logs by tag and broadcast an install referrer.
Use Absolute URLs for JavaScript Files — Symfony 1.4
Make Symfony 1.4 output absolute URLs for JavaScript files, both in view.yml and when adding them dynamically.
Set the HTTP Authentication Header from a Client — PHP / cURL
Protect a REST API with HTTP Basic authentication in PHP, and call it with the right header or with cURL.
RSA Public Key Encryption in an Android App with Server-Side Decryption in PHP
Encrypt data in an Android app with an RSA public key (Bouncy Castle) and decrypt it on a PHP server with phpseclib.
Function to Generate the 12 Month Names in an Array — PHP
A small PHP function that returns the names of all 12 months in an array.
The Glass Computer — Google Glass
An introduction to Google Glass: its features, the technologies behind it, its hardware, and its pros and cons.
Nokia Lumia 925 — Released in the UK on 13 June
An overview of the Nokia Lumia 925 — design, camera and screen — and how it compares with the Samsung Galaxy S4.
Eclipse Crashes When You Export an APK on a Mac — Solution
Eclipse kept crashing while exporting a signed APK on my Mac. Two steps that stop it happening.
The 4G Network Across the UK in a Nutshell
A quick guide to 4G in the UK in 2013: what it is, which phones and cities support it, speeds, and EE's launch prices.
Convert a Database Cursor to a JSON Array — Android App Development
Java code that converts an Android SQLite cursor into a JSON array, handy for PhoneGap plugins that run raw queries.
Get to Know the Samsung Galaxy S4 — UK Release 26 April — Review
A review of the Samsung Galaxy S4: key features, its new software tricks, and how it compares with the Galaxy S3 and iPhone 5.
Hide Icons on the Mac Desktop
Two Terminal commands to hide all the icons on your Mac desktop, and one to bring them back.
iPhone PhoneGap Plugin for In-App Auto-Renewable Subscriptions
Set up auto-renewable in-app subscriptions in iTunes Connect and add them to a PhoneGap iPhone app with StoreKit, step by step.
Useful Android Apps and Links for App Development
Handy apps and links for Android developers: AirDroid, AIDE, an HTML editor, a referral tester, sample projects and tutorials.
Get the Network Connection Name — Android App Development
Retrieve the name of the current network connection in Android, and call it from JavaScript in a PhoneGap app.