Skip to main content

Posts

Environment Setup in Mac

Type the following command to check the Shell type before creating the profile file $echo $SHELL Based on shell like BASH or ZSH   Go to home folder by ~ and then create the profile .bash_profile or .zprofile
Recent posts

Webinar: Process Driven Spring Applications with Activiti

REST-Ful API Design

Import and Export using OPLOG.RS in MongoDB

Edit mongod.conf  to add replicate set sudo vi /etc/mongod.conf Add this following lines in mongod.conf replication:   replSetName: rs0   oplogSizeMB: 1024 Then restart mongod by "sudo service mongod restart" Check for mongo status if everything is fine sudo service mongod status if everything is OK you get this result otherwise please check/var/log/mongodb/mongod.log for any errors. mongod start/running, process 5806 Now go to Shell prompt and type  >mongo Then type > use  //To change your working DB > rs.initiate() { "info2" : "no configuration explicitly specified -- making one", "me" : "jamesnirmal:27017", "ok" : 1 } Now command prompt will changed to  rs0:PRIMARY> Now type rs0:PRIMARY> use local rs0:PRIMARY> show collections me oplog.rs startup_log system.indexes system.replset MongoRestore: Now go to Normal shell and crea

Upload File with Form Data in Java

This is simple Java code to upload file with form data  Jar file Used: Apache Http Client   package com.james.util.file.upload; import java.io.File; import java.io.IOException; import org.apache.http.HttpEntity; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.entity.mime.content.FileBody; import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; public class FileUpload {             public static void main(String[] args) throws ClientProtocolException, IOException {                         String  ticket="62cd28e08e398be82e38a064ed";             String url = " ?ticket=";             S