James Elsey

Digital learnings and other such nonsense…

Follow me on TwitterRSS Feeds

  • Home
  • About
  • Projects
    • Sales Tracker
    • Cerca de mí
    • Midworld
    • XMLeet
    • Game Package
  • Code Kata
    • J-99, 99 Java problems but the switch ‘aint one…
  • Resources
    • SCJP / OCJP Exam Objectives and what you need to study for each section
    • Ubuntu Linux Certification; LPI
    • ITIL v3 Foundation Certification
    • Interview Questions and Preparation
  • Badges
  • Android Apps
    • AndroidSam
    • Planning Poker

Using special characters in a linux sed command without having to escaping them

May 11th

Posted by James Elsey in Linux

No comments

I came across a brilliant little feature of the linux sed command today that I wasn’t aware of, and thought it was well worth posting up about.

I’d been using sed statements inside a bash script, to trawl through property files and replace values, these were all alphanumeric values so I didn’t have any problems with the usual sed comand of

sed -e s/replaceThisValue/withThisValue/g

That worked great, but then I had some properties introduced that contained special characters, notably the forward slash and equals. I scanned the interwebz for answers and there were all sorts of complicated techniques for escaping special characters, passing them into awk and all sorts of other such nonsense, however there is a much simpler way, just use a different separator character.

Click to read the full post
Share
command, escaping, linux, sed
toast

Asserting for a Toast message using Robolectric

Feb 18th

Posted by James Elsey in Android

No comments

I’ve recently put together a few proof of concept applications, and since they’re “rough and ready” applications, a lot of the functionality is actually mocked, or given a stubbed implementation.

For example, I’ve got various buttons for things like “sign in with LinkedIn” or “Connect with Facebook”. Since its just a proof of concept, and those features aren’t really must haves, I stub them with a Toast message saying something along the lines of “feature not yet implemented”.

This gives the user the opinion that the buttons are there, functional, however the actions they take are not yet implemented.

Click to read the full post
Share
android, robolectric
main menu

A second app to launch; Agile Planning Poker

Feb 12th

Posted by James Elsey in Agile

No comments

After launching my first application onto the market back in March 2011, and amassing somewhere in the region of 15,000 downloads since it’s launch, I was eager to produce another.

I offered up my services at my work to develop an application to “test the water”, teaming up with the marketing director we created a simple yet useful application for agile project managers; planning poker decks.

Click to read the full post
Share
agile, android, app, market, planning poker
realistic-water-drop-splash

How to add a splash screen to your android application in under 5 minutes

Jan 29th

Posted by James Elsey in Android

2 comments

Adding a splash screen to your application is a quick and easy way to make it look more well rounded, complete, and more professional, it can also serve as a useful distraction whereby you have an extra few seconds to initialise your application components before displaying them to the user.

In this post I’ll show you how to quickly and easily add a splash screen into your application, I’ll also show you how you can create an option whereby users may disable or enable the splash screen for subsequent launches of your application. I’ll also post up my sample code freely on Github so you can checkout what I’ve done and use as you please.

Click to read the full post
Share
android, screen, splash, ui

Converting dp to pixels in android

Jan 24th

Posted by James Elsey in Android

No comments

Sometimes in android you have to deal with pixels, which can often be awkward, such as view.setPadding(int, int, int, int).  Obviously this is not ideal as pixel ratings vary from device to device, nonetheless there is a work around for this

Simply come up with the value you want in dip (density independent pixels), such as 10, and then convert into pixels using the display metrics of the device you’re working on. This will ensure that when the conversion runs, it’ll always scale to the device the application is running on.

float sizeInDip = 10f;
int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, sizeInDip, getResources().getDisplayMetrics());

Enjoy!

Permanent link to this post (105 words, estimated 25 secs reading time)
Share
android, pixels, ui
to-do-list-nothing

Top 10 Techie things I want to achieve in 2012

Dec 24th

Posted by James Elsey in Android

No comments

I’m not the type of person that gets bored easily, I’ve always got many things to keep me amused, mostly side projects at home. I’m a firm believer, that if you don’t set yourself goals in the first place, then you won’t have anything to fail to achieve, so I’ve set myself a list of targets that I’d like to achieve in 2012 knowing full well I probably won’t get around to them all, but if I can do at least 3, it was worth it.

