Browsing the archives for the technical category.

Viliv S5 Unboxing

technical

Finally the S5 has arrived! I was lucky enough to get the first batch from Dynamism. My choice on an Atom portable bottomed down to a choice between the Sony Vaio P (which I got my hands on at the CES 2009 earlier in the year) or the Viliv S5. Netbook vs Umpc. I missed my old Samsung q1 and the subsequent replacement to the Asus R2H left a very bad impression in the future of UMPCs. Regardless, my choice was for the Viliv S5. a smaller UMPC with haptic feedback. First thing off, I will backup the existing OS and replace it with Windows 7 RC. As well, I will attempt to install a Hackintosh build.

No Comments

Microsoft Exchange Server 2010 Beta is available for download

technical

The switch from Exchange 2003 to Exchange 2007 wasn’t compelling. Complete re-write to only 64bit architecture only, and higher system requirements particularly in the memory. Hopefully Exchange 2010 will offer smaller footprint and performance improvements to warrant an upgrade. One of the first things I will do is to test if Exchange 2010 performs well within VMware or Virtual Server.

http://www.microsoft.com/exchange/2010/en/us/trial-software.aspx

No Comments

ATSC in Vancouver with Windows 7

technical

CBC Vancouver
CBUT-DT
Digital Channel 2-1
Assigned Frequency 58

GLOBAL BC
CHAN-DT
Digital Channel 8-1
Assigned Frequency 22

CTV BC
CITV-DT
Digital Channel 32-1
Assigned Frequency 33

No Comments

Dynamic PDF Generation with Cocoon 2.2.0

technical

A couple of things are different from using cocoon 2.1 to cocoon 2.2. Compiling and rendering to a war file for use on tomcat is all done through maven2. The following is a summary that I have gone through and confirmed working as of the time of writing.

apt-get install maven2

mvn archetype:generate -DarchetypeCatalog=http://cocoon.apache.org

Define value for groupId: : local.cocoon
Define value for artifactId: : myBlock1
Define value for version:  1.0-SNAPSHOT: : 1.0.0
Define value for package: : local.cocoon.myBlock1

cd myBlock1

mvn jetty:run

http://192.168.0.1:8888/myBlock1

vim src/main/resources/COB-INF/sitemap.xmap

throw the following inside the pipline tags

      <map:match pattern="myFile.xml">
        <map:generate src="myXmlFile.xml" type="file"/>
        <map:serialize type="xml"/>
      </map:match>
      <map:match pattern="myFile.html">
        <map:generate src="myXmlFile.xml" type="file"/>
        <map:transform src="myHtmlFile.xslt" type="xslt"/>
        <map:serialize type="html"/>
      </map:match>
      <map:match pattern="myFile.pdf">
        <map:generate src="myXmlFile.xml" type="file"/>
        <map:transform src="myPdfFile.xslt" type="xslt"/>
        <map:serialize type="fo2pdf"/>
      </map:match>

create myXmlFile.xml in the same folder as sitemap

vim src/main/resources/COB-INF/myXmlFile.xml

<?xml version="1.0" encoding="UTF-8"?>
<content>test</content>

create myHtmlFile.xslt in the same folder as sitemap

vim src/main/resources/COB-INF/myHtmlFile.xslt

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <html>
      <head>
        <title>My second XML Pipeline</title>
      </head>
      <body>
        My second XML Pipeline:
        <xsl:value-of select="/content"/>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

create myPdfFile.xslt in the same folder as sitemap

