Archive

Archive for the ‘Tools’ Category

Easy Trick To Search for Attachments in Gmail – has:attachment

July 17th, 2009 joy No comments

When there are hundreds of mail in our Gmail account and we are in need of mails with attachment and want it to find quickly.Then there is a easy trick in Gmail.

has:attachment

has:attachment

just type has:attachment and the type of the file like pdf,ppt,doc,zip with a space.

Example :-

has:attachment pdf

When we click the search mail button we get the mails with the attachment of the type we specified as the result.Here in this example we get the PDF attachment mails as result.

There are also many easy tricks to find a specified mail in gmail like “has:attachment” keyword.You can find the list here.

Popularity: 2% [?]

Categories: Tech Stuff, Tips And Tricks Tags:

500 Internal Server Error – How We Fixed – Wordpress – Dreamhost

June 27th, 2009 joy No comments

Problem : Internal Server Error 500

Yesterday(Jun-26-2009) our blog was down and got the internal server error 500.So we immediately mailed Dreamhost(our host) support to see the issue and got a support ticket.

We Checked the  error log  which was stating “Premature end of script headers: index.php” error for every hit made.We came to know many had this problem previously in their sites mostly due to some script error in the plugin installed in wordpress.

While waiting for support reply we started to search the web for some solution about internal server error 500 and 503.

We followed some suggestion to solve error 500 like : -

1. Rename wp-cache-config.php

2. Disable the plugins.This we cant do because wordpress was installed in the root folder which made impossible to login and disable the plugins through web interface.

3. Just click Change fully hosted settings actually without making any changes in dreamhost panel

Unfortunately these didn’t work for us.

Today(Jun-27-2009) morning we got the reply mail from dremhost as

I was looking through your error logs and I found one issue that definitely could contribute to the 500 errors that you’re experiencing:

[Fri Jun 26 12:40:29 2009] [notice] mod_fcgid: too much  /home/fordevs/fordevs.com/index.php process(current:4, max:4), skip the spawn request

These errors can be contributed to several things:

1.) Plugins or extensions that are causing the site to load ineffectively, this is common with 3rd party scripts as they are   generally poorly coded.

2.) Your over all site is maxing out the allocated amount of RAM for your user. Unfortunately for security reasons we can’t reveal the amount available to each user, but this could be a contribution to the error.

How we solved the issue?

As the support mail also says it may be due to plugin we decided to solve it ourselves taking the suggestion from a forum discussion .We backed up the plugin folder from webftp and deleted all the plugin there.

After deleting the plugins the site was working fine.We could not exactly say which pulgin made the mess.

If you get the same error just try this but cant assure this method will work for you.

Popularity: 14% [?]

Categories: Internet, Tips And Tricks Tags: ,

Know who is sharing with you in a shared hosting

May 28th, 2009 joy No comments

We would be curious to know who is sharing our IP in our shared hosting package.Here is a way to know that,Axandra free seo tool makes the task easy.

Not everybody can go for a dedicated IP which are better.So atleast we will know our neighbour’s which is good for some specific reasons,such as :-

  • To check websites hosted on our server are not spammer.
  • To check if porn websites are hosted on the same server we are sharing.
  • To check with others to clarify if there is a downtime in our shared server.

To look in a postive side we can also make friends with whom we are sharing our IP.

Link :- http://www.axandra.com/free-online-seo-tool/shared-hosting-check.php

Popularity: 1% [?]

Check different fonts by comparing for web designing

February 25th, 2009 admin No comments

While designing a website we would need to compare fonts which suits us.Typetester as made the work simple.

Typetester is an online application for comparison of the fonts for the screen.we can compare three fonts at a time with different font style,font size,color etc.We can aslo get the css coding of the font setting given.

Popularity: 1% [?]

Search a website or blog without search box

January 29th, 2009 admin 1 comment

I was looking for a tool to search a blog since it did not have a search box.
So i Searched google but did’nt find any but surprisingly while searching i
came across a article in yourshortestpath which gave the answer and was
very simple.

Use Google To Search A Website or Blog Without A Search Box.

Steps to search a website or blog without search box:

* Go to Google search
* type the word you want to search space site:+”url of the site”

Example : dotnet site:http://fordevs.com

This returns the result with the pages having the word dotnet.

And to note the search returns only the pages indexed by google for that website/blog.

Popularity: 2% [?]

Categories: Internet, Tips And Tricks Tags:

Absolute Position for Controls in Asp.net

December 3rd, 2008 admin 2 comments

By default for controls placed in the designer the layout position is as ‘Not Set’ thus we cannot drag the control to a specified location.


We have to change the layout position to absolute position to achieve that.

In Visual Studio we can make the default postion as we need.For that we have to enable the css postioning of controls.

Here is how we can do

