Sunday, November 30, 2014
Tuesday, November 25, 2014
Getting started with grails Quartz jobs
Quick start in grails jobs using the grails Quartz plugin
class MyJob { def grailsApplication def execute(context) { def myService = grailsApplication.mainContext.myService def domainInstance = MyDomain.get(context.mergedJobDataMap.get('domainId')) } }
Wednesday, October 22, 2014
Using HTML data attributes
For those who have always been hearing about data attributes and have never actually understood how to use them. Here is an article to help you get a start on using them
https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes
https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes
Tuesday, October 21, 2014
How to start your grails integration tests
I always keep forgetting how to start writing my grails integration tests. I hope this helps someone
class TestISpec extends grails.plugin.spock.IntegrationSpec { def 'this should do that'() {} }
Thursday, October 9, 2014
Getting unique commits in a branch ..well almost
To list unique commits in a branch
Then you can format the output as follows
git log --first-parent --no-mergesFor more details checkout http://stackoverflow.com/questions/5720343/using-git-show-all-commits-that-exist-only-on-one-specific-branch-and-not-a
Then you can format the output as follows
git log --first-parent --no-merges --pretty=format:"%H %s"Then you get something like
3d6995f61c1359e44c98433bb5ed4251798002c3 My Commit
Monday, May 12, 2014
Friday, May 9, 2014
Get all tables that have a certain field
select table_name from columns where table_schema = 'mydatabase' and column_name = 'looking_for_this_field';
Wednesday, March 26, 2014
NoClassDefFoundError
NoClassDefFoundError in Java comes when Java Virtual Machine is not able to find a particular class at runtime which was available during compile time.
Read more: http://javarevisited.blogspot.com/2011/06/noclassdeffounderror-exception-in.html#ixzz2x8LeYeww
Read more: http://javarevisited.blogspot.com/2011/06/noclassdeffounderror-exception-in.html#ixzz2x8LeYeww
Thursday, February 20, 2014
Thursday, January 23, 2014
Wednesday, January 22, 2014
Extract value from string using regex in java
So suppose you want to extract values from a string based on a certain regex pattern. The thing that i didn't know was that I needed to use () around the data I wanted to capture.
Output
I dedicate this post to all laymen out there, who get confused with coding and stuff
Output
http://home.com 56
I dedicate this post to all laymen out there, who get confused with coding and stuff
Listen for text changes on EditText
Assume you want to enable a button only if some changes have been made to a form. You can do this by using android.text.TextWatcher
Simply create a new instance of TextWatcher and implement the required methods
There you have it. For more info checkout http://developer.android.com/reference/android/text/TextWatcher.html
Simply create a new instance of TextWatcher and implement the required methods
There you have it. For more info checkout http://developer.android.com/reference/android/text/TextWatcher.html
Tuesday, January 21, 2014
The magic of grep and sed and xargs
You want to get all files that have a certain string
You then want to replace that string with another string
The xargs command passes the values from "grep -rl "ToMatch" <folder>" to the sed command as arguments
For more info on how to use xargs look at http://unixhelp.ed.ac.uk/CGI/man-cgi?xargs
grep -rl "ToMatch" <folder>
You then want to replace that string with another string
grep -rl "ToMatch" | xargs sed -i s/ToMatch/Replaced/g
The xargs command passes the values from "grep -rl "ToMatch" <folder>" to the sed command as arguments
For more info on how to use xargs look at http://unixhelp.ed.ac.uk/CGI/man-cgi?xargs
Friday, January 17, 2014
Delete values from a map through a loop
So you woke up today and you want to delete values from a map, as you loop through the map (For whatever reason). So you right this is groovy
Code
Output
You actually get a ConcurrentModificationException.... hahaha :D <- This is me laughing at you. So you need to
Code
Output
[a,b,c]Wrong !!!!
You actually get a ConcurrentModificationException.... hahaha :D <- This is me laughing at you. So you need to
Wednesday, January 15, 2014
Java String.equals versus == [duplicate]
String.equals("some string") checks the contents of the string
"==" checks if the object references are identical
"==" checks if the object references are identical
Friday, January 3, 2014
Subscribe to:
Posts (Atom)