vim src/main/resources/COB-INF/myPdfFile.xslt

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:fo="http://www.w3.org/1999/XSL/Format">

  <xsl:template match="/">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <fo:layout-master-set>
        <fo:simple-page-master master-name="page"
          page-height="29.7cm"
          page-width="21cm"
          margin-top="1cm"
          margin-bottom="2cm"
          margin-left="2.5cm"
          margin-right="2.5cm">
          <fo:region-before extent="3cm"/>
          <fo:region-body margin-top="3cm"/>
          <fo:region-after extent="1.5cm"/>
        </fo:simple-page-master>

        <fo:page-sequence-master master-name="all">
          <fo:repeatable-page-master-alternatives>
            <fo:conditional-page-master-reference
             master-reference="page" page-position="first"/>
          </fo:repeatable-page-master-alternatives>
        </fo:page-sequence-master>
      </fo:layout-master-set>

      <fo:page-sequence master-reference="all">
        <fo:static-content flow-name="xsl-region-after">
          <fo:block text-align="center"
            font-size="10pt"
            font-family="serif"
            line-height="14pt">page <fo:page-number/></fo:block>
        </fo:static-content>

        <fo:flow flow-name="xsl-region-body">
          <fo:block font-size="36pt" space-before.optimum="24pt"
           text-align="center">
             My second XML Pipeline
          </fo:block>
          <fo:block font-size="12pt" space-before.optimum="12pt"
           text-align="center">
           <xsl:value-of select="/content"/>
          </fo:block>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
  </xsl:template>
</xsl:stylesheet>

edit pom.xml to include FOP
vim pom.xml

    <dependency>
      <groupId>org.apache.cocoon</groupId>
      <artifactId>cocoon-fop-impl</artifactId>
      <version>1.0.0</version>
    </dependency>

mvn compile

mvn install

cd ..

mvn archetype:generate -DarchetypeCatalog=http://cocoon.apache.org

Define value for groupId: : local.cocoon
Define value for artifactId: : cocoon-webapp
Define value for version: 1.0-SNAPSHOT: : 1.0.0
Define value for package: : local.cocoon.cocoon-webapp

cd cocoon-webapp

vim pom.xml

add the dependancy
      <dependency>
        <groupId>local.cocoon/groupId>
        <artifactId>myBlock1</artifactId>
        <version>1.0.0</version>
      </dependency>

mvn compile

mvn war:war

cd target

upload this war file to your tomcat server.

load the following url

http://192.168.0.1:8180/cocoon-webapp-1.0.0/myBlock1/myFile.pdf

http://192.168.0.1:8180/cocoon-webapp-1.0.0/myBlock1/myFile.html

http://192.168.0.1:8180/cocoon-webapp-1.0.0/myBlock1/myFile.xml

if all three loads, you have a dynamically generated pdf! (and html and xml)

next step is to force cocoon to retrieve the files remotely, by doing so, the content can be retrieved from a database of choice using your own desirable programming language of choice! In my case php+postgres/mysql and .net+sql/access

No Comments

True Dynamic PDF Generation

technical

I did this about 2 years ago. Not much has changed but there has been more steps involved due to security issues and bug fixes. Here’s the current instructions as they currently work today.


apt-get install sun-java6-jdk
apt-get install tomcat5.5
apt-get install tomcat5.5-admin
apt-get install tomcat5.5-webapps
vim /etc/tomcat5.5/tomcat-users.xml

add the following (not sure why admin and manager isn’t defined)

<role rolename=”manager”/>
<role rolename=”admin”/>
<user username=”####” password=”####” roles=”tomcat,role1,manager,admin”/>

restart
/etc/init.d/tomcat5.5 restart
open browser (no trailing forward slash at the end)
https://ubuntu.local:8180
should anything during the installation process go wrong, you can repeat the installation by purging the old files through apt-get –purge autoremove tomcat5.5, correct the mistake/problem, and retry the installation. for me, I had multiple java instances problems and having defined JAVA_HOME when it isn’t needed (in this setup scenario it is automatically found)

