Skip to main content

Posts

Showing posts from 2016

IOS Swift2 push view up when showing keyboard and prevent black screen while navigating inside keyboard panel

override func viewDidLoad() {         super.viewDidLoad()         NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(self.keyboardWillShow), name: UIKeyboardWillShowNotification, object: nil)         NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(self.keyboardWillHide), name: UIKeyboardWillHideNotification, object: nil)     }     func keyboardWillShow(notification: NSNotification) {         if let keyboardSize = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.CGRectValue() { // below condition will prevent black screen             if self.view.frame.origin.y >= 0{                self.view.frame.origin.y -= keyboardSize.height             }         }     }     func keyboardWillHide(notification: NSNotification) {         if let keyboardSize = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.CGRectValue() {             self.view.frame.origin.y += keyboardSize.heigh

Liferay JSF pdf downloading from stream best practice

    in  the java class public StreamedContent getPdfFile() throws Exception { FacesContext facesContext = FacesContext.getCurrentInstance();    PortletResponse portletResponse= (PortletResponse)facesContext.getExternalContext().getResponse();    ResourceResponse portletResourceResponse = (ResourceResponse) portletResponse;    portletResourceResponse.setContentType("application/pdf"); /*the following line is very important */    portletResourceResponse.flushBuffer();    OutputStream out = portletResourceResponse.getPortletOutputStream();    out.write(PdfGenerator.pdfFromHtmlContent(content);    out.flush();    facesContext.responseComplete(); return null } --------------------------------------------------------------------------------------------------------- in the xhtml page <p:commandButton value="download PDF" ajax="false">    <p:fileDownload value="#{ph.pdfFile}" /> </p:

itext 2.7.1 writing Arabic and English content in a PDF file

   public void createPdf(String filename) throws IOException, DocumentException {               Document document = new Document();           PdfWriter.getInstance(document, new FileOutputStream(filename));             document.open();             document.add(Chunk.NEWLINE);        FontFactory.register("c:/windows/fonts/tradbdo.ttf", "my_arabic");               Font myArabicFont = FontFactory.getFont("my_arabic" ,BaseFont.IDENTITY_H, BaseFont.EMBEDDED);         PdfPTable table = new PdfPTable(1);         table.getDefaultCell().setNoWrap(false);        // table.setRunDirection(PdfWriter.RUN_DIRECTION_RTL);         PdfPCell text = new PdfPCell(new Phrase("محمود السنباطيthis is أبتثجحخدرزسشصضطظعغفقكلمنهوى", myArabicFont));         text.setRunDirection(PdfWriter.RUN_DIRECTION_RTL);          text.setNoWrap(false);          table.addCell(text);     //Add the table to the document         document.add(table);                  

Installing liferay 6.2 on wildfly 10 app server and oracle 11g database & windows machine

*************************************DATABASE CREATION*********************************************************************************************** DOWNLOAD LIFERAY PORTAL SCRIPTS FROM https://www.liferay.com/downloads/liferay-portal/available-releases Rename the file as liferay.sql put it let say in under c drive , so it will be located like this  c:\liferay.sql from cmd dir c:\ SQLPLUS / AS SYSDBA @liferay.sql lportal lportal it will create the db ..after finishing go to sqlplus again to ggrant the below  to lportal user SQLPLUS / AS SYSDBA grant create session to lportal; grant connect to lportal; grant resource to lportal; *******************************CONFIGURE WILDFLY TO CONNECT TO ORACLE DB *****************************************************************************************************  configure wildfly to connect to oracle db Download the driver: ojdbc[VERSION].jar Create subfolders [WILDFLY_HOME]/modules/system/layers/base/com/oracle/main/ C

liferay jsf primefaces exporter issue

1-download this lib liferay-faces-1513-patch-3.2.4-ga5.jar from the below link http://search.maven.org/#search|gav|1|g%3A%22com.liferay.faces.patches%22%20AND%20a%3A%22liferay-faces-1513-patch%22 2- add it to the portlet class path 3- in your xhtml file  make sure that the exporter tag is included in a separate form to avoid destroying portal layout 

liferay primefaces dialog not working

in my case it was not working as there was a conflict with Jquery library which i imported it in the theme so to resolve this conflict  just add this in the portelt header <h:head> <script type='text/javascript'>                       var $jq = jQuery.noConflict(true);          </script> </h:head>

JQUERY MOBILE 1.4.5 popup issue resolving

   add this script before the jquery.mobile-1.4.5.min.js   <script src="resources/js/jquery-2.1.4.min.js"></script>         <script type="text/javascript">             $(document).bind("mobileinit", function(){             $.mobile.hashListeningEnabled = false;             });         </script>           <script src="resources/js/jquery.mobile-1.4.5.min.js"></script>