Using windows hosts file

Windows hosts file, located under “[SystemDriveLetter]:\Windows\System32\drivers\etc” is very useful when you have to test your web applications hosted either locally or on a remote server and you do not wish to map them to your DNS.

Let’s take an example where you have a website named : http://www.my-simple-web-application.com. You will most likely have 3-4 versions of the application dev, preprod, test, live (where live would be http://www.my-simple-web-application.com)

To facilitate testing you could come up with a standard way of addressing these environments :

http://dev.my-simple-web-application.com
http://preprod.my-simple-web-application.com
http://test.my-simple-web-application.com

Each of these sub-domains might point to the same or different servers. This is where the hosts file comes handy, you can configure something like :

127.0.0.1 dev.my-simple-web-application.com
127.0.0.1 preprod.my-simple-web-application.com
127.0.0.1 test.my-simple-web-application.com

In this example all IP addresses are local, you can change them as needed, beware that this configuration should be place on each desktop (development and test) that you want to use these sub-domains.

On another note, this configuration can also be achieve network wide if you have a configurable router where you can add global hosts.

There a number of other situations where hosts file can be helpful :
1) You are migrating your website to a new server, in this case you can specify you existing domain name in the hosts file and point it to the IP of the new server
2) You have multiple web servers hosting the same application and one of them is not working properly you can target the mischievous server and change your host file to point only this server.

Simple Resx Editor

I recently came to a nice Resx Editor alternative. It’s simple to use and the learning curve is very low. It’s perfect for your staff that you don’t want to train in Visual Studio to edit Resx file to text translation.

Take a look at it: http://simpleresxeditor.blogspot.com/2010/12/simple-resx-editor-0660-is-now.html

There is also a video tutorial available: http://www.youtube.com/watch?v=7hUdkqVXmWc&feature=player_embedded

It features:

* Highlight differences and coincidences (1)

* Highlight keys containing text

* Show/Hide keys

* Filter text-only rows

* Drag and drop support

* Multi-language UI

(1) With multiple resx files loaded

Toggl – Time tracking that works

Recently I’ve been searching for a Time Tracking/Management tool that will allow me to monitor and report the time that I spend  working on my task/projects. I found Toggl, as mention on the website:

Toggl is Time tracking that works. Get things done and turn your time into money. Track time with a single click, switch easily between different tasks and create reports.

I have been using it for a few month now and it’s really worth a try, the free version offers nearly all functionality that a time tracker needs. It has a windows agent that allows you to track your time directly from your desktop without event connecting to the website. And most of all it’s compatible with all major platforms (Windows/Mac/Linux/Mobile) !!!

Merge pdf files using C#

Recently I had to create an assembly component using C# to merge multiple PDF files into one file. The specification was pretty straight forward:
1) Merge two of more PDF document into a single output PDF File.
2) Used on an ASP.NET Page

After a few minutes of GOOG, I came up to this “ITextSharp

iText# (iTextSharp) is a port of the iText open source java library written entirely in C# for the .NET platform. iText# is a library that allows you to generate PDF files on the fly. It is implemented as an assembly.

It must be noted that the assembly is coded and compiled using the .NET Framework 1.1. You might want to migrate to the version 2.0 or 3.5 of the .NET Framework.

With a some more research on PDF merging. I was able to create a class that will make use of the ITextSharp assembly and perform as the merge pdf operation as needed.

Here is the code:
[csharp]using iTextSharp.text;
using iTextSharp.text.pdf;

