Friday, October 31, 2014

link_new

http://www.banglanews24.com/beta/fullnews/bn/336578.html

Wednesday, October 29, 2014

Direct Print PDF file using pdfBox





import java.lang.reflect.Method; // add sohid
//import urldecode.url_encode;  // add sohid

import java.util.StringTokenizer;
import java.util.Properties;
import javax.print.PrintService;
import java.awt.print.PrinterJob;
import java.io.File;

import oracle.forms.engine.Main;
import oracle.forms.handler.IHandler;
import oracle.forms.properties.ID;
import oracle.forms.ui.VBean;

import org.apache.pdfbox.pdmodel.PDDocument;
//import org.apache.pdfbox.pdmodel.encryption.AccessPermission;

import java.net.URL;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.font.PDFont;
import org.apache.pdfbox.pdmodel.font.PDTrueTypeFont;
import org.apache.pdfbox.pdmodel.font.PDType0Font;




/*
 * @author                        : Shohidul islam( 23-may-2012 )
 *
 * Development Environment        : NetBean 6.8
 * Name of the File               : DirectPrint.java

 * This JavaBean is an attempt to eliminate the ORARRP client. Specificly in pos clients, as speed is main feature.
 * This JavaBean will allow a pdf from a full URL or a partial URL to be printed directly to the default or named printer
 * without a print dialog box.
 *
 */

 /**
  * A object that enables pdf files to be printed directly with no user intervention.
  */
public class DirectPrint extends VBean {
    //**********************
    // FORMS STATIC IDs
    //**********************

  
    /**
     *  DIRECT_PRINT_PDF_URL - This is the full URL to the pdf. This for a report server that is on another server.
     *
     *  Use this inplace of web.show_document(); in the PRINT_REPORT_OBJECT if the report server is not on the
     *  same server as the forms was launched.
     *
     * <p><b>Forms Example:</b></p>
     * <code>set_custom_property('BeanArea',1,'DIRECT_PRINT_PDF_URL','http://www.domain.com/test.pdf');</code>
     */
    protected static final ID pDirectPrintPDFURL = ID.registerProperty("DIRECT_PRINT_PDF_URL");
     /**
     *  SET_TTF_FROM_FS - Used to set a TrueType Font (TTF) from the filesystem. Ussualy a font that is not
     *  by default loaded into this class.
     *  Value: FontName[$]PATH
     *  Note: The FontName has to be the exact font name listed in the PDF document.
     *  The Path is C:\Windows\fonts\fontname.ttf.
     *  Use ListFont method to see the names in document if needed.
     *
     *  Note: All font set by URL and FS are loaded on each print job.
     *
     * <p><b>Forms Example:</b></p>
     * <code>set_custom_property('BeanArea',1,'SET_TTF_FROM_FS','fontname$full_path');</code>
     */
    protected static final ID pSetTTFFromFS = ID.registerProperty("SET_TTF_FROM_FS");
  
    /*
     * Variables
     */
  /**
   * Forms Handler.
   */
    private IHandler mHandler = null; // Forms Handler

  /**
   * Forms Main Class.
   */
    private Main formsMain = null; // Forms main class

 
  /**
   * Default Instance Name.
   */
    private String this_instance_name = this.getDefaultName();

  /**
   * The protocol when a URL is built.
   */
    private String protocol = null;

  /**
   * The domain when a URL is built.
   */
    private String domain = null;

  /**
   * The port when a URL is built, the default value is 80.
   */
    private int port = 80;

      // Using Fonts
  /**
   * The external fonts to load from filesystem.
   */
    private Properties extFSFonts = new Properties();
      /**
   * Named Printer - inited with the default printer
   */
      /**
   * Named Printer - inited with the default printer
   */
    private PrintService currentPrintService = PrinterJob.getPrinterJob().getPrintService();

  /**
   * Default Constructor.
   */
    public DirectPrint() {
    }

