1. find the files modified before a certain time
find /path/to/folder/ -mmin +60
2. find the modified after a certain time
find /path/to/folder/ -mmin -60
<af:document id="d1" title="#{sessionScope.pageTitle}"
partialTriggers="r1" initialFocusId="r1:0:sf1:it1">
public static void main(String[] s) throws FileNotFoundException,
IOException {
String count = "";
long total=0;
for (int j = 0; j < 20; j++) {
long temp=calculateCostofSOP();
count = count + String.valueOf(temp) + " ";
total=total+temp;
}
System.out.println(count);
System.out.println(total);
}
This loop iterator 20 times to have a clear picture of COST of SOP. Let's now have our implementation of calculateCostofSOP
public static long calculateCostofSOP() throws FileNotFoundException, IOException {
FileReader fr =
new FileReader("C:\\gre");
PrintWriter pw=new PrintWriter("C:\\grew");
BufferedReader bfr = new BufferedReader(fr);
String line = "";
StringBuilder sb = new StringBuilder();
long sv = System.currentTimeMillis();
while ((line = bfr.readLine()) != null) {
line = line.replace("\t", "=");
sb.append(line + "\n");
System.out.println(line); //comment this line while we use file out
// pw.write(line + "\n"); //comment this line while we use console out
}
pw.close();
bfr.close();
FileWriter f =
new FileWriter("C:\\gre");
BufferedWriter buffW = new BufferedWriter(f);
buffW.write(sb.toString());
buffW.close();
return (System.currentTimeMillis() - sv);
}
Now look at the output we received. It took whopping 109028 milliseconds. The file "gre" was not too long. It contains data from here https://quizlet.com/47571/export.//System.out.println(line); pw.write(line + "\n");
<af:panelFormLayout>
<af:resource type="javascript" source="/js/custom.js"/>
</af:panelFormLayout>
- oracle.adf.view.rich.automation.ENABLE=false
- oracle.adf.view.rich.ASSERT_ENABLED=false
- org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION=false
- org.apache.myfaces.trinidad.COMPRESS_VIEW_STATES=true
- org.apache.myfaces.trinidad.DEBUG_JAVASCRIPT=false
- org.apache.myfaces.trinidad.DISABLE_CONTENT_COMPRESSION=false
- oracle.adf.view.rich.libraryPartitioning.DISABLED=false
- oracle.adf.view.rich.LOGGER_LEVEL=false
- javax.faces.STATE_SAVING_METHOD=client
- oracle.adf.view.rich.versionString.HIDDEN=true
public static void gotoFlow(String flowName) {
FacesContext context = FacesContext.getCurrentInstance();
Application app = context.getApplication();
NavigationHandler handler = app.getNavigationHandler();
handler.handleNavigation(context, null, flowName);
}
//2. Util method to show error and Success Msg
public static void showMsg(String msgBody, String msgSeverity) {
FacesMessage fm = new FacesMessage(msgBody);
if (msgSeverity.equals("info")) {
fm.setSeverity(FacesMessage.SEVERITY_INFO);
} else if (msgSeverity.equals("warn")) {
fm.setSeverity(FacesMessage.SEVERITY_WARN);
} else if (msgSeverity.equals("error")) {
fm.setSeverity(FacesMessage.SEVERITY_ERROR);
} else {
fm.setSeverity(FacesMessage.SEVERITY_FATAL);
}
FacesContext fctx = FacesContext.getCurrentInstance();
fctx.addMessage(null, fm);
}
//3. Get Cookie value in ADF
public static String getCookieValue(String cookieName) {
FacesContext fctx = FacesContext.getCurrentInstance();
ExternalContext ectx = fctx.getExternalContext();
Map vRequestCookieMap = ectx.getRequestCookieMap();
Cookie cookie = (Cookie)vRequestCookieMap.get(cookieName);
if (cookie != null) {
return cookie.getValue();
}
return null;
}
//4. Load a jsp or jspx page (redirect to a page)
public static String loadPage(String pageName) {
FacesContext vFacesContext = FacesContext.getCurrentInstance();
ExternalContext vExternalContext = vFacesContext.getExternalContext();
ControllerContext controllerCtx = null;
controllerCtx = ControllerContext.getInstance();
String activityURL = controllerCtx.getGlobalViewActivityURL(pageName);
try {
vExternalContext.redirect(activityURL.substring(0,
activityURL.indexOf("?")));
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
//5. Initializing the ADFLogger private static ADFLogger _logger =
ADFLogger.createADFLogger(YourClassName.class);
//6. Clear the ADF table filter public static void removeFilter(RichTable tableBind,String processQueryName) {
FilterableQueryDescriptor queryDescriptor =
(FilterableQueryDescriptor)tableBind.getFilterModel();
if (queryDescriptor != null &&
queryDescriptor.getFilterCriteria() != null) {
queryDescriptor.getFilterCriteria().clear();
//processQueryName can found in queryListner of table eg:- #{bindings.Employee1Query.processQuery}
FacesUtils.invokeMethodExpression(processQueryName,
Object.class, QueryEvent.class,
new QueryEvent(tableBind,
queryDescriptor));
}
}
// 7.Implementing like type filter in ADF table filterpublic static void likeFilter(RichTable tableBind,String processQueryName) {
FilterableQueryDescriptor queryDescriptor =
(FilterableQueryDescriptor)tableBind.getFilterModel();
if (queryDescriptor != null &&
queryDescriptor.getFilterCriteria() != null) {
Map m=queryDescriptor.getFilterCriteria();
Set keys = m.keySet();
Map modified=new HashMap();
for (Iterator i = keys.iterator(); i.hasNext();) {
String key = (String) i.next();
String value = (String) m.get(key);
if(value!=null && !value.equals("")){
value="%"+value+"%";
}
modified.put(key,value);
System.out.println(key + " = " + value);
}
queryDescriptor.getFilterCriteria().clear();
FacesUtils.invokeMethodExpression(processQueryName,
Object.class, QueryEvent.class,
new QueryEvent(tableBind,
queryDescriptor));
queryDescriptor.setFilterCriteria(modified);
FacesUtils.invokeMethodExpression(processQueryName,
Object.class, QueryEvent.class,
new QueryEvent(tableBind,
queryDescriptor));
}
}
// 8. Launching / Invoking a PopUp from Bean. [popupBind is binding of popup inside the bean]RichPopup.PopupHints hints = new RichPopup.PopupHints();
popBind.show(hints);