Open Web Tools Directory

Not too long ago, Mozilla launched an extreme pleasent and fairly easy to use Web Tools directory which includes many easy to use and sometimes hard to remember names of frameworks, debugging tools, and et cetera.Open Web Tools Directory

Mouse Overs For ASP.NET

Have you ever wanted to have the ability for the colour of a row to change when your user moves the mouse over top of a particular row, and then change the colour back whenever the cursor is moved back off?

Well, this process isn’t very difficult in fact using some knowledge of JavaScript & the Document Object Model (DOM) we can dynamically change the background colour.

We need to override the Render class and then add some attributes to each GridViewRow before the page is finally output to the browser.

In this example, I have called the gridview we are adding the mouseovers and mouseouts “gvClients” because it displays a list of my fictional company’s clients. Wherever you see gvClients you need to make sure that you change this to your respective gridview’s name.

protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
   /*Using a simple foreach we iterate through the Rows and use the row.Attributes.Add() and pass in the javascript property we want to output as    html, along with the function we will use and then because asp.net usually dynmically creates the names for each item we need to use    the row.ClientID as this will exist only on the client side.
*/
foreach (GridViewRow row in gvClients.Rows)
{
  row.Attributes.Add(“onmouseout”, “ColorGridForMouseOut(‘” + row.ClientID + “‘);”);
  row.Attributes.Add(“onmouseover”, “ColorGridForMouseOver(‘” + row.ClientID + “‘);”);
}

//We finally just pass in the html that’s now been created.
base.Render(writer);
}

— Sample javascript

//Change Color of Gridview on MouseOut
function ColorGridForMouseOver(id) {
var el = document.getElementById(id);

if(el.currentStyle) // for msie
{
if (el.style.backgroundColor !=’orange’)
{
el.style.backgroundColor=’lightblue’;
el.style.cursor=’hand’;
}
}
else // for real browsers 😉
{
if (el.style.backgroundColor != ‘Orange’)
{
el.style.backgroundColor = ‘lightblue’;
el.style.cursor = ‘pointer’;
}
}
}

function ColorGridForMouseOut(id)
{
var el = document.getElementById(id);

if(el.currentStyle) // for msie
{
if (el.style.backgroundColor !=’orange’)
{
el.style.backgroundColor=’White’;
el.style.textDecoration=’none’;
}
}
else // for real browsers 😉
{
if (el.style.backgroundColor != ‘Orange’)
{
el.style.backgroundColor = ‘White’;
el.style.textDecoration=’none’;
}
}
}

Thank you for taking the time to visit.

Creating a Simple RSS Feed

RSS is an acronym for Really Simple Syndication and is an XML specification published by the W3C. RSS became a standardized specification around June 2000. This is meant to be a very simple primer on developing an RSS feed. Please note that this is not meant to replace a detailed book or the specification created by W3C. When I first created an RSS feed for a client the specification was the only way to learn RSS.

There are required elements to meet the specification as well as some optional. Some of the elements that are option really should be included logically.

Each RSS feed begins with a tag describing what XML specification the document meets. For example:

<?xml version=”1.0″?>

After the XML Version, we need to know which version of the RSS specification this document will meet. The rss document will also have a closing </rss> tag at the end.

So far, we have:
<?xml version=”1.0″?>
<rss version=”2.0″>
</rss>

The next tag we have is for a channel. A channel is a reverse-chronological list of links to stories that includes a title, and some sort of description.

The channel has a couple of required elements that are mostly self explanatory. The first one is a title (the name of the channel, usually just the website name), a link (to the website) and a description of the service.

So, we now have:
<?xml version=”1.0″?>
<rss version=”2.0″>
<channel>
<title>Brian R. Cline’s News Feed</title>
<link>http://www.brcline.com</link>

<description>Programming Blog for a Programmer Analyst in Niagara Falls, Ontario, Canada.</description>
</channel>
</rss>

There’s many optional elements to include within the channel, but I don’t feel that most are needed to produce a great and strictly valid RSS feed.

For example, there’s image which lets you specify a GIF,JPEG, or PNG to associate with the channel but not all RSS aggregators can show it.

The bulk of the RSS feed is created by using “items” which represent the story and usually include a title, link, and description. All elements of an item are actually optional, but you should include at least a title and description.