   /**
    * Default init.
    */
public final void init(IHandler handler) {
        mHandler = handler;
        super.init(handler);
       try {
            Method method = handler.getClass().getMethod("getApplet", new Class[0]);
            Object applet = method.invoke(handler, new Object[0]);
            if (applet instanceof Main) {
                formsMain = (Main) applet;
            }
           
        } catch (Exception ex) {
            System.out.println("Exception init: " + ex.getMessage());
        }
     loadDefaultFSFonts(); // for load font
    }

    //*******************************
    //* SET FORMS PROPERTIES
    //*******************************
  /**
   * Uses to set properties of the ID object.
   * @return The status of the set property
   * @param _args Value passed in from the forms bean call.
   * @param _ID The ID of the parameter that was called.
   */
    public boolean setProperty(ID _ID, Object _args) {
   
        /*=====================
         * DIRECT_PRINT_PDF_URL
         *=====================*/
        if (_ID == pDirectPrintPDFURL) {
            //check that argument is not null
            if ((_args != null)) {
                try {
                   //System.out.println("DIRECT_PRINT_PDF_URL: " + (String) _args);
                   //write_message("DIRECT_PRINT_PDF_URL: " + (String) _args);
                    //printPDFURL((String) _args);
     //               sendPDFURLToPrinter((String)_args);
                } catch (Exception ex) {
                   System.out.println("Exception: " + ex.getMessage());
                }
            }

            return true;
        }

        /*=========================
         * SET_TTF_FROM_FS
         * ========================*/
        if (_ID == pSetTTFFromFS) {
            if ((_args != null) && (((String) _args).length() != 0)) {
              System.out.println("SET_TTF_FROM_FS: " + (String) _args);
              this.setFSFontProperty((String) _args);
            } else {
                // not valid argument was passed, print message to console
                System.out.println("Call to SET_TTF_FROM_FS can not be a null argument.");
            }
            return true;
        }
        return super.setProperty(_ID, _args);
    }


  /**
   * This prints the URL to the currently set default printer.
   * @param pdfURLStr Full URL to the PDF to print.
   */
    private void sendPDFURLToPrinter() {

        PDDocument document;

        try {
           // URL pdfFile = new URL(pdfURLStr); // comment by sohid because blank URL can not read
            //URL pdfFile = new URL(pdfURLStr.replaceAll(" ", "%20"));
             String pdfFile="E:\\green.pdf";
            //write_message("Printing URL: " + pdfURLStr);
              System.out.println(pdfFile.toString());  //sohid
              document = PDDocument.load(pdfFile);

           //   PDFont currFont = PDTrueTypeFont.loadTTF(document, new File("C:/WINDOWS/Fonts/" + "CarolinaBar-B39-25F2.ttf"));
           
             
         List pages = document.getDocumentCatalog().getAllPages();

            // load fonts here iterate over pages
            if (pages.isEmpty()) {
//                write_message("Pages list is empty");
                System.out.println("Pages list is empty");  //sohid
            } else {
                // System.out.println("sohid Pages list is NOT empty");  //sohid
                Iterator it = pages.iterator();

                while (it.hasNext()) {
                   PDPage currentPage = (PDPage)it.next();
                   Map map = currentPage.findResources().getFonts();
                   // System.out.println(" Sohid Map is: "+map.toString());  //sohid
                   Set mySet = map.keySet();
                 
                   Iterator setInt = mySet.iterator();

                    while (setInt.hasNext()) {

                        String val = (String)setInt.next();
                      // System.out.println("Sohid Map Val: "+ val);  //sohid
                       PDType0Font pdt = (PDType0Font)map.get(val);
                      // System.out.println("My Font is = " + pdt.getFontDescriptor().getFontName()); //sohid
                  //     PDFont currFont = this.loadFontByName(document,pdt.getFontDescriptor().getFontName(),val);//pdt.getFontDescriptor().getFontName()
                        PDFont currFont = PDTrueTypeFont.loadTTF(document, new File("C:/WINDOWS/Fonts/" + "arial.ttf"));
                      
                        if(currFont != null)
                        {
                          currentPage.findResources().getFonts().put(val,currFont);
                        }
                     
                    }
                }
            }



          //  AccessPermission currentPermissions = document.getCurrentAccessPermission();

//            if (!currentPermissions.canPrint()) {
//               System.out.println("Permission denied to print document.");
//            }
//         

            PrinterJob printJob = PrinterJob.getPrinterJob();
            printJob.setPrintService(currentPrintService);
            printJob.setPageable(document);

            printJob.print();
            // Close document
             document.close();

        } catch (Exception ex) {
//            write_message(ex.getMessage());
             System.out.println(ex.getMessage());
        }

    }
   private void setFSFontProperty(String fontNameDelimLocation)
    {
      StringTokenizer st = new StringTokenizer(fontNameDelimLocation,"$");
      String fontName = st.nextToken();
      String fontLocation = st.nextToken();

      // check that font name does not already exist
      if(extFSFonts.getProperty(fontName) == null )
      {
        extFSFonts.setProperty(fontName,fontLocation);
       System.out.println("extFSFonts added: "+fontName);
      }
      else
      {
        System.out.println("extFSFonts already set: "+fontName);
      }

    }
    private  void loadDefaultFSFonts()
    {
      // Example: extFSFonts.setProperty(fontName,fontLocation);
       //extFSFonts.setProperty("CarolinaBar-B39-25F2-Normal.ttf","C:\\WINDOWS\\Fonts\\");
        extFSFonts.setProperty("CarolinaBar-B39-25F2.ttf","C:\\WINDOWS\\Fonts\\");
        //"C:/WINDOWS/Fonts/" + "CarolinaBar-B39-25F2-Normal.ttf"
    }
  
