Category Archives: Programming

pretty json format in Sublime in 60 seconds

By | October 9, 2018

If you are working with json and want to view it in a pretty format within Sublime, you can install an extension very quickly. The long way on a Mac is to navigate to ~/Library/Application Support/Sublime Text 3/Packages and run this command from a terminal: git clone https://github.com/dzhibas/SublimePrettyJson.git Restart Sublime and the open up some unformatted json… Read More »

OSX Eclipse installer does not contain the JNI_CreateJavaVM symbol error

By | June 16, 2018

If you are trying to install Eclipse and you get the following error: The JVM shared library “/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/../lib/server/libjvm.dylib” does not contain the JNI_CreateJavaVM symbol. You want to: Right click the installer file and select ‘show package contents’ Go to Contents and open Info.plist At the bottom of this file, you’ll see a commented section… Read More »

php hello world on OSX

By | July 10, 2017

Getting a php hello world up and running is very quick in OSX. First of all, everything is there already. Apache and php. To start apache run: > sudo su > apachectl start Then go to http://localhost and you should see: The web directory is /Library/WebServer/Documents If you put hello.php there <html> <head> <title>PHP Test</title>… Read More »

Creating a simple navigation drawer in Android

By | June 26, 2017

There are lots of articles on how to create a navigation drawer in Android but they are all slightly different with some extending ActionBar and some extending Activity. I wanted to extend AppCompatActivity as this is the most up to date version to use. The notes at: https://developer.android.com/training/implementing-navigation/nav-drawer.html are ok but it doesn’t explain step by… Read More »

Learning Android toast the long way

By | June 11, 2017

It is relatively easy to show a toast (a short message that appears on screen for a few seconds and then disappears) with the following code: Toast.makeText(getApplicationContext(), “hi”, Toast.LENGTH_LONG ).show(); The trick is trying to understand how this short hand method was created. This is what it looks like written the long way: Context context;… Read More »

Best Android 101 Tutorials

By | June 7, 2017

This site has a very high quality android tutorial. Old school versions: Make Your First Android App: Part 1/3 Android Tutorial for Beginners: Part 2 Android Tutorial for Beginners: Part 3 Updated versions: Beginning Android Development Part One: Installing Android Studio Beginning Android Development Part Two: Using Android Studio It is well worth reading both.… Read More »

What is an Android Intent?

By | June 5, 2017

The official definition is: An Intent is an object that provides runtime binding between separate components, such as two activities. (taken from: https://developer.android.com/training/basics/firstapp/starting-activity.html) In plain English, if you want to pass variables or parameters between screens (activities), use Intents

Could not find com.android.support.constraint:constraint-layout:1.0.2.

By | June 4, 2017

If you are running into this problem, it will be because Android Studio has this quirk where the constraint folder is not in the android directory structure but outside it. Let’s start from the beginning. The libraries are all in the /User/<username>/Library/Android/sdk/extras/android/m2repository/com/android/support/ However, constraint sits in a slightly different place. It is at /User/<username>/Library/Android/sdk/extras/m2repository/com/android/support/ Note the… Read More »

Cannot get versionName from AndroidManifest.xml?

By | June 3, 2017

If you are running code like this: try { PackageInfo myInfo = getPackageManager().getPackageInfo(getPackageName(),0); versionName = myInfo.versionName; verCode = myInfo.versionCode; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } TextView myText = (TextView)findViewById(R.id.textView2); myText.setText(versionName + ” – ” + verCode); but the output is not what you are expecting, the chances are you are using gradle to build… Read More »