PART 2
setting up cocoon download cocoon from http://cocoon.apache.org/mirror.cgi
<code>
wget http://east.unified.net/apache/cocoon/cocoon-2.1.11-src.tar.gz
tar -xvf cocoon-2.1.11-src.tar.gz
cd cocoon-2.1.11
./build.sh war
</code>
i got warnings of jpegencoder funnctions. i don’t need them.
cd build/cocoon
your cocoon.war file is here. use the manager interface to upload the cocoon file.
https://ubuntu.local:8180
I have encountered a permission issue while browsing the catalina log file. to resolve this I had to add the following
vim /etc/tomcat5.5/policy.d/04webapps.policy
<pre>grant codeBase “file:${catalina.home}/bin/tomcat-juli.jar” {
permission java.io.FilePermission “/var/lib/tomcat5.5/webapps/cocoon/WEB-INF/classes/logging.properties”, “read”;
permission java.io.FilePermission “/usr/share/tomcat5.5-webapps/jsp-examples/WEB-INF/classes/logging.properties”, “read”;
permission java.io.FilePermission “/usr/share/tomcat5.5-webapps/servlets-examples/WEB-INF/classes/logging.properties”, “read”;
};</pre>
security errors were also encountered on page load of: http://192.168.0.1:8180/cocoon/ easiest fix was to turn off security checks.
enable this option:
vim /etc/default/tomcat5.5
add this:
TOMCAT5_SECURITY=no
restart tomcat:
/etc/init.d/tomcat5.5 restart
view the sample pdf as included by cocoon:
http://192.168.0.1:8180/cocoon/samples/blocks/itext/hello.pdf
if you browse to the directory you’ll notice that hello.pdf does not exist. Instead a sitemap.xmap helps define what hello.pdf should be generated from.
context://samples/hello-world/content/hello.xml
defines the data location

context://samples/hello-world/style/xsl/page2itext.xsl

defines how the xml should be represented

&lt;<map:serialize type=”itext2pdf”/&gt;
defines the transformation mode

For our purposes we will be using XSL-FO so the transformer is:
&lt;map:serialize type=”fo2pdf”/&gt;

That’s it! you’ve got dynamic pdf generator. now you just have to learn the XSL-FO tags to create your pdf! A possible followup to this write up will cover query string and retriving source files remotely in a dynamic fashion. By doing so, you will then have the ability to create free dynamic PDF from any platform like asp.net websites!

No Comments

CES 2009 footage in 3D

technical

A month has past since the CES 2009. As promised I filmed various booths in 3D. Unfortunately I was unable to film all booths nor in depth for those that I do have usable footage of. I am in progress of transferring the footage. Will update progress here.

1 Comment

Backup and Restore Postgres Database

technical

this compresses with zlib. restore does not take into account for roles, so you’ll need to define them if you plan to restore onto a different location. The restore also tries to define plpgsql which is already present in my situation. it is merely a warning so that is fine.

pg_dump -F c -b -D -f “mydb.sql” mydb

pg_restore -d mydb -F c mydb.sql

No Comments

.net 2.0 + mono + ubuntu

technical

assumes apache2 installed via apt-get

apt-get install mono-apache-server2
apt-get install libapache2-mod-mono
a2enmod mod_mono
/etc/init.d/apache2 restart

edit the virtualhost file or httpd.conf file and add this to the end. In the case of virtualhost, for some reason this must reside outside of the tags.

        MonoPath default "/usr/lib/mono/2.0"
        MonoServerPath default /usr/bin/mod-mono-server2
        AddMonoApplications default "/:/var/www"
        <location>
                MonoSetServerAlias default
                SetHandler mono
        </location>

create a file called NumberService.asmx and place the following code:

<%@ WebService Language="C#" Class="MathService.MathService" %>

using System;
using System.Web.Services;

namespace MathService
{
	[WebService (Namespace = "http://mono.local/NumberService")]
	public class MathService : WebService
	{
		[WebMethod]
		public int AddNumbers (int number1, int number2)
		{
			return number1 + number2;
		}

		[WebMethod]
		public int SubtractNumbers (int number1, int number2)
		{
			return number1 - number2;
		}
	}
}
No Comments

Mac Server 10.5 + Postgres + PHP

technical

install postgres from binary distribution (enterprisedb packaged)
install apache2
install php5

tar -xvf php-5.2.6.tar.gz
cd php-5.2.6
./configure –with-pgsql=/Library/PostgreSQL/8.3 –with-apxs2
make
cp libs/libphp5.so /usr/libexec/apache2
cd /usr/sbin
cp httpd httpd.original
lipo httpd -thin i386 -output
apachectl configtest
apachectl graceful

No Comments
Newer Posts »