Archive

Archive for the ‘Uncategorized’ Category

Google Toolbar buttons

With the new version of Google toolbar, you can add your own buttons to it, with quite a simple technique.
 
Step 1.Create an .ico file,
 
Step 2. Base 64 encode it :
 

FileStream fsIco = new FileStream(tbIco.Text,FileMode.Open);

byte[] bIco = new byte[fsIco.Length];

fsIco.Read(bIco,0,(

int)fsIco.Length);

this.tbOutput.Text = Convert.ToBase64String(bIco);

fsIco.Close();

 

Step 3: Create an XML file containing the encoded icon

 

<?xml version="1.0" encoding="utf-8" ?>
<custombuttons xmlns="http://toolbar.google.com/custombuttons/">
<button>
<title>CheapFlights.ie</title>
<description>Cheap Flights from Ireland</description>
<search>http://www.cheapflights.ie/search.aspx?txt={query}</search&gt;
<icon mode="base64" type="image/x-icon">AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAD/aXz/aXz/aXz+aHz7Z3q+YG7+aHv+aXv+aXz+aHv/aXz/aXz/aXz/aXz/aXz/aXz+aHz/aHv/aHz+aXz5ZnnXvMD+rbj+Y3f+an7+aXv+aHz+aHv+aXz+aXz/aXz/aXz+aXz/aHv+aHv+aXz+an3gipb8+vvglaC4ZW/9aX3+aXz+aHv+aXv+aXz/aXz/aXz+aHv/aHv+aHv+aXv+aXv0Z3jd09T3+Pfss7z9c4X+an3+aXz+aHz+aXz/aXz/aXz+aXz9aXv+aXv+aHz+aHz+aXrXj5f6/Pzuy9CUZ2/ohIv+aXz+aXv+aXz/aXz/aXzrY3TCe4X+bH/+aXz+aHz+aXzQaXjs6ev+/v780tj9lqT+aHv+aXv+aHv+aHz+aXz0ZHbhxsr7u8LRUWPOWWbPWmeqTFnd3dz+//796+3nZHbUXG3UW23UW23kXm7+Z3v9aHvTkZr6+fnV2dnS2tjR2tjU2dj4+Pj+/v79/v7c3t7Axsa/xsW/x8XLx8j4dof9aXzAgYj7+fr++Pj++Pn++Pn89/j8/f3+/v7+/v79+/z++Pn9+Pn++Pn+9/j9jZzsY3TAo6n93uP7c4X+fo7+fI3Sb3ji4+H9/v7+/Pz5laP+e4v+e4z+e4z8eYn+ZXnzZHfxo67+e4z+Z3v+aXv+aX27Wmfg4eH+/v7GuLzpcYD+aXz+aXz+aXz+aXz+aXz+aHz+aHv+aXv+aXz+aXz9anyhc3j2+Pf99PXzwsr7qLT+aXv+aXz+aHv+aHv+aHv+aXv/aXv+aXz+aXv+aHzcYnSorrD+/v6/kpj9YHT+Y3b+aHv+aXv+aXz+aXz/aHv/aXz/aXz/aXz+aHz+aX2bY23y8vL90Nb9qbT9boD+aXz/aXz/aXz/aXz/aXz/aXz/aXz/aXz/aXz+aXv5aHu1pKn+3uT9bH7+Y3f+aHv+aXz/aXz/aXz/aXz/aXz/aXz/aXz/aXz/aXz+aHz9Z3v3laL9cYL+Z3r+aHz+aHv/aHz/aXz/aXz/aXz/aXz/aXwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</icon>
</button>
</custombuttons>

 

step 4.

Host the xml file on line  – I called it slashdot_button.xml

Then let people download it from

http://toolbar.google.com/buttons/add?url=http%3A%2F%2Fwww.cheapflights.ie%2Fslashdot_button.xml

 

Categories: Uncategorized

“Cannot open SQL server” bug Crystal Reports

This one baffled me for a while. I was trying to connect to a Crystal Report from VB, with an Access database. And it was giving me a "Cannot open SQL server", even though I was not using SQL server.
 
Under Database / Add Database, you have several options to add an access database,
eithe ODBC, OLEDB or Database File.
 
I found that Database File worked, the other two didn’t. This could be down to the
connection string that I used in my program though.
 
 
 
 
Categories: Uncategorized

IT clearout

Hi,
 
   I’m clearing out my house of some books and equipment, prob. going to list them on ebay soon. If you’re interested in any of these, drop a note on the blog or by email.
 
http://www.blackcomb.co.uk/pics/040306_0912~02.jpg Developing windows based applications in c#
 
http://www.blackcomb.co.uk/pics/040306_0918~01.jpg Net2Plug power cable home networking kit.
Categories: Uncategorized

speeding up full text indexing

Categories: Uncategorized

Changing a default on a column on SQL

If you set a default value to a column, then try to drop that column, in MS SQL, you sometimes get obscure errors like this.
 
Server: Msg 5074, Level 16, State 1, Line 1
The object ‘DF__question_v__type__50C5FA01’ is dependent on column ‘type’.
Server: Msg 4922, Level 16, State 1, Line 1
ALTER TABLE DROP COLUMN type failed because one or more objects access this column.
I have found that this can be fixed with this command:
 
alter table question_values drop constraint DF__question_v__type__4FD1D5C8
 
Where the table name would be changed to fit your own purposes.
Categories: Uncategorized

Passing foreign charachters in a URL

Categories: Uncategorized

Getting more out of your 500 Internal Server Error

When you make a request from .NET to a remote page, and that page crashes with a 500 error. the exception thrown doesn’t normally tell you anything more than a 500 server error has occurred. You can get the exact html from the page using this:

 

try

{

httpresponse = (HttpWebResponse)httprequest.GetResponse();

}

catch(Exception e)

{

if(e is WebException)

{

WebException wexError = (WebException)e;

if(wexError.Status == WebExceptionStatus.ProtocolError)

{

WebResponse wrError = wexError.Response;

Stream stmError = wrError.GetResponseStream();

StreamReader srError= new StreamReader(stmError);

string strError = srError.ReadToEnd();

System.Diagnostics.Debug.Write(strError);

throw(e);

}

}

}

 

This really helped me!

 

Also, If anyone is interested in a freelance .NET development job, please have a look at http://www.webtropy.com/articles/joboffer.asp

Categories: Uncategorized

Iframe preloader

Categories: Uncategorized

Changing the dataType of a DataColumn after it has data

I was looking into a problem where a datagrid had a datetime field that was being sorted alphabetically rather than chronologically.
 
This was happening because the datacolumn was a string rather than a DateTime, it had to remain a string for formatting purposes. You can’t change it by Just saying DataColumn.DateType=… because the column had data already: However, this is how I changed it:
 

private void changeColumnType(string columnName,System.Type newType,ref DataTable inputTable)

{

DataColumn dcUpdated;

dcUpdated = inputTable.Columns.Add("_temp_", newType);

foreach(DataRow drUpdated in inputTable.Rows)

{

drUpdated["_temp_"] = drUpdated[columnName].ToString();

}

inputTable.Columns.Remove(inputTable.Columns[columnName]);

dcUpdated.ColumnName = columnName;

}

 
 
Categories: Uncategorized

App.path for access

Categories: Uncategorized