Development

SoftArtisans OfficeWriter

Disclaimer: While this article was written before I started working at SoftArtisans, I do work at SoftArtisans now.  Support for SoftArtisans products can be found at http://support.softartisans.com/

So today I tried out a product from SoftArtisans called OfficeWriter specifically the WordWriter feature. You can find a Demo here. I set out to create an application that would allow me to fill in a form and generate mailing labels to be printed. I found out that with SoftArtisans product this was extremely easy.

First I created a Mail Merge template in Microsoft office. You can download a copy of my Label Template if you would like.

Then I wrote the following code:

  protected void generateBtn_Click(object sender, EventArgs e)
        {
            // Variables
            object[] arrValues = { firstNameTxt.Text, lastNameTxt.Text, addressTxt.Text, cityTxt.Text, stateTxt.Text, zipCodeTxt.Text };
            generateLabels(arrValues);
        }
        private void generateLabels(object[] arrValues)
        {
            WordTemplate wt = new WordTemplate();
            wt.Open("C:/labels.doc");
            string[] arrNameFields = { "First_Name", "Last_Name", "Address_Line_1", "City", "State", "ZIP_Code" };
            //Bind Mail Merge Fields with Data
            wt.SetDataSource(arrValues, arrNameFields);
            wt.Process();
            //Save to browser
            wt.Save(Page.Response, "Labels.doc", false);
        }

with the following front end:

When opening the generate document I had the following output:

You can download my solution here, but remember that you need an Office Writer license or you must be using the demo license.

Tags: ,

Sunday, October 24th, 2010 Programming No Comments

Simple XML Parse Flickr Feed

So in one of my recent projects I had to parse a Flickr feed and extract the image urls the code I came up with is as follows:

<?php
/* Author: Samuel Haddad
 * SimpleXML Flicker Feed Parser
 */
//Feed URL in RSS Format
$url ="http://api.flickr.com/services/feeds/photos_public.gne?lang=en-us&format=rss_200"; //FEED URL
//Use simple XML to parse the feed
$xml = simplexml_load_file($url);
$items = $xml->xpath('/rss/channel/item');
foreach($items as $item){
 $nsmedia = $item->children('http://search.yahoo.com/mrss/');
 $img = $nsmedia->content->attributes();
 echo $img; //URL of Image
 echo "<br/>";
}
?>

Of course my code did more then just extract the URL, but I will leave the rest up to the creative developers.

Thursday, October 21st, 2010 PHP, Web Design No Comments

AnkhSVN and Google Code

Recently I was trying to commit to my Jango Desktop project hosted on Google code. I was using AnkhSVN and I kept getting an error similar to:

SharpSvn.SvnRepositoryIOException: Commit failed (details follow): ---> SharpSvn.SvnRepositoryIOException: Server sent unexpected return value (405 Method Not Allowed) in response to MKACTIVITY request for

If anyone else runs into this issue I was trying to commit to the read only repository. An easy way to tell if this is your issue is to look at the repository url. Google’s commit repository starts with https: // not http://

If this is your issue log into Google code to obtain the correct repository url.

Tags: , , ,

Thursday, October 14th, 2010 Desktop Enginnering, Programming No Comments

Pointsec boot from CD

Since I always forget how to boot from a cd using Pointsec I decided to write it down. This brings you to an alternative boot menu.

  1. Start computer
  2. Enter Pointsec account information.
  3. When it prompts you to continue, do not hit continue right away instead press CTRL + F10
  4. Then continue you will be prompted with the alternative boot menu.

If you need a disk that can read the encrypted drive. You can try following the following instructions to create a Bart PE cd with the Pointsec Drivers in it:

http://www.blackfistsecurity.com/2008/07/pointsec-for-pc-creating-boot-disk.html

Tags: , , , ,

Thursday, January 7th, 2010 Desktop Enginnering, Development 2 Comments

VBscript Permission Denied 800A0046 Solution

I was helping a friend write some VBscript the other day. I was trying to write a simple copy function and I kept getting permission denied. However I was logged in locally as the administrator so that could not be it.

My code looked something like:

Sub CopyFile(source, destination)
	set filesys=CreateObject("Scripting.FileSystemObject")
	If filesys.FileExists(source) Then
	   filesys.CopyFile source, destination
	End If
End Sub

The Solution is: add “\” add the end of any of your path names like
Dim destinationpath
destinationpath = “C:\” & myfolder & “\”

Hope this helps someone else.

Tags: , , , , , , ,

Friday, June 26th, 2009 Desktop Enginnering, Programming 8 Comments