public class MergeEx
{
#region Fields
private string sourcefolder;
private string destinationfile;
private IList fileList = new ArrayList();
#endregion

#region Public Methods
///
/// Add a new file, together with a given docname to the fileList and namelist collection
///
public void AddFile(string pathnname)
{
fileList.Add(pathnname);
}

///
/// Generate the merged PDF
///
public void Execute()
{
MergeDocs();
}
#endregion

#region Private Methods
///
/// Merges the Docs and renders the destinationFile
///
private void MergeDocs()
{

//Step 1: Create a Docuement-Object
Document document = new Document();
try
{
//Step 2: we create a writer that listens to the document
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(destinationfile, FileMode.Create));

//Step 3: Open the document
document.Open();

PdfContentByte cb = writer.DirectContent;
PdfImportedPage page;

int n = 0;
int rotation = 0;

//Loops for each file that has been listed
foreach (string filename in fileList)
{
//The current file path
string filePath = sourcefolder + filename;

// we create a reader for the document
PdfReader reader = new PdfReader(filePath);

//Gets the number of pages to process
n = reader.NumberOfPages;

int i = 0;
while (i < n)
{
i++;
document.SetPageSize(reader.GetPageSizeWithRotation(1));
document.NewPage();

//Insert to Destination on the first page
if (i == 1)
{
Chunk fileRef = new Chunk(” “);
fileRef.SetLocalDestination(filename);
document.Add(fileRef);
}

page = writer.GetImportedPage(reader, i);
rotation = reader.GetPageRotation(i);
if (rotation == 90 || rotation == 270)
{
cb.AddTemplate(page, 0, -1f, 1f, 0, 0, reader.GetPageSizeWithRotation(i).Height);
}
else
{
cb.AddTemplate(page, 1f, 0, 0, 1f, 0, 0);
}
}
}
}
catch (Exception e) { throw e; }
finally { document.Close(); }
}
#endregion

#region Properties
///
/// Gets or Sets the SourceFolder
///
public string SourceFolder
{
get { return sourcefolder; }
set {sourcefolder = value; }
}

///
/// Gets or Sets the DestinationFile
///
public string DestinationFile
{
get { return destinationfile; }
set { destinationfile = value; }
}
#endregion
}
[/csharp]
To use the MergeEx class:
1) Initialize the class
2) Set the SourceFolder and DestinationFile properties
3) Using the AddFile method, add the source file names that need to be merged (Filename only since the SourceFolder has already been set)
4) Call the Execute Method

If everything works fine you will find your Merged PDF Document at your stated destination file.

The code is pretty much self decribed. If there is any question, i can always be contacted via this post.

Windows Live Writer

It’s been not nearly a year since I last used Windows Live Writer, there seems to have been a lot of enhancement and changes compared to the first version that i have tried up. Today, I’ll be giving a try to the beta version (Build 14.0.5025.904). The setup was quiet easy and straight forward, warning me that I must enable XML-RPC on my blog before I can continue.

The first thing I installed is the S3 Object plug-in, to be able to upload images directly to my Amazon S3 account and use them on this post.

This image comes from my S3 bucket.

There are many feature such as the Insert Map: Let’s try it out and point out Mauritius for example 🙂

Where i live.

Nice. I have also created a Marker (Push Pin). Which does not seem to appear, When you create a map on Windows Live Messenger, it’s not the actual map that appears but an image with a link to the actual map… 🙁

Some other comment: There is to a problem, when there are connection cuts. The application just hangs during an operation. It was the case for my first post. Hope that is will be happen.

Conclusion a very nice and elaborated tool for blogging. I’ll will be trying it for a fews days and will send some feedback on this post. Or create a new one if need be.

My previous article to Windows Live Writer can be found here

backup and share files using MozyHome and Dropbox

If you are wondering what are the choices you have to make share and backup your files, you might easily be able to find hundreds of alternative on the web today. Each one with their different features and technologies.

I came across 2 free tools that i use for my backup and file sharing:

MozyHome Remote Backup

 

MozyHome is a small application that runs on background and backups any folder that you configure it to. It will encrypt and then upload your files to your 2 GB free space. You have several tools to enable you to them restore any lost files. Nice for uploading document, project files. You have also the paid version with unlimited space.

Dropbox

 

Dropbox is a new tool, that just got public last week. It’s similar to Mozybackup with 2 GB free space and the posibility of backup your files. With some extra features such as file sharing and automatic sync. Personally I use it to share files only. Since your files need to be in the DropDox folder (Similar concept and LiveMSN sharing folder) to be able to share.

