I'm reading The D Programming Language by Andrei Alexandrescu.
It's very easy to setup the environment in Ubuntu:
1. From the downloads page, get version 2 of the deb package and install.
2. Install Geany editor. It already supports D out of the box. You can compile and build from within the editor.
3. Happy compiling.
Sunday, August 15, 2010
Thursday, July 1, 2010
inotify + StringTemplate
I was looking for the equivalent of Dreamweaver templates on Ubuntu. I couldn't find anything that met my needs so I decided to create a workflow that came close.
I have potentially many files that contain xhtml fragments which need to be inserted into one or more templates. That is, I edit a file which when saved results in the creation of a completed html document in some other directory.
I used inotify and inotify-tools to notify when files in my source directory are modified, and StringTemplate for the template engine.
inotify should already exist on Linux. But, you'll need to install inotify-tools:
This script runs in a terminal waiting for edits to happen in the source directory, then calling the groovy script when it does:
The groovy script finds the file with the latest modified timestamp and uses StringTemplate to insert the contents into the template. It ends with writing the new file to the target directory.
So with two small script files, I end up with a neat workflow that maintains the separation of content and template.
I have potentially many files that contain xhtml fragments which need to be inserted into one or more templates. That is, I edit a file which when saved results in the creation of a completed html document in some other directory.
I used inotify and inotify-tools to notify when files in my source directory are modified, and StringTemplate for the template engine.
inotify should already exist on Linux. But, you'll need to install inotify-tools:
sudo apt-get install inotify-tools
This script runs in a terminal waiting for edits to happen in the source directory, then calling the groovy script when it does:
#!/bin/bash
inotifywait -m -e modify /path/to/src/directory | while read line;
do
echo "updating file: $line"
groovy /path/to/monitor.groovy
done
The groovy script finds the file with the latest modified timestamp and uses StringTemplate to insert the contents into the template. It ends with writing the new file to the target directory.
def srcDir = new File("/path/to/src")
def targetDir = "/path/to/target/"
def lastModifiedFile = srcDir.listFiles().max{ it.lastModified() }
StringTemplateGroup group = new StringTemplateGroup("myGroup", "/path/to/templates")
StringTemplate query = group.getInstanceOf("template-1")
query.setAttribute "content", lastModifiedFile.text
outFile = new File(targetDir + lastModifiedFile.name)
outFile.write query.toString()
So with two small script files, I end up with a neat workflow that maintains the separation of content and template.
Sunday, June 27, 2010
XHMTL to PDF: wkhtmltopdf
I was looking for a way to create a resume in PDF format without having to use a word processor.
I looked at Latex but I didn't want to learn a new language.
XHTML as the primary document would be ideal; a simple markup language that can be styled with CSS.
I played around with Prince, but it's not free or cheap. Also, with the non-commercial license, Prince will put a logo on the first page of the document.
While trying to find an alternative, I stumbled upon wkhtmltopdf. Wkhtmltopdf uses the QT WebKit widget as the rendering engine to generate PDFs. So, the PDF will look very much like what appears in Chrome or Safari.
I'm using Ubuntu 10.04 and was pleasantly surprised to see wkhtmltopdf in the repositories. However, that version is not the patched version. That is, you won't be able to set header and footer options.
The good news is they provide static binaries of the latest versions. Download, extract and copy the binary into /usr/local/bin/ and you're good to go.
I looked at Latex but I didn't want to learn a new language.
XHTML as the primary document would be ideal; a simple markup language that can be styled with CSS.
I played around with Prince, but it's not free or cheap. Also, with the non-commercial license, Prince will put a logo on the first page of the document.
While trying to find an alternative, I stumbled upon wkhtmltopdf. Wkhtmltopdf uses the QT WebKit widget as the rendering engine to generate PDFs. So, the PDF will look very much like what appears in Chrome or Safari.
I'm using Ubuntu 10.04 and was pleasantly surprised to see wkhtmltopdf in the repositories. However, that version is not the patched version. That is, you won't be able to set header and footer options.
The good news is they provide static binaries of the latest versions. Download, extract and copy the binary into /usr/local/bin/ and you're good to go.
Wednesday, March 17, 2010
Android
So I got an android dev environment setup on Ubuntu 9.10 x64. Very straightforward and no missing packages to install.
The emulator takes awhile to startup. But once it's up, you can deploy/redeploy your apps quickly.
The developer's guide is a good reference. Also reading Hello, Android.
The plan is to eventually get to using Android NDK.
The emulator takes awhile to startup. But once it's up, you can deploy/redeploy your apps quickly.
The developer's guide is a good reference. Also reading Hello, Android.
The plan is to eventually get to using Android NDK.
Wednesday, December 30, 2009
GWT MVP article
Here's a good article explaining MVP in GWT applications:
Large scale application development and MVP
Large scale application development and MVP
Saturday, December 26, 2009
Netbeans 6.8 missing beans.xml
If you want to create a JSF 2 web app using Netbeans 6.8, you'll have to manually create a beans.xml under WEB-INF.
A file with empty tags will do:
A file with empty tags will do:
<beans></beans>
Sunday, November 29, 2009
Installing Flex Builder 3 with Flex 4 beta in Eclipse 3.5 on Linux
I was curious to see what Flex 4 has to offer so I decided to try installing a development environment on Ubuntu 9.10.
To use Flex 4 SDK:
Phew!
- Install Eclipse 3.5 Galileo and Flex Builder for Linux alpha 5.
- There's an issue with Eclipse Galileo. Just prepend "path=" to [ECLIPSE_HOME]/links/com.adobe.flexbuilder.feature.core.link.
- Apply James Ward's patch (steps 2,3,4,5).
- Apply another patch (Stage 2: steps 5,6,7).
To use Flex 4 SDK:
- Install Flash Player 10.x.
- Download the Flex 4 SDK.
- Extract contents to [Linux Flex Builder install directory]/sdks/4.0.0 folder.
- In Eclipse, [Window > Preferences > Flex > Installed Flex SDKs] and add 4.0.0 to the list.
- In Eclipse, right-click your project, then Properties. Under Flex Compilers, select the Flex 4 SDK and also enter "10.0.0" for "Require Flash Player version".
- From [Linux Flex Builder install directory]/sdks/4.0.0/templates/swfobject folder, copy /history, index.template.html and swfobject.js files to your project's "html-template" folder.
Phew!
Subscribe to:
Posts (Atom)