An item is fairly simple, here is an example:

<item>
<title>New Blog Post</title>
<link>http://www.brcline.com/blog/page?=13</link>

<description>Brian R. Cline posted about how to create an RSS feed.</description>
</item>

RSS channel’s usually include more than one item and are updated fairly regularly. I’ve included a couple of different items in the final example.

<?xml version=”1.0″?>
<rss version=”2.0″>
<channel>
<title>Brian R. Cline’s News Feed</title>
<link>http://www.brcline.com</link>

<description>Programming Blog for a Programmer Analyst in Niagara Falls, Ontario, Canada.</description>

<item>

<title>New Blog Post</title>

<link>http://www.brcline.com/blog/page?=13</link>

<description>Brian R. Cline posted about how to create an RSS feed.</description>

</item>

<item>

<title>New Blog Post – Welcome</title>

<link>http://www.brcline.com/blog/page?=1</link>

<description>Brian R. Cline posted a new blog welcoming users to the blog.</description>

</item>

<item>

<title>Blog Created</title>

<link>http://www.brcline.com/blog/ </link>

<description>Brian R. Cline adds wordpress to his website.</description>

</item>
</channel>
</rss>

Programming Excel Using Visual Basic 6

Microsoft provides the ability to programmatically created spreadsheets using Excel. The process isn’t overly complex, but the twist is that the intelisense is almost nonexistent in Visual Studio 6.0.

First we need to add a reference Microsoft Excel Object Library, on my particular Windows Computer it’s called the “Microsoft Excel 10.0 Object Library.” To be safe, we should also add the Microsoft Office Object Library; again on my particular Windows Computer it’s called “Microsoft Office 10.0 Object Library.”

We add the reference by clicking Project, and then References. Find the two object libraries mentioned and click their respective checkboxes and then click ok.

In this example, we’ll just programmatically add a couple of values to some cells, and do some basic formatting.

In the Code Window, we need to create the excel object and an excel workbook.

Dim Excl As New Excel.Application

Dim NewBook As Excel.Workbook

Dim lastRowNum as Integer ‘used to display lastRow

With Excl

Set NewBook = .Workbooks.Add

‘DisplayAlert and ScreenUpdating are two of the most useful features ‘when debugging excel, because they allow you to show excel and to hide ‘it if you don’t want the client to see if an instance of excel is running

.DisplayAlerts = False

.ScreenUpdating = False

End With

‘This next step is where we’re just going to add some data to a couple of cells

‘The format is Excel.Cells(rownumber, columnumber) . Rows and Columns ‘actually start with 1 being the first row.

With Excl

.Cells(1,1) = 5 ‘I wrote the number 5 in the first row, and first column

.Cells(1,2) = 6 ‘I wrote the number 6 in the first row, and 2nd column

.Cells(2,1) = 7 ‘I wrote the number 7 in the 2nd row, and 1st column

End With

‘Say I want to add two values using cell references

Excl.Cells(1,3). Formula = “A1+A2”

‘Let’s make the cell we just input the formula have a bold font.

‘Setting most of the front properties is as simple as selecting the cell and then ‘using .Font and finding the particular property you want to use

Excl.Cells(1,3).Font.Bold = true

‘Let’s change the Font Size to 12

Excl.Cells(1,3).Font.Size = 12

‘Saving a copy of the Excel document we have created is fairly simple

NewBook.SaveCopyAs App.Path & “test.xls”

‘Always make sure that you close the instance of Excel you opened because the ‘user will not know it is open and it can be a significant memory user.

NewBook.Close

Excl.Quit

Set NewBook = nothing

Set Excl = nothing

let me know if this was helpful!

Welcome

Greetings Visitor!

 

Wow, that sounded like a corny greeting from a science fiction movie. And, wow that totally wasn’t funny either!

 

This blog will serve as an interesting location for computer programming tutorials and articles as I learn and discover many new things on my journey to provide excellent software on schedule and on budget.

 

What might be included:

  •    Tips
  •   Tutorials
  •   Maybe a couple of technical book reports
  •    Critiques of new software and updates

I also want to hear back from you about new techniques and technologies you are trying in your project and having success with.

 

Brian R. Cline