Click to read the full post
Share
2012, todo
sms-incoming

SMS text messaging simulation on android

Dec 24th

Posted by James Elsey in Android

No comments

As part of an application I’m currently developing, I need to be able to interogate incoming SMS messages. Since I’ll be developing against the emulator initially I need a way of sending in SMS messages to the emulator. Fortunately, we can use adb to poke in SMS messages at will, as detailed below.
Ultimately, you’ll need to telnet into your emulator, and you’ll need two things:
  • The port the emulator runs on. To find this out, open up a command window and type :

adb devices

You should see something like this :

Click to read the full post
Share
adb, android, sms, text messaging
title_bar_removal

How to remove the default grey title bar on android apps

Dec 22nd

Posted by James Elsey in Android

No comments

Fed up of the default title bar on your android applications?

We can get rid of that easy, either use the following in your activities to do it :

requestWindowFeature(Window.FEATURE_NO_TITLE);

Or, the way I prefer, disable it application wide by slipping the following into the AndroidManifest.xml file :

android:theme="@android:style/Theme.NoTitleBar"
Permanent link to this post (51 words, 1 image, estimated 12 secs reading time)
Share
android, android-ui, ui, user-interface
Code rage

Automating android application signing and zipaligning with maven

Sep 15th

Posted by James Elsey in Android

No comments

This is something that has had me tearing my hair out for a few days now, I was pretty much border-line braveheart-ing my screen….

Code rage

I’ve recently been on a little drive to try to maven-ize my projects. All had been going well until I needed to sign and zipalign my APKs. This post will help you conquer that barrier with the use of some maven plugins.

When using ant, I was able to simply enter keystore details into build.properties and just call “ant release”. Unfortunately that approach doesn’t carry across to maven, and you have to provide some more configuration.

Click to read the full post
Share
android, continuous-integration, java, jayway, maven, maven-android, xml
Hedgehog

String concatenation operator

Sep 7th

Posted by James Elsey in Certification

No comments

The string concatenation operator is a bit like a hedgehog, it looks cute and sweet, but try to grab hold of it quickly and you’ll soon know about it…

It’s actually quite simple, however there are some traps that are very easily overlooked (just got caught out with it on a mock test, so I’m here to rant).

The rule of thumb is, that if either one of the operands being “+” is a String, then concatenation will occur, but if they are both numbers, arithmetic addition will occur. Sounds simple right? What do you think the following equate to?

Click to read the full post
Share
certification, core java, java, OCJP, OCPJP, scjp
12345»...Last »
  • About Me

    A 25 year old Java Developer, experienced in J2EE web applications, Web services, and also becoming quite an experimentalist in Android. Dedicated to success through personal self-development.

  • Categories

    • AdSense / Ads / Monetization (2)
    • Android (25)
      • Framework and Scaffolding (2)
      • Market (2)
      • Robolectric (1)
      • SQLite (1)
      • Text To Speech (TTS) (1)
      • UI (3)
      • Voice Recognition (1)
    • Certification (23)
      • ITIL (2)
      • SCJP (20)
    • Conferences (1)
    • Developer Tools (3)
      • Maven (2)
    • Frameworks (2)
      • Stripes (2)
    • Games Development (1)
    • General Programming (6)
      • Continuous Integration (2)
      • OO Concepts (1)
    • Git (1)
    • Google APIs (1)
    • Google App Engine (3)
    • Java (43)
      • Core Java (21)
    • JSTL (1)
    • Linux (5)
      • Linux from scratch (1)
      • Slackware (1)
    • Methodologies and Practices (1)
      • Agile (1)
    • Python (1)
    • Scripts (1)
    • Test Driven Development (1)
    • Uncategorized (1)
    • Web (1)
    • Wordpress (1)
    • XML (2)
    • Yahoo! APIs (1)
  • Twitter

    Loading tweets...
    Follow me on Twitter!
Mystique theme by digitalnature | Powered by WordPress
RSS Feeds 1 Top