Friday, April 10, 2015

Remove Windows 7 Shortcut Icon Arrow Overlay

following below URL,
http://www.computerperformance.co.uk/windows7/windows7_registry_remove_shortcut.htm

Using GIMP create a sphere and as background of icon

run GIMP, create a new image, set size, the windows icon size is 256*256.

click Filters->Render->Sphere designer, choice the color of the sphere, then click save.

add text on the sphere by using text tool.

Monday, July 28, 2014

serve .jnlp from IIS

on the server, click 'MIME types', add .jnlp,  type: application/x-java-jnlp-file.
stop and start server.

Thursday, March 06, 2014

Eclipse projects share Jar files handle

previously, I put Jar used for each project in project's Webcontent/WEB_INF/lib directory, there are Jars used for many project, and they are put in many place.

to prevent it, I created a user library, put the common used Jar file into it.

then in project properties, 'Java build path' to include the user library.
'Deployment and Assembly' screen, click 'Add' button, then select 'Java Build Path entries', then add the user library.

Wednesday, June 12, 2013

Windows 8 Development PC setup

I buy a Dell XPS 8700 recently as development PC. it come with windows 8, and I upgrade it to windows 8 Pro+MC.

1. install java sdk.

2. install mysql.
    running ' mysql-installer-community-5.6.12.0'. there is a bug in workbench, we need copy mysqldump.exe from
C:\Program Files\MySQL\MySQL Server 5.6\bin
to
C:\Program Files (x86)\MySQL\MySQL Workbench CE 5.2.47.

3. install Apache Tomcat
    running apache-tomcat-7.0.41.exe.
    download connector.
    in IIS manger,
    1.1. under 'Default Web Site', add a virtual directory call 'jakarta'. physical path is "C:\Program Files\Apache Software Foundation\Jakarta Isapi Redirector\bin"

    1.2 at the top level (local host), click 'Handler map', enable 'ISAPI_dll' by right click it, then click 'Edit permission', select 'execute'.
    1.3 click 'ISAPI filters', add new filter call 'jakarta'.
1.4 click 'ISAPI and CGI restriction', click 'Edit Feature settings", select 'allow unspecified ISAPI module"

if see error http 500.19, see below link to solve it.
http://serverfault.com/questions/410147/iis-7-5-and-tomcat-setup-error-500-19


   

Monday, September 19, 2011

Using Java, iText fill Abode LiveCycle Designer Form

my project need get data from database and fill PDF Form created by using Adobe LiveCycle designer ES2.

I do it by following step.

1. first, create a XML schema, which contains all the field used in the form.
2. open Adobe LiveCycle, click 'file', then select 'New...', and follow screen instruction to create a new form.
3. click 'File', then click 'New Data Connection...', then give it a name, and choice 'XML Schema', then following screen instruction to import the XML schema.
4. You can drag the data tree from the Data View panel to form. form consists of fields that are organized in subforms, click subforms, select 'Object', then click 'Subform' tab, set 'Content' to 'Flow', and check 'Allow page break'.

5. then select 'request' in data panel, then select 'Object' , then click 'Subform' tab, set 'Content' to 'Position', and check 'Allow page break'.

6. arrange all the fields as you need. save the PDF form.

to get data and fill form, we use Java language and iText API.

1. we get data from data and write to a XML file, the xml file should follow the schema.

 DocumentBuilderFactory domFactory = DocumentBuilderFactory
     .newInstance();
   DocumentBuilder domBuilder = domFactory.newDocumentBuilder();

   Document newDoc = domBuilder.newDocument();
   Element rootElement = newDoc.createElement("requests");
   newDoc.appendChild(rootElement);


...add other element.....  

 // write to file
   TransformerFactory tranFactory = TransformerFactory.newInstance();
   Transformer aTransformer = tranFactory.newTransformer();
   Source src = new DOMSource(newDoc);
   Result dest = new StreamResult(new File(destname));
   aTransformer.transform(src, dest);


2. using iText to fill form.
// src is the PDF form name,
// xml is the xml file name created last step,
// dest is the output PDF file name

public   void manipulatePdf(String src, String xml, String dest)
   throws IOException, DocumentException {
   PdfReader reader = new PdfReader(src);
   PdfStamper stamper =
   new PdfStamper(reader, new FileOutputStream(dest));
   AcroFields form = stamper.getAcroFields();
   XfaForm xfa = form.getXfa();
   xfa.fillXfaForm(new FileInputStream(xml));
   stamper.close();
   }



other things,

1. as we don't want user fill the form, I set all the field in the PDF form to 'Read only', to do it, in LiveCycle, select the field, click 'Object', then click 'Value', then select 'Read only' as type.







 

Thursday, August 19, 2010

EXCEL VBA for Copy, Position and Resize Picture

For catalogue program in excel, usually need process pictures.

Following excel VBA procedure is a useful example to do the job as copy picture from other sheet, position and resize it.

Public Sub s()

Dim oPic As Picture

Sheets("Sheet2").Select

'delete picture is it existed in target sheet

On Error GoTo errorhandling

Sheet2.Pictures("Phont_123").Delete

On Error GoTo 0 ' resume

errorhandling:

For Each oPic In Sheet1.Pictures
If (oPic.Name = "photo_1234567890") Then
Sheet1.Shapes(oPic.Name).Copy
Sheet2.Range("C3").PasteSpecial
Selection.Name = "Phont_123"
Dim p As Picture
Set p = Sheet2.Pictures("Phont_123")
' position picture base on cell C3's position
With Range("c3")
t = .Height
l = .Left
End With
' resize picture, this example fixed the height as 200,
With p
oh = .Height
ow = .Width
.Top = t
.Left = l
.Width = ow * 200 / oh
.Height = 200
.Placement = xlMoveAndSize
.PrintObject = True
End With
End If
Next oPic
End Sub

Monday, March 22, 2010

MOVEX workplace using IE8

  1. Set IE8 to Compatibility View for Movex workplace site by click 'Tools', then click 'Compatibility View Settings', then add website.
  2. Create shortcut for workplace login, the program is "C:\Program Files\Internet Explorer\iexplore.exe" –nomerge. the '–nomerge' parameter solve the IE8 session merge problem, please see following url for details.

    http://blogs.msdn.com/ie/archive/2009/05/06/session-cookies-sessionstorage-and-ie8.aspx