It also allows sharing of files and give you a nice public URL that you can easily send to the person you want to share your files with. The only lacking features i might see here, is that you can’t share an entire folder with files inside. i.e When you want to share several photos you can’t directly get a link to the folder. You must share it with someone that already has Dropbox. A feature that would enable a link to a zip version of an entire folder could be nice.

Virtualization using VirtualBox

Microsoft Virtual PC, which is a quiet efficient tool but needs licences to work with. Today while browsing the web i came to get accross a free open source alternative: VirtualBox

I installed it, had a copy of Linux Ubuntu and created it new virtual guest OS, it took me about 1 hour to set everything up.
From VirtualBox website:

VirtualBox is a family of powerful x86 virtualization products for enterprise as well as home use. Not only is VirtualBox an extremely feature rich, high performance product for enterprise customers, it is also the only professional solution that is freely available as Open Source Software under the terms of the GNU General Public License (GPL). See “About VirtualBox” for an introduction.

Presently, VirtualBox runs on Windows, Linux, Macintosh and OpenSolaris hosts and supports a large number of guest operating systems including but not limited to Windows (NT 4.0, 2000, XP, Server 2003, Vista), DOS/Windows 3.x, Linux (2.4 and 2.6), and OpenBSD.

VirtualBox is being actively developed with frequent releases and has an ever growing list of features, supported guest operating systems and platforms it runs on. VirtualBox is a community effort backed by a dedicated company: everyone is encouraged to contribute while Sun ensures the product always meets professional quality criteria.

That said, I seriously encourage any developer, who needs Virtual OS to run, to either to make a development platform or doing test.

Here are some screen shots of running Windows XP and Ubuntu Linux.

Goodbye Netscape Navigator

10 years have now gone since the first apparition of Netscape Navigator and now it is time to say goodbye to this browser. As announced by AOL, the netscape browser support will end on the 1st of February 2008.

I still remember during my first days using internet i have been playing around with Navigator 3 or 4 i may think. It was kind of the impressive i may say the first time, but afterwards i switched to Internet Explorer, and now i am using both Internet Explorer and FireFox.

Netscape Navigator 9

IBM OmniFind Yahoo! Edition 8.4.2

Quoted from OmniFind website.

IBM and Yahoo! make information actionable with a simple,
no-charge enterprise search solution.

I have been able to play a few month with the OmniFind Yahoo! Edition from IBM, it’s quiet some powerful tool offered for free compared to the other search engines that are offered on the net such as Google Custom Search Business, Google Mini, ISYS Web, Mondo Search, and some other tools that are listed here(http://www.searchtools.com).

Here are the features of OYE (OmniFind Yahoo! Edition)

Search internal web sites, local and remote file systems, and the public web

  • Search up to 500,000 documents and 5 separate collections
  • Support for 200+ file types
  • Search in 30+ languages
  • Translated into 15 languages View Screen Shot

Intuitive out-of-the-box user interface with advanced features

  • Based on Yahoo! Search UI View Screen Shot
  • Easily customized with graphical tools to configure look-and-feel, UI elements, branding View Screen Shot
  • Spell suggestion
  • Full wildcard support

Increased relevancy of results

  • Configurable synonyms and featured links View Screen Shot
  • Tunable relevancy controls View Screen Shot
  • Top queries, no results, and result click through reporting to enable fine-tuning View Screen Shot

Easy to deploy, configure, and maintain

  • No prerequisites
  • 3-click installer
  • 1-click startup
  • Go from the installer to searching in minutes

Open and extensible

  • Built on Apache Lucene
  • Open URL-based APIs (REST)
  • Define, populate and search your own custom fields
  • Easily embeddable and customizable UI output (XML/XSTL/HTML, HTML snippets)

From my point of view the only inconvenience with this tool is that is not open for any plug in or add in functionalities. That could really help make it much much better for users. But again, this tool is complete and contains all the needed functionalities for an Entry Level Enterprise Search Engine.

Here are some screen shot of the new version of the new version of OmniFind that i just upgrade from the 8.4.1
Home - Default Index

Meta Tags section - New to the 8.4.2

OmniFind Custom Search Page Designer