Eclipse SVN: Subclipse vs. Subversive

Where I work, we use both SVN and Git. I’ve dumped SourceTree for Eclipse Kepler’s integrated Git client which is actually pretty nice. For an integrated Subversive client, over the years I’ve jumped between Subclipse and Subversive. This here looks to be the Definitive Thread on which one to choose. For me, I’ve gone ahead with Subclipse with my current Eclipse Kepler install.

http://stackoverflow.com/questions/61320/svn-plugins-for-eclipse-subclipse-vs-subversive

Share

Easily Add Copyright Notice To *.java and *.xml Files In Your Projects

I’m still using Eclipse. Some habits are hard to get rid of. Finding gems like these make it harder. On the Eclipse Marketplace, there is a plugin called Copyright Wizard 1.4.0. Once installed, you can configure the templates in the Preferences as seen below:

copyright

Configuring the template is optional. When you’re ready to apply the copyright, right-click on the folder or java package, select the Apply copyright

copyright1

…Set your params and license…

copyright2

…right click and refresh your project and you will see the new copyright/license notice

copyright3

I experimented with another tool called Eclipse Releng Tools but I found it didn’t handle the XML use case I’ve documented above. This plugin is a pretty handy tool to have if you are a propitiatory developer or an open source one. Whatever tool you use, all that matters is you get it done.

Share

A Visual Guide To Embedding JSON Into Your Android Project

A colleague of mines shared his technique on creating hard-coded JSON strings to be embedded as a String in source code. This is helpful if you want to defer writing the HTTP request + response code or want to bypass existing steps like authentication.

The formatting is done using a web tool called http://www.freeformatter.com/. The first step is to take a well-formed JSON string from wherever:

[
    {
        "hello": "world"
    },
    {
        "foo": "bar"
    },
    {
        "apples": "oranges"
    }
]

If you copy and paste this into .java file, you will have issues. So using the webtool, you can prepare the above into something that will compile properly. On the website Free Formatter website click on the JSON Formatter:

freeFormatter_s1

Copy and paste the JSON into Option 1′s text input. Alternatively, you can enter the URL if the json is available online. Be sure to select the indentation to “Compact (1 line)”. This will ensure that it will strip carriage return characters.

freeFormatter_s2

Once you hit the FORMAT JSON button, you will see the compressed JSON but we’re not done yet. If you use this string as is in a .java file, you will have issues because the quotation marks need to be escaped. Next, hit the COPY TO CLIPBOARD button and go to “Java and .Net Escape” under String Escapers and Utilities

freeFormatter_s4

On the Java and .Net Escape tool then, hit the ESCAPE button.

freeFormatter_s5

Copy the resulting output and paste the prepared JSON string into your source code:

freeFormatter_s6

Once you’ve embedded the string into your java code, you can feed the JSON string into your favorite JSON parser implementation.

freeFormatter_s7

You could do this all without the aid of formatting tools but that process is prone to human error. Hope this helps.

Share

Notes: android.graphics.drawable.StateListDrawable

Makes a Drawable store many Drawables; It can switch between those different drawables if the Resource Id’s are provided; The resource Id’s are stored in an int[]; That int[] maps to a Drawable. Use addState(int[], Drawable) to build this dynamically

API Documentation:
StateListDrawable

Source:
StateListDrawable.java

StateListDrawable

Share

Android Widgets In 4 Minutes

Last Thursday, The Working Group held a #nerdlearn Demo Night where 10 Toronto devs showcased their code/product/side/project/etc. There were a couple of rules 1) No slides, 2) You must show code, and 3) No more than 4 minutes MAX. Live demos are always a great source of stress for me so I try to mitigate it by showing a video that guarantees that it works.

However, what can go wrong will go wrong. As it turns out, I was the only presenter who didn’t own an Apple laptop equipped for access to AirPlay when there was no HDMI hookup. Good thing MacBooks don’t discrimate playing mp4 files.

Anyways, here’s the same footage as shown Thursday night annotated the day after.

Special thanks to Dessy Daskalov (@dess_e) for letting me be a part of the demos and to Matthew Potter (@AskMP) for the last minute technical a/v assistance.

Enjoy!

Share

Unofficial #RedFlagDeals Hot Deals Widget Demo this Thursday at #nerdlearn

I will be giving a really short code talk on a fun side-project involving making an Android Widget. I’ll be highlighting the key differences between developing widgets and typical Activity-based Android applications. Developing widgets are not as popular as making other types of applications because they have a certain number of constraints and API version limitations (i.e. Fragmentation issues).

RFD Hot Deals Widget is free, open-source, and ad-free. It was made because I got tired of opening the browser and entering the URL/opening the bookmark. I just wanted to see as many deals as possible on my home screen.

#nerdlearn Event details can be found here:
http://www.uniiverse.com/listings/nerdlearn-demo-night-show-us-your-code-toronto-R9TH6

The source code can be found on Github here:
http://github.com/marklapasa/rfdhotdealswidget

The widget can be downloaded here:
http://play.google.com/store/apps/details?id=net.lapasa.rfdhotdealswidget

Share

Getting Eclipse ADT to work with Gradle 1.8

The latest version of Gradle at the time of writing is 1.9. However, if you download the latest Eclipse ADT Tools 22.0.1.v201305230001–685705, it is limited to using only Gradle 1.6 out of the box.

Thanks to the following StackOverflow post, all you need to do is update the build.gradle file:

classpath ‘com.android.tools.build:gradle:0.6.1+’

See http://stackoverflow.com/a/20062451/855984

Share

Rare Toronto Tech “Super Meetup” on Dec 3rd

News is going to spread fast. Not because of this blog post but because the organizers of the following groups will be dispatching an announcement for this Holiday gathering super meetups of meetups:

- DevTO
- Girl Geeks Toronto
- CreateInTO
- HTML Toronto
- Toronto JavaScript
- Mobile Learning Lab
- AngularJS / PhoneGap
- Maker Faire Toronto

I went to last year’s which consisted of Hackernest, Girl Geeks Toronto, and DevTO crowds in one spot. It was great meeting all kinds of people away from the keyboard. If you’ve never been to any of these other meetups, I would think this would be a great way to get a taste of all of them in one night.

Why no Hackernest on the bill!??!

See you there Toronto, stay classy!

$10 online
$15 at the door

Toronto Tech Wrap-up 2013
https://www.uniiverse.com/listings/toronto-tech-wrap-up-2013-toronto-RFWNZ

Share

One of the many reasons why I hate recruiters

IMG_0280

Who the f*ck is Francisco? My name is Mark. Sadly this isn’t the first time this has happened. Uggh #fail

Share

Increase bulk insert speed by 500%-ish and other SQLite tricks

I came across a pretty cool blog post on NOT trying to loop through a collection of ContentValues and firing database.insert(TABLE_NAME) each time. It turns out there exists a utility that is not very well known that can do a better job.

android.database.DatabaseUtils.InsertHelper is a wrapper that I am guessing, queues up SQL compile statements before really committing to the database while reducing the overhead preparing the data for insertion.

Check out Dan Breslau’s blog post for the bulk insert code example and a few other SQLite performance tips.

UPDATE: InsertHelper is deprecated in API >17. SQLiteStatement is the preferred approach moving forward.

Share

Older posts «