    public static void main(String args[]) {
        DirectPrint dr = new DirectPrint();
        dr.sendPDFURLToPrinter();
        System.out.println("ashduashdja");
    }
  
  }





Saturday, September 20, 2014

অংকে মাথা নেই! মায়ের দোষ!


অংকে মাথা নেই! মায়ের দোষ!
( http://www.banglanews24.com/beta/fullnews/bn/325676.html )
ফিচার ডেস্ক
বাংলানিউজটোয়েন্টিফোর.কম

    
অংকে মাথা নেই বলে ভোলানাথরা কতই না মার খেয়েছে মায়েদের হাতে। চোখ রাঙানি তো বটেই, কঞ্চির পিটুনি, কানমলা, চড়-থাপ্পড়ও জুটেছে ম্যালা। কিন্তু এবার বুঝি থামবেন মায়েরা। ছেলেটি বা মেয়েটি যে অংকে কাঁচা সে জন্য দায় যে তারই।  খাতা কলম নিয়ে শত কসরতে অংক কষে যারা মেলাতে পারে না, তারা নিজেরা সে জন্য দায়ী নয়, ও দায় মায়ের। কারণ গবেষকরা দেখেছেন সন্তানটি যখন গর্ভে তখনই নির্ধারিত হয়ে যায় তার অংকের মেধা। গবেষকরা বলছেন, অন্তঃসত্বা মায়ের হরমোনের মাত্রা থেকে নির্ধারণ হয় সন্তান তার পাঁচ বছর বয়সে কতটুকু অংক কষতে পারবে।

যে সন্তানটির মায়ের গর্ভাবস্থায় হরমোন থাইরোক্সাইনের মাত্রা খুব কম থাকে তাদের অংকের মেধা কম হওয়ার সম্ভাবনা অন্যদের চেয়ে মোটামুটি দ্বিগুন।

গর্ভাশয়েই মায়ের শরীর থেকে হরমোন থাইরোক্সাইন শিশুর শরীরে যায়। মস্তিষ্কের উন্নয়নের জন্য এই হরমোনের ভূমিকা অপরিমেয়। কিন্তু অনেক সন্তানসম্ভবার শরীরে এই হরমোনের পরিমান খুবই কম থাকে।

গবেষক মার্টিজন ফিনকেন ১২০০ শিশুকে গবেষণার আওতায় নিয়ে দীর্ঘ পরীক্ষা-নিরীক্ষা চালিয়ে এ সিদ্ধান্তে উপনীত হয়েছেন। গর্ভাশয়ে থাকা অবস্থা থেকে শুরু করে জন্মগ্রহণ এবং পরে স্কুলে যাওয়া পর্যন্ত প্রতিটি শিশুর ওপর এই গবেষণা চলে। 

গর্ভাবস্থায় মায়েদের থাইরোক্সাইনের মাত্রা টানা ১২ সপ্তাহ নিয়মিত পরিমাপ করেন এই গবেষক। আর পরে তাদের জন্ম নেওয়া সন্তানদের পাঁচ বছর বয়সে অংক আর ভাষা জ্ঞানের ওপর পরীক্ষা নেন। তাতেই বের হয়ে আসে এই তথ্য।

যে মায়েদের শরীরে থাইরোক্সাইনের মাত্রা কম ছিলো তাদের সন্তানদের ৯০ শতাংশই অংক ক্লাসে পেছনে পড়ে থাকছে।

শিশুর পারিবারিক শিক্ষা, স্বাস্থ্য এসব কিছু বিবেচনায় নিলেও বিষয়টি সত্যি থেকে যাচ্ছে।

তবে আশ্চর্যজনক হচ্ছে হরমোনের এই মাত্রা শিশুর ভাষাজ্ঞান ও তার ভোকাবুলারির জন্য আবার প্রযোজ্য থাকছে না।

ড. ফিনকেন বললেন, এটা হতে পারে আমরা যে পরিবেশে আছি তার ভিত্তিতেই আমাদের ভাষা-দক্ষতা তৈরি হয়। আর অন্যদিকে অংকের মেধা অনেকাংশেই মস্তিষ্কের গঠনের ওপর নির্ভরশীল।

গবেষক ফিনকেন নিজেও একজন শিশু চিকিৎসা বিশেষজ্ঞ। আমাস্টারডামের ভিইউ বিশ্ববিদ্যালয়ের মেডিকেল সেন্টারে কর্মরত। জানালেন, এই শিশুরা যখন তাদের স্কুল জীবন চালিয়ে যাবে তখনও এই গবেষণার আওতায় থাকবে।

এই সমস্যা প্রাপ্ত বয়স পর্যন্তও থেকে যায় কি-না সেটি দেখার জন্যই এই প্রচেষ্টা অব্যাহত থাকবে, বলেন ড. ফিনকেন।

তিনি বলেন, বিষয়টির সবচেয়ে সহজ সমাধানই হচ্ছে গভাবস্থায় মায়ের শরীরের হরমোন পরীক্ষা করে দেখা এবং কম হলে তার শরীরে প্রয়োজনীয় মাত্রায় হরমোন দেওয়া।

এতে হয়তো জন্ম নেবে অংকে মেধাবী শিশুরা। ফলে মায়ের হাতের চুল টানা খেয়ে মাথা ডলতে ডলতে, চোখের পানিতে আর অংক কষতে হবেনা শিশুদের।    

বাংলাদেশ সময় ১১২৪ ঘণ্টা, সেপ্টেম্বর ২০, ২০১৪
- See more at: http://www.banglanews24.com/beta/fullnews/bn/325676.html#sthash.NiR2YoQx.dpuf

Wednesday, September 17, 2014

Orange control heart beat and blood pressure and সহজে খোসা ছাড়িয়ে নিতে পারবেন


http://www.priyo.com/2014/09/17/106864.html


হার্টবিট ব্লাডপ্রেশার নিয়ন্ত্রণেঃ
কমলায় থাকা প্রচুর পরিমাণ মিনারেল হার্টবিটের মাত্রা ঠিক রাখে। পটাশিয়াম ক্যালসিয়াম দেহের রক্তচাপ নিয়ন্ত্রণে রাখতে সহায়তা করে। কমলায় থাকা সোডিয়াম, কোলস্টেরল ফ্যাট বিহীন আঁশ হৃৎপিণ্ডকে ভালো রাখতে সাহায্য করে



http://www.priyo.com/2014/09/17/106904.html
রসুনের কোয়ার ওপর সামান্য তেল ঘষে রোদে শুকনো করে নিন সহজে রসুনের খোসা ছাড়িয়ে নিতে পারবেন এছাড়া যেদিন রান্নায় রসুন ব্যবহার করবেন তার একদিন আগে রসুনের কোয়া আলাদা করে বোতলে ভরে ফ্রিজে রাখুন পরের দিন সহজে খোসা ছাড়িয়ে নিতে পারবেন 
 

৫। হার্টবিট ও ব্লাডপ্রেশার নিয়ন্ত্রণেঃ

কমলায় থাকা প্রচুর পরিমাণ মিনারেল হার্টবিটের মাত্রা ঠিক রাখে। পটাশিয়াম ও ক্যালসিয়াম দেহের রক্তচাপ নিয়ন্ত্রণে রাখতে সহায়তা করে। কমলায় থাকা সোডিয়াম, কোলস্টেরল ও ফ্যাট বিহীন আঁশ হৃৎপিণ্ডকে ভালো রাখতে সাহায্য করে।
- See more at: http://www.priyo.com/2014/09/17/106864.html#sthash.cbywURB4.dpuf


৫। হার্টবিট ও ব্লাডপ্রেশার নিয়ন্ত্রণেঃ

কমলায় থাকা প্রচুর পরিমাণ মিনারেল হার্টবিটের মাত্রা ঠিক রাখে। পটাশিয়াম ও ক্যালসিয়াম দেহের রক্তচাপ নিয়ন্ত্রণে রাখতে সহায়তা করে। কমলায় থাকা সোডিয়াম, কোলস্টেরল ও ফ্যাট বিহীন আঁশ হৃৎপিণ্ডকে ভালো রাখতে সাহায্য করে।
- See more at: http://www.priyo.com/2014/09/17/106864.html#sthash.cbywURB4.dpuf
৫। হার্টবিট ও ব্লাডপ্রেশার নিয়ন্ত্রণেঃ

Saturday, September 13, 2014

value get for delete using script MUST follow with QUERY-

Using script :


<!-- Do Delete -->
<script language="JavaScript">
function doDeleteData(primaryKey) {
    alert("Delete1");
window.location = "adminTcDoDeleteLoad.do?primaryKey="+primaryKey;

alert("Delete2");


}
</script>





jsp page:

<% int k=0; %>
 <s:iterator value="teacherTypeList" status="status">
  <%  k+=1;%>
<tr  >
  <td width="2%"><s:property value='#status.count'/></td>
  <td width="2%"><s:property value='tech_general_info_id'/></td>
  <td   width="4%" style="text-align:left;"><s:property value='tech_name'/></td>
  <td id="recordId<%=k %>" width="15%"><s:property value='desig_id'/></td>
  <td width="2%">&nbsp;</td>
  <td width="4%">&nbsp;</td>
  <td >&nbsp;</td>
  <td width="15%">
  <span><a href="adminTcEditLadmin.do">Edit</a></span>
  <span><a href="#">Delete</a></span>
  </td>
  <td ><a href="#" onclick="doEditData('recordId<%=k %>','<s:property value='tech_general_info_id'/>','<s:property value='tech_name'/>','<s:property value='desig_id'/>');" style="font-family:Arial; font-size:12px; font-weight:bold; color:#000;">DoEdit</a></td>
<td ><a href="#" onclick="doDeleteData('<s:property value='tech_general_info_id'/>');" >DoDelete</a></td>
</tr>
 </s:iterator>



java action class :

//Do Delete   
    private String primaryKey;
    public String adminTcDoDelete(){
       
        TeacherListSql teacherListSql = new TeacherListSql();
        teacherListSql.getDeleteTable(primaryKey);
        teacherList();
        return "adminTcDoDelete";       
    }




sql class file:



  //Delete statement
     
      public void getDeleteTable(String priId){
          System.out.println("kaniz");
          boolean fg = true;
          con = dbc.connectDB();

           if (con == null) {
               fg = false;
           }
       
      if (fg) {
       try {

              st = con.createStatement();
     
     //query = "insert into fn_bank(BANK_ID,BANK_NAME,ENTRY_TIMESTAMP,COMPANY_NO) values ('"+bank_id+"','"+bankName+"',sysdate,'1')";
   
//queryUpdate = "update tech_general_info set TECH_NAME = '"+teacherName+"',DESIGNATION_NAME = '"+teacherDesig+"' where TECH_GENERAL_INFO_ID='"+teachGeneralId+"'";
String queryDelete = "delete from tech_general_info  where TECH_GENERAL_INFO_ID='"+priId+"'";

     System.out.println("QueryDelete" + queryDelete);
      //st.execute(query);//It is use for insert Query
      st.execute(queryDelete);
     

   


      } catch (SQLException sq) {        
        sq.printStackTrace();
      } finally {
        try {
            if (rs != null) {
                rs.close();
            }
       
            con.close();
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
      }
      }
   
              //return "getBankInfoPageReturn";  //Remember DELETE query not Return;.Only select query return List.
          }


value get for edit using script MUST follow with QUERY-


Script :

<script language="JavaScript">
function submitData(teachGeneralId,tName,tDesig) {
    alert(teachGeneralId);
   
    teacherName = document.getElementById(tName).value;    // must get this way
    alert(teacherName);
   
    teacherDesig = document.getElementById(tDesig).value;
  // must get this way   
    alert(teacherDesig);

   
window.location = "recallTeachListPageLoad.do?teachGeneralId="+teachGeneralId+"&teacherName="+teacherName+"&teacherDesig="+teacherDesig;


alert("S2");


}
</script>


jsp page:

<div style="float:left; height:auto; width:800px;">
<table style="width:500px; height:auto;">
  <tr>
    <td>&nbsp;</td>
    <td><input style="height:26px;" class="form-control input-sm" id="" name="" type="text" value="<s:property value='teachGeneralId'/>"/></td>
  </tr>
  <tr>
    <td width="159">Teacher Name :</td>
    <td width="329"><input style="height:26px;" class="form-control input-sm" id="tName" name="" type="text" value="<s:property value='teacherName'/>"/></td>
  </tr>
  <tr>
    <td>Designation Id/Name :</td>
    <td><input style="height:26px;" class="form-control input-sm" id="tDesig" name="" type="text" value="<s:property value='teacherDesig'/>"/></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
   <td>&nbsp;</td>
   <td><input id="Input" name="Input" type="button"  value="EditORupdate" onClick="submitData('<s:property value='teachGeneralId'/>','tName','tDesig');"/></td>
  </tr>
</table>
</div>


java action class:


    private String eachTeacherVal;
    private String teachGeneralId;
    private String teacherName;
    private String teacherDesig;

   
    //teachGeneralId //No need 2nd time declare  
    //teacherName  //No need 2nd time declare  
    //eachTeacherVal //No need 2nd time declare 
   
    //Do Edit
    public String recallTeachListPage(){
       
       
        TeacherListSql teacherListSql = new TeacherListSql();
        teacherListSql.getUpdateTable(teachGeneralId,teacherName);
        teacherList();
        return "recallTeachListPage";       
    }
       




SQL file:

//Update statement
      public void getUpdateTable(String teachGeneralId,String teacherName){
          System.out.println("kaniz");
          boolean fg = true;
          con = dbc.connectDB();

           if (con == null) {
               fg = false;
           }
       
      if (fg) {
       try {

              st = con.createStatement();
     
     //query = "insert into fn_bank(BANK_ID,BANK_NAME,ENTRY_TIMESTAMP,COMPANY_NO) values ('"+bank_id+"','"+bankName+"',sysdate,'1')";
   
//queryUpdate = "update tech_general_info set TECH_NAME = '"+teacherName+"',DESIGNATION_NAME = '"+teacherDesig+"' where TECH_GENERAL_INFO_ID='"+teachGeneralId+"'";
queryUpdate = "update tech_general_info set TECH_NAME = '"+teacherName+"' where TECH_GENERAL_INFO_ID='"+teachGeneralId+"'";

     System.out.println("QueryUpdate" + queryUpdate);
      //st.execute(query);//It is use for insertQuery
      st.executeUpdate(queryUpdate);
     

   


      } catch (SQLException sq) {        
        sq.printStackTrace();
      } finally {
        try {
            if (rs != null) {
                rs.close();
            }
       
            con.close();
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
      }
      }
   
              //return "getBankInfoPageReturn";  //Remember insert query not Return;.Only select query return List.
          }