1. Go to Layout->Position->Auto-position Options->HTML Designer–>CSS Styling

or

2. Go to Tools->Options->HTML Designer–>CSS Positioning

And check “Change positioning to the following for controls added using Toolbox, paste or drag and drop” and select the postion you perfer.Here we select Absolute Positioning.

Now we can move the controls placed in the designer with absolute positioning.

The Given Procedure is for Visual Studio 2005 which is same for Visual Studio 2008.

Popularity: 4% [?]

Categories: Tips And Tricks, Visual Studio Tags:

Creating Excel as Datasource for Mail Merge using C#

September 18th, 2008 admin No comments

We can use excel as datasource for mail merge.We have to write the header and records in excel file which will act as the datasource for word mail merge.

The first row of excel will be treated as the header in the excel.

while using word as datasource and create a the word datasource we get an error “String longer than 255 characters ” when the concatenated fields string length increases 255. To overcome we can use excel as datasource.

Download Zip

Coding :

//Creating Excel file
private void CreateMailMergeExcelDataFile()
{
try
{
string[] fileds,record1;
 
Object oName = "C:\\TempDoc.xls";
string strHeader = "FirstName, LastName, Address, CityStateZip";
string strRecord1 = "John,Roy,31 New street,320009";
 
MSExcel.Application excelapp;
MSExcel.Workbook excelwrbook;
 
excelapp = new Microsoft.Office.Interop.Excel.Application();
excelapp.Visible = true;
MSExcel.Worksheet ws = new MSExcel.WorksheetClass();
 
excelwrbook = excelapp.Workbooks.Add(objMissing);
 
ws = (MSExcel.Worksheet)excelapp.ActiveWorkbook.ActiveSheet;
 
fileds = strHeader.Split(',');
record1 = strRecord1.Split(',');
//writing in excel you Can use datatable and Get the records and loop.here for
sample i have writing keeping two strings 
 
for (int i = 0; i < j =" 0;" style="color: rgb(0, 102, 0);"  
 //saving the excel workbook
excelwrbook.SaveAs(oName, 
MSExcel.XlFileFormat.xlTemplate, objMissing, 
objMissing, objMissing,objMissing, 
MSExcel.XlSaveAsAccessMode.xlExclusive,
objMissing, objMissing, objMissing, 
objMissing, objMissing);
excelapp.Quit();
 
//opening the excel to act as a datasource for word mail merge
wrdDoc.MailMerge.OpenDataSource("C:\\TempDoc.xls", 
ref objMissing, ref objMissing, ref objMissing, ref objMissing, 
ref objMissing,ref objMissing, ref objMissing, 
ref objMissing,ref objMissing, ref objMissing,
ref objMissing, ref oQuery,ref objMissing, ref objMissing,
ref objMissing);
 
}
catch (Exception ex)
{
MessageBox.Show("Error :" + ex);
}
}
 
private void button1_Click(object sender, System.EventArgs e)
{
try
{
Word.Selection wrdSelection;
Word.MailMerge wrdMailMerge;
Word.MailMergeFields wrdMergeFields;
Word.Table wrdTable;
string StrToAdd;
 
wrdApp = new Word.Application();
wrdApp.Visible = false;
 
// Add a new document.
wrdDoc = wrdApp.Documents.Add(ref objMissing, ref objMissing,
ref objMissing, ref objMissing);
wrdDoc.Select();
 
wrdSelection = wrdApp.Selection;
wrdMailMerge = wrdDoc.MailMerge;
 
// Create a MailMerge Data file using excel 
CreateMailMergeExcelDataFile();
// Create a string and insert it into the document.
StrToAdd = "Mail Merge";
wrdSelection.ParagraphFormat.Alignment =
Word.WdParagraphAlignment.wdAlignParagraphCenter;
wrdSelection.TypeText(StrToAdd);
 
InsertLines(2);
 
// Insert merge data.
wrdSelection.ParagraphFormat.Alignment =
Word.WdParagraphAlignment.wdAlignParagraphLeft;
wrdMergeFields = wrdMailMerge.Fields;
wrdMergeFields.Add(wrdSelection.Range, "FirstName");
wrdSelection.TypeText(" ");
wrdMergeFields.Add(wrdSelection.Range, "LastName");
wrdSelection.TypeParagraph();
 
wrdMergeFields.Add(wrdSelection.Range, "Address");
wrdSelection.TypeParagraph();
wrdMergeFields.Add(wrdSelection.Range, "CityStateZip");
 
InsertLines(2);
 
wrdSelection.ParagraphFormat.Alignment =
Word.WdParagraphAlignment.wdAlignParagraphRight;
 
Object objDate = "dddd, MMMM dd, yyyy";
wrdSelection.InsertDateTime(ref objDate, ref oFalse, ref objMissing,
ref objMissing, ref objMissing);
 
InsertLines(2);
 
wrdSelection.ParagraphFormat.Alignment =
Word.WdParagraphAlignment.wdAlignParagraphJustify;
 
wrdSelection.TypeText("Dear ");
wrdMergeFields.Add(wrdSelection.Range, "FirstName");
wrdSelection.TypeText(",");
InsertLines(1);
 
StrToAdd = "Thank you for using Mail Merge.";
wrdSelection.TypeText(StrToAdd);
// Perform mail merge.
wrdMailMerge.Destination = Word.WdMailMergeDestination.wdSendToNewDocument;
wrdMailMerge.Execute(ref oFalse);
 
// Close the original form document.
wrdDoc.Saved = true;
wrdDoc.Close(ref oFalse, ref objMissing, ref objMissing);
 
 // Makes the merged doc visible
wrdApp.Visible = true;
 
// Release References.
wrdSelection = null;
wrdMailMerge = null;
wrdMergeFields = null;
wrdDoc = null;
wrdApp = null;
 
// Clean up temp file.
System.IO.File.Delete("C:\\TempDoc.xls");
}
catch (Exception ex)
{
MessageBox.Show("Error :" + ex);
}
}

Popularity: 1% [?]

Categories: C#, MS Office Tags: ,

Mail Merge Using C#

August 21st, 2008 admin 2 comments

I was looking for doing a mail merge application and went through the web and found a good article from Microsoft link .This automates Microsoft Word to perform Mail Merge using C#.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Word = Microsoft.Office.Interop.Word;

namespace mailmersamp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

Word.Application wrdApp;
Word._Document wrdDoc;
Object oMissing = System.Reflection.Missing.Value;
Object oFalse = false;

private void InsertLines(int LineNum)
{
int iCount;

// Insert “LineNum” blank lines.
for (iCount = 1; iCount <= LineNum; iCount++)
{
wrdApp.Selection.TypeParagraph();
}
}

private void FillRow(Word._Document oDoc, int Row, string Text1, string Text2, string Text3, string Text4)
{
// Insert the data into the specific cell.
oDoc.Tables[1].Cell(Row, 1).Range.InsertAfter(Text1);
oDoc.Tables[1].Cell(Row, 2).Range.InsertAfter(Text2);
oDoc.Tables[1].Cell(Row, 3).Range.InsertAfter(Text3);
oDoc.Tables[1].Cell(Row, 4).Range.InsertAfter(Text4);
}

private void CreateMailMergeDataFile()
{
Word._Document oDataDoc;
int iCount;
Object oName = “C:\TempDoc.doc”;
Object oHeader = “FirstName, LastName, Address, CityStateZip”; wrdDoc.MailMerge.CreateDataSource(ref oName, ref oMissing,ref oMissing, ref oHeader, ref oMissing, ref oMissing,ref oMissing, ref oMissing, ref oMissing);

// Open the file to insert data.
oDataDoc = wrdApp.Documents.Open(ref oName, ref oMissing,ref oMissing, ref oMissing, ref oMissing, ref oMissing,ref oMissing, ref oMissing, ref oMissing, ref oMissing,ref oMissing, ref oMissing, ref oMissing, ref oMissing,ref oMissing, ref oMissing);

for (iCount = 1; iCount <= 1; iCount++)
{
oDataDoc.Tables[1].Rows.Add(ref oMissing);
}
// Fill in the data.

FillRow(oDataDoc, 2, “Roy”, “John”,”45 Main Street”, “Chennai, IND 6399873″);
FillRow(oDataDoc, 3, “Jan”, “Mike”,”34 cross Street”, “Trichy, IND 620006″);

// Save and close the file.
oDataDoc.Save();
oDataDoc.Close(ref oFalse, ref oMissing, ref oMissing);
}

private void button1_Click(object sender, System.EventArgs e)
{
Word.Selection wrdSelection;
Word.MailMerge wrdMailMerge;
Word.MailMergeFields wrdMergeFields;
Word.Table wrdTable;
string StrToAdd;

wrdApp = new Word.Application();
wrdApp.Visible = false;

// Add a new document.
wrdDoc = wrdApp.Documents.Add(ref oMissing, ref oMissing,ref oMissing, ref oMissing);
wrdDoc.Select();

wrdSelection = wrdApp.Selection;
wrdMailMerge = wrdDoc.MailMerge;

// Create a MailMerge Data file.
CreateMailMergeDataFile();

// Create a string and insert it into the document.
StrToAdd = “Mail Merge”;
wrdSelection.ParagraphFormat.Alignment =Word.WdParagraphAlignment.wdAlignParagraphCenter;
wrdSelection.TypeText(StrToAdd);

InsertLines(2);

// Insert merge data.
wrdSelection.ParagraphFormat.Alignment =
Word.WdParagraphAlignment.wdAlignParagraphLeft;
wrdMergeFields = wrdMailMerge.Fields;
wrdMergeFields.Add(wrdSelection.Range, “FirstName”);
wrdSelection.TypeText(” “);
wrdMergeFields.Add(wrdSelection.Range, “LastName”);
wrdSelection.TypeParagraph();

wrdMergeFields.Add(wrdSelection.Range, “Address”);
wrdSelection.TypeParagraph();
wrdMergeFields.Add(wrdSelection.Range, “CityStateZip”);

InsertLines(2);

// Right justify the line and insert a date field
// with the current date.
wrdSelection.ParagraphFormat.Alignment =
Word.WdParagraphAlignment.wdAlignParagraphRight;

Object objDate = “dddd, MMMM dd, yyyy”;
wrdSelection.InsertDateTime(ref objDate, ref oFalse, ref oMissing,
ref oMissing, ref oMissing);

InsertLines(2);

// Justify the rest of the document.
wrdSelection.ParagraphFormat.Alignment =
Word.WdParagraphAlignment.wdAlignParagraphJustify;

wrdSelection.TypeText(“Dear “);
wrdMergeFields.Add(wrdSelection.Range, “FirstName”);
wrdSelection.TypeText(“,”);
InsertLines(1);

// Create a string and insert it into the document.
StrToAdd = “Thank you for using Mail Merge.”;
wrdSelection.TypeText(StrToAdd);

InsertLines(2);

// Insert a new table with 3 rows and 4 columns.
wrdTable = wrdDoc.Tables.Add(wrdSelection.Range, 3, 4,
ref oMissing, ref oMissing);

// Set the column widths.
wrdTable.Columns[1].SetWidth(100, Word.WdRulerStyle.wdAdjustNone);
wrdTable.Columns[2].SetWidth(100, Word.WdRulerStyle.wdAdjustNone);
wrdTable.Columns[1].SetWidth(100, Word.WdRulerStyle.wdAdjustNone);
wrdTable.Columns[2].SetWidth(100, Word.WdRulerStyle.wdAdjustNone);

// Set the shading on the first row to light gray.
wrdTable.Rows[1].Cells.Shading.BackgroundPatternColorIndex =
Word.WdColorIndex.wdGray25;

// Bold the first row.
wrdTable.Rows[1].Range.Bold = 1;

// Center the text in Cell (1,1).
wrdTable.Cell(1, 1).Range.Paragraphs.Alignment =
Word.WdParagraphAlignment.wdAlignParagraphCenter;

// Fill each row of the table with data.
FillRow(wrdDoc, 1, “Number”, “Name”,”Dept”,”Note”);
FillRow(wrdDoc, 2, “100″, “abc”,”Cse”,”New”);
FillRow(wrdDoc, 3, “101″, “def”,”Ece”,”New”);

// Go to the end of the document.
Object oConst1 = Word.WdGoToItem.wdGoToLine;
Object oConst2 = Word.WdGoToDirection.wdGoToLast;
wrdApp.Selection.GoTo(ref oConst1, ref oConst2, ref oMissing, ref oMissing);

// Create a string and insert it into the document.
StrToAdd = “n For additional information regarding the ” +
“Mail Merge, ” + “you can visit our Web Site at “;
wrdSelection.TypeText(StrToAdd);

// Insert a hyperlink to the Web page.
Object oAddress = “http://www.fordevs.com”;
Object oRange = wrdSelection.Range;
wrdSelection.Hyperlinks.Add(oRange, ref oAddress, ref oMissing,
ref oMissing, ref oMissing, ref oMissing);

// Create a string and insert it into the document
StrToAdd = “. Thank you for your interest in Mail Merge. rnrn” +
“Sincerely,rn” + “Jackrn”;
wrdSelection.TypeText(StrToAdd);

// Perform mail merge.
wrdMailMerge.Destination = Word.WdMailMergeDestination.wdSendToNewDocument;
wrdMailMerge.Execut
e(ref oFalse);

// Close the original form document.
wrdDoc.Saved = true;
wrdDoc.Close(ref oFalse, ref oMissing, ref oMissing);

// Makes the merged doc visible
wrdApp.Visible = true;

// Release References.
wrdSelection = null;
wrdMailMerge = null;
wrdMergeFields = null;
wrdDoc = null;
wrdApp = null;

// Clean up temp file.
System.IO.File.Delete(“C:\TempDoc.doc”);
}
}
}

Download Zip

Note :

We get a error when the concatenated fields string length exceeds 255. To Overcome we can use excel as datasource instead of word.

Using Excel as Datasource

Popularity: 100% [?]

Categories: C#, MS Office Tags: