Jeroen Derde's Blog

My Software Engineering Universe

PDFtoWord

clock July 24, 2009 00:33 by author Jeroen Derde

 

Today I got a PDF document from a client that I needed to fill out and hand back in digitally. The PDF did not feature any inputboxes so editting the PDF was not an option. I found myself pondering the remaining options:

  1. Print --> Fill out --> Scan --> Hand in.
    I didn't really like the first option, I'm in IT....I dont write stuff .
  2. Retype the entire document and fill it out digitally, and hand it back in.
    I'm in IT, i don't retype stuff.
  3. Convert the PDF back to word.

So that only left me with option 3, converting the pdf to word.
There are many word to pdf converters out there, but I never really looked for something that does the opposite.

A small Bing resulted in www.pdftoword.com

After uploading the PDF and entering my email address, I got an e-mail in no more than a minute containing my PDF as a Word document.
I was dumbstruck by the quality of the conversion of the form, so I uploaded another 77 page PDF and had that converted aswell.
Even this large document with lots of tables was converted perfectly.....well almost....

  1. Footer and Header recognition: footers and headers are not recognized, and are just text on each page. It would be really nice if these could be recognized and put into the word document as a footer or a header.
  2. Heading and TOC recognition: It would be nice if headings (chapters and paragraphs) could be recognized by PDFtoWord. Then they could also create a TOC instead of just text.

Hope someone finds this service usefull to.

 



WittyTwitter TwitterLib

clock July 14, 2009 23:34 by author Jeroen Derde

 

Found this .Net wrapper for the Twitter API called TwitterLib. It's part of WittyTwitter, but can also be used on it's own.

Code can be found here. http://wittytwitter.googlecode.com/svn/trunk/Witty/TwitterLib/
Nice if you are planning on building a twitter enabled app.

 

 

 



ComplexModelBinder

clock July 10, 2009 01:29 by author Jeroen Derde

Today I was experiencing a problem in the MVC application I am currently developing.

First some information:

Model: ContactDataModel
ContactDataModel implements interface IContactData. This is because the related typedview Step1 contains a partialView that inherits IContactData.
this way we can reuse the partial view simply by having each model, that needs to use the partialview, implement this interface.

 

Interface IContactData


public interface IContactData
{
    ContactData Contact { get; set; }
}

 

Object ContactData


public class ContactData
{
    [Required]
    [StringLength(200)]
    public string Voornaam { get; set; }
}

 

View: Step1
This view inherits from ContactDataModel


...
<h2>ContactGegevens</h2>  
<% Html.RenderPartial("ContactDataUserControl"); %>
...

 

Partial View: ContactDataUserControl
This view inherits from IContactData


<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<QNH.Interfaces.IContactData>" %>
<%= Html.ValidationSummary("Create was unsuccessful. Please correct the errors and try again.") %>
<% using (Html.BeginForm()) {%>
<fieldset>
    <legend>Fields</legend>
    <p>
        <label for="Contact.Voornaam">
            Voornaam:</label>
        <%= Html.TextBox("Contact.Voornaam")%>
        <%= Html.ValidationMessage("Contact.Voornaam", "*")%>
    </p>
.........more fields....form closed

 

Controller: MyController


[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Step1( ContactDataModel contact )
{
    ....
}

 

The "POST" method "Step1" on MyController was recieving an empty ContactDataModel object. If I changed the the Step1 method to recieve the FormCollection instead of the Model object then my values would be present. After this I thought: what object is responsible for mapping the formvalues in my view to my model object. The answer is: the ComplexModelBinder.

The main thing to remember when using the ComplexModelBinder is the naming convention of your controls in the form. Because it uses reflection the ComplexModelBinder is expecting the Class Name + “.“ to be appended to the property name. If you are using the ComplexModelBinder and not prefixing the Class Name to the name of the Property, you will just get null values for your properties.

This means that in my partial view were I was using Contact.Voornaam I needed to use ContactData.Voornaam.This also means that I needed to change the name of the property in my interface to ContactData, because else it would not be recognised.

New Interface: IContactData:


public interface IContactData
{
    ContactData ContactData { get; set; }
}

New Partial View: ContactDataUserControl
This view inherits from IContactData


<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<QNH.Interfaces.IContactData>" %>
<%= Html.ValidationSummary("Create was unsuccessful. Please correct the errors and try again.") %>
<% using (Html.BeginForm()) {%>
<fieldset>
    <legend>Fields</legend>
    <p>
        <label for="ContactData.Voornaam">
            Voornaam:</label>
        <%= Html.TextBox("ContactData.Voornaam")%>
        <%= Html.ValidationMessage("ContactData.Voornaam", "*")%>
    </p>
.........more fields...form closed
 

 

I really hope this helps out someone else. Happy Coding.

 



Web Platform Installer 2.0 Beta

clock June 24, 2009 01:20 by author Jeroen Derde

Today I was creating a new Virtual PC to do some ASP.Net MVC programming. After duplicating my standard image I went to http://www.asp.net/mvc/download/ and was preparing myself to download a couple of installers. Then I saw a button in the top left corner that said: Install Now with the Microsoft Web platform installer.

Web Platform Installer is like a stack. It enables you to install everything you need to start web developing at once and then some more.

This made getting my development machine up and running much easier. It also introduced me to some tools I had never heard of before, which is a big plus aswell.

 

 

 

 

 

 

 



Yahoo Pipes

clock June 18, 2009 23:19 by author Jeroen Derde

 

 

 

At QNH we are always looking for ways to put the company name and knowledge out there on the internet. For quite a while we had been pondering the idea of starting a company weblog to share that knowledge with the on-line community. The thing that held us back was the difficulty of getting our engineers to post on this company weblog. Lost of our engineers have their own personal weblogs and we did not want them having to copy-paste each and every relevant blog entry into the company weblog. While trying to come up with a solution to this problem, one of our senior software engineers and architect stumbled upon Yahoo Pipes.

Yahoo Pipes according to Yahoo

"Pipes is a powerful composition tool to aggregate, manipulate, and mashup content from around the web".
Like Unix pipes, simple commands can be combined together to create output that meets your needs:

  • combine many feeds into one, then sort, filter and translate it.
  • geocode your favorite feeds and browse the items on an interactive map.
  • power widgets/badges on your web site.
  • grab the output of any Pipes as RSS, JSON, KML, and other formats.

Getting Started on combining RSS feeds

Go to http://pipes.yahoo.com and sign-up, or use a yahoo account you already own.
We decided not to use a personal account, but opted to creating a new company account. The company account is

Creating a Pipe

Create a new Pipe and open it, and click the "Edit Source" Tab.
The Pipes Editor is shown.

  1. Add a "Fetch Feed" source from the left menu and add some RSS 2.0 feeds as URL's
  2. Add a "Filter" operator from the left
  3. Connect the "Fetch Feed" To The "Filter" by dragging and dropping a connection starting from the fetch feed
  4. Because we only want posts containing the category QNH to be aggregated we configure the filter as follows:
    - Permit items that match All of the following
    - Add a Rule: Item.Category contains QNH
    - Add a Rule: Item.Category contains qnh

    The editor should look something like this

 

 

 

 

 

 

 

 

 

 

If we connect the filter to the Pipe Output we would get all entries of the blogs defined in the Fetch Feed that have a category named QNH.
But now we want to cap the description of every entry to 500 characters and add "..." at the end of the description. We also want to get rid of some illegal characters some blogs create.
These are the steps required.

  1.  Add a Loop Operator.
    - For each item.description in input feed
    - Add a Sub String String (from 0 to 500)
    -
    Assign results to item.description
  2. Add a RegEx Operator and add the following rules
    - item.description replace (.*)(\[...\]) with $1
    - item.description replace <pre.*?> with empty (empty field)
    - item.description replace <img.*?> with empty (empty field)
  3. Add a Loop Operator.
    - For each (empty field) in imput feed
    - Add a String Builder String (item.description + ...) and assign the results to the item.description

The part we just created should look like the next picture.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Now we are almost done. But because some weblog engines put the author in the item.dc.publisher or in the item.dc.creator in stead if the item.author.name we need to correct this.

  1. Add a Loop Operator.
    - For each (empty field) in imput feed
    - Add a String Builder String (item.dc.publisher + item.dc.author + item.author.name) and assign the results to the item.author.name
  2. Add a Sort Operator
    -
    sort by item.pubDate in descending order
  3. Connect the sort operator to the pipe output

The last part created should now look like

 

 

 

 

 

 

 

 

 

 

 

 

 

 Save the pipe! 

End result


Now we end up with an agregated RSS feed that we can integrate into any part of the organisation.
For example: The feed is featured on the QNH AD&S website http://www.qnh-ads.nl/blog, but also shown on the homepage of our company intranet,

Good times!



Twikini

clock June 4, 2009 01:27 by author Jeroen Derde

 

Tweeting from outlook using OutTwit works like a charm, but I was missing something to soothe my Mobile twitter attacks.
This is when I discovered Twikini and PocketTwit for Windows Mobile. I tried PocketTwit first, but could not get it to connect to twitter on my HTC P4350.
So after uninstalling it I tried
Twikini. Twikini looks like a million dollars in all of it's simplicity.

 

 

 

 

 

 

 

 

 

 

 

 

 

It is compatible with all Windows Mobile® 5 and 6 devices, including touch and non-touch.
I'm already hooked on this app. Hope you will enjoy it too.




Month List

Calendar

<<  October 2020  >>
MoTuWeThFrSaSu
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

View posts in large calendar

Sign in