My Sites


Thursday, November 5, 2015

(pending—Waiting for next available executor) - FIX

For the master, this is set in Manage Jenkins > Configure System > # of executors
For the slaves (nodes), it is set in Manage Jenkins > Nodes > (each node) > Configure > # of executors

How to schedule jobs (Cron) in Jenkins

Cron job - run periodically at fixed times, dates, or intervals.

A CRON expression is a string comprising five or six fields separated by white space[10] that represents a set of times, normally as a schedule to execute some routine.
    MINUTES Minutes in one hour (0-59)
    HOURS Hours in one day (0-23)
    DAYMONTH Day in a month (1-31)
    MONTH Month in a year (1-12)
    DAYWEEK Day of the week (0-7) where 0 and 7 are sunday

If you want to shedule your build every 5 minutes, this will do the job : */5 * * * *
If you want to shedule your build every day at 8h00, this will do the job : 0 8 * * *
15 13 * * * you tell jenkins to schedule the build every day of every month of every year at the 15th minute of the 13th hour of the day. (13:15)

http://www.unixgeeks.org/security/newbie/unix/cron-1.html

01 * * * * root echo "This command is run at one min past every hour"
17 8 * * * root echo "This command is run daily at 8:17 am"
17 20 * * * root echo "This command is run daily at 8:17 pm"
00 4 * * 0 root echo "This command is run at 4 am every Sunday"
* 4 * * Sun root echo "So is this"
42 4 1 * * root echo "This command is run 4:42 am every 1st of the month"
01 * 19 07 * root echo "This command is run hourly on the 19th of July"

Wednesday, November 4, 2015

Unable to debug in Java with eclipse + Fix

ERROR: transport error 202: connect failed: Connection refused
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:708]
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)

It seams that in some cases DNS is expected to resolve this, and if
firewall prevents localhost requests to DNS - stuff breaks. I had to
alter hosts file and remove comments in following lines.
# 127.0.0.1 localhost    # ::1 localhost   

Use the $in Operator with a Regular Expression + Mongo + Java + Morphia

https://docs.mongodb.org/v3.0/reference/operator/query/in/
The $in operator can specify matching values using regular expressions of the form /pattern/. You cannot use $regex operator expressions inside an $in.

Perform Case-Insensitive Regular Expression Match
https://docs.mongodb.org/manual/reference/operator/query/regex/#perform-case-insensitive-regular-expression-match

Example :-
db.Course.find( { $and: [{callNo: {$in : ["testcourse"]} },{myId :123456 }]})
db.Course.find( { $and: [{callNo: {$in : [/^testcourse$/i]} },{myId :123456 }]})

jmkgreen/morphia (MongoDB object-document mapper in Java. Uses mongo-java-driver. )
https://github.com/jmkgreen/morphia/blob/master/morphia/src/main/java/com/github/jmkgreen/morphia/query/Query.java

Pattern regexDbObject = Pattern.compile("^" + originalCourseCallNo + "$", Pattern.CASE_INSENSITIVE);
mongoDatastore.find(EmployeeEntity.class).filter("email", regexp).get();

List<Pattern> courseCallNoList = new ArrayList<Pattern>();courseCallNoList.add(regexDbObject); 
List<Course>  courses= getDataStore().createQuery(Course.class).field
(Constants.Course.COURSE_CALL_NO).in(courseCallNoList).field
(Constants.Course.CLIENT_ID).equal(clientId).field
(Constants.Course.COURSE_CALL_NO_EXPIRATION_DATE).greaterThanOrEq(courseCallNoExpDate).asList();


http://www.tutorialspoint.com/java/java_regular_expressions.htm