Skip to main content

Posts

Showing posts from 2017

liferay service connects to external oracle database

1- configure service.xml 2- create ext-spring.xml 3-create the oracle  table and sequesnce 4- build the service 1-service.xml  note that we add <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.2.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_2_0.dtd"> <service-builder package-path="com.dash.hr.forms"> <author>melsonbati</author> <namespace>SAMPLE</namespace> <entity name="Coupon"  table="HR_COUPON" local-service="true" remote-service="true" data-source="tcsDS" session-factory="testSessionFactory" tx-manager="testTransactionManager"> <!-- PK fields --> <column name="couponId" type="long" primary="true"  id-type="sequence" id-param="id_sequence_cp"  /> <

script to recursively convert word docs to pdfs

prerequisites:  you have to have ms office with the version which lets you save docs as pdf    two steps   first create this script file to use ms office plugin  and name it as conv.js var fso = new ActiveXObject("Scripting.FileSystemObject"); var docPath = WScript.Arguments(0); docPath = fso.GetAbsolutePathName(docPath); var pdfPath = docPath.replace(/\.doc[^.]*$/, ".pdf"); var objWord = null; try {     WScript.Echo("Saving '" + docPath + "' as '" + pdfPath + "'...");     objWord = new ActiveXObject("Word.Application");     objWord.Visible = false;     var objDoc = objWord.Documents.Open(docPath);     var wdFormatPdf = 17;     objDoc.SaveAs(pdfPath, wdFormatPdf);     objDoc.Close();     WScript.Echo("Done."); } finally {     if (objWord != null)     {         objWord.Quit();     } } then run this powershell command Get-ChildItem -rec | Where-object {!$_.psIsC

LIFERAY PORTAL FORCE BROWSER TO ATTACH THE PDF INSTEAD OF AUTO OPEN IT

public StreamedContent getAttachment(){           portletResourceResponse.setContentType("application/pdf");  //application/pdf   portletResourceResponse.setProperty("Content-Disposition", "attachment");     try{  portletResourceResponse.flushBuffer(); OutputStream out =                portletResourceResponse.getPortletOutputStream();  out.write(------);  out.flush();  facesContext.responseComplete();  out.close();  }catch(Exception e) {     e.printStackTrace(); }  return null;  }