A Couple Must Read ASP.NET Articles

June 10, 2008 21:13 by Dominick

Speed up access to your favorite frameworks via the AJAX Libraries API

This is just a fantastic idea. It's very simple. Use Google's extensive infrastructure to serve those common JavaScript libraries you love to use. I've recently started using jQuery so all I have to do is point the link to the URL provided by Google and that's 17kb per request my server won't have to turn out. Thanks, Google!

CSS Message Boxes for different message types 

This comes from one of the best new sites out there "Janko At Warp Speed". This article shows us how to handle a few common message types within our applications. It's all CSS and very sharp!



Tags:
Categories: ASP.NET | Tip/Trick | General | Javascript
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed


A Few Quick Tips to Get More Visitors

November 28, 2007 19:46 by Dominick

Its fairly easy to get people to visit your website. All you need is a few dollars for advertising and you can get people on your site. The problem is getting people to actually stay and interact. I would guess that around 1% of the people that arrive from Google advertisements actually stay around and/or come back. That's not a very good rate if you ask me. Is it worth the money? Not at all. Its just my opinion, but I think using Google Adwords should only be used when you first start up your site and have no other way of becoming visible.

The best way I've found to get people to hang around is posting stories on social bookmarking sites like DotNetKicks, DZone and Digg. This is nothing groundbreaking, but you should know that these are wonderful sources of "free" traffic if you don't already. The visitors tend to stay longer, read related posts and even sign up for your rss feeds. You just never know what's going to be a "hit" and cause lots of traffic to come your way.  I had a story about SubSonic make the main page on DotNetKicks and DZone at the same time. That was fun and very satisfying. 

I tried StumbleUpon's advertising service for another site, ConservativeKicks.com, but the results were even less impressive than the Google ads. I recommend these actions when you start a new web site:

  • Start posting comments on related websites (make sure you have links back to your website in your sig)
  • Buy some Google ad space. You've got to get people on your site, but don't go overboard. Set a daily budget you can afford
  • Post links to your posts on social bookmarking sites. They are the best way to drive traffic to your site
  • Submit your site to StumbleUpon and consider using their paid service because it does drive a lot of traffic to your site and you never know what will make them stay on your site.
  • Make friends with other website owners. Cross-site linking can help everyone involved.
kick it on DotNetKicks.com

Tags:
Categories: ASP.NET | SubSonic | General
Actions: E-mail | Permalink | Comments (1) | Comment RSSRSS comment feed


3 Open Source Apps I'm Thankful For

November 21, 2007 22:17 by Dominick

Its the time of year again (for us in the US) to stuff ourselves even more than usual. I love turkey and all the other traditional Thanksgiving foods. Its a day where I tend to lose all self control.

I'm thankful for the following things (.NET related):

  1. SubSonic

    The program I use the most by far. I use it in nearly every new project I start. It has saved me an incredible amount of time over the last year. Its all about finding ways of being more productive and eliminating CRUD. I spent too many years coding SQL right into my pages. Bad times. I can't say too many good things about SubSonic. Its worth using now just to be ready for when its included in some later version of dotnet.

  2. DotNetKicks

    The site and the open source software. I've been visiting DotNetKicks.com for most of this last year and I consider it to the leading resource for everything dotnet. I love the site and I love the open source software powering it. I liked it so much that I started my own site, ConservativeKicks.com, with it. It was a pain to get going, but it was well worth it. It also uses SubSonic so its easy as pie to deal with on the backend.

  3. BlogEngine.NET

    I use this software for this blog. It was very simple to setup and get going. It has all the features I need and it just works. I suggest giving it a try if you're looking for a good blogging engine. It doesn't use SubSonic, but I'm not looking for an application that I'll need to customize too much. I just want to hit start and write. BlogEngine.NET does that very well.

Happy Thanksgiving, everybody. Be safe and have fun. See you all after the holiday. 

Tags:
Categories: ASP.NET | Open Source | SubSonic | General
Actions: E-mail | Permalink | Comments (7) | Comment RSSRSS comment feed


Microsoft Access is Still Extremely Useful

November 12, 2007 22:15 by Dominick

Part of my new job has been to automate a few spreadsheets and joining data from separate systems. I'm much more comfortable working in ASP.NET, but I have a lot of background with MS Access so I don't mind at all. In fact its nice to "go back" a little and see how quickly you can do simple things in Access. You can set up tables, queries and forms in minutes. The built-in wizards make creating a basic form in a crunch very easy. The reporting component is extremely powerful. It has its limitations, of course, but with a little hacking you can get it to do that Gantt chart you needed or some crazy conditional formatting if you must. There haven't been many times where I"ve had to go outside of Access to build a report. Mostly roll-your-own type of things.

Its refreshing to jump into Access, create a couple tables or import data from Excel, run the form creation wizard and your done. You now have an easy way to navigate through your records and the ability to change the data within the form.  In ASP.NET you've got to jump through a few hoops to get to that point (SubSonic's wonders aside). Using Access for non-authenticated forms and reports in a pinch is a fantastic alternative to a full-blown ASP.NET application. Its unmatched in its RAD capabilities and most people in your office will already have it installed on their PC. 

Its refreshing to jump into Access, create a couple tables or import data from Excel, run the form creation wizard and your done.

There are many times when creating a web-based application just isn't possible so using Access to merge some data is the way I look to go in those cases. Most people are already familiar with the standard Access forms and reports so the learning curve is fairly low. Don't depend on Access as your backend for a many-user environment because you will be flirting with disaster, but that wasn't the reason Access came into being. Use it for what it was meant for. Rapid application developement, prototyping and reporting.


kick it on DotNetKicks.com

Tags:
Categories: SQL | Database | MS Access | General
Actions: E-mail | Permalink | Comments (4) | Comment RSSRSS comment feed


Job Changes are Life Changes

November 8, 2007 00:24 by Dominick

  I started a new job this week after spending four years with my previous company. I was completely burnt out working crazy hours. I managed it well enough for the first three years, but in the end it was just too much stress. I've never put this much effort into any other company I had ever worked for. I actually relocated to another state for two years when requested to do so. I was given an offer that I couldn't refuse thus my soul had been sold.



You hear this often, but I can tell you for sure that it ts completely correct. Money isn't everything. You can't live without it, true, but happiness it does not bring. You come to realize that family is the most important thing in life when you're away from them for an extended period. We made many trips back home, but it was really exhausting. We finally made the choice to move back home and were lucky enough to do so with the same company.

Avoiding burnout is basically about pressure and time. How much can you take for how long? This is different for everybody, but make no mistake that we all have a limit. The difference is some of us choose to act to change the situation and others find it easier to just exist as one of the "working dead". I probably waited a little too long, but in the end it worked out just fine. My new company seems great and my free time has increased.

The way you act when you come home from work can change dramatically when you have a rewarding job with lower stress. How much quality time you spend with your family is how happiness should be defined. Not working till 2am to get some rediculous deadline met. This will not happen and my new job and I will be able to spend more time with my family. I hope that anybody out there reading this who is in a stressful situation at their job takes this advise: get out now!

kick it on DotNetKicks.com

Tags:
Categories: Life | General
Actions: E-mail | Permalink | Comments (3) | Comment RSSRSS comment feed


Announcing ConservativeKicks.com

November 5, 2007 19:39 by Dominick
I've created a new site called ConservativeKicks.com using the DotNetKicks open source project software. For those that don't know DotNetKicks is software that allows you to create a community driven news and article link site. Its very similar to Digg.com in functionality. You post a story and if you get enough "Kicks" then it will show on the front page where you will get a lot more exposure. Another great feature is that it allows the users posting a story to share 50% of the google ad money.

I launched the site because I noticed a lot of liberal-leaning articles and comments on sites such as Digg.com. I thought it would be a nice balance to have a place where you know you will find conservative news, opinions and articles. For the moment all the ad money is going back to the DotNetKicks to help support them. Please feel free to provide feedback. Comments are always welcome.



Formal education often means nothing

November 2, 2007 08:47 by Dominick

If you have ever been in the position to hire a programmer then chances are you already agree with me. I've been involved in lots of interviews with candidates for programming/web development jobs. After reviewing a candidate's resume it is still difficult to really judge their knowledge. Even if the candidate has every certification you can think of with tons of education and the do very well in the interview you still don't have a good enough idea whether to hire them or not. I've seen people hired with these qualifications, but when they start working they don't even know how to connect to a SQL database or grab code from a Subversion repository.

The best way to judge a candidate, in my opinion, is to see samples of their work. Hopefully they've created their own web site(s) on the side that can easily show their talents. If not they need to show me work they've done at their previous job. I will never approve of a candidate that I've not seen samples of their work that has been verified as their own. No set of interview questions can truly replace this.



Tags:
Categories: General
Actions: E-mail | Permalink | Comments (1) | Comment RSSRSS comment feed


Howto: Create a Custom Control in ASP.NET (C#)

October 30, 2007 12:34 by Dominick

Introduction

Creating custom controls can save you a lot of time and effort when building an application. The built-in sever controls provided can do just about anything you need them to, but sometimes it takes a great deal of coding (hacking) to make it do exactly what you want it to do. Consider the possibility that you need a textbox control that you would like to be able to assign a readony property to it so it either renders as a regular textbox if false or plain text if true. You may also want a textbox that will cause it's on "OnTextChanged" to bubble up in the "GridViewCommandEvent" of a Gridview control. By default the textbox does not support that.

Afterwards there will be Cake

Create a new Web Control Library project within the solution you want to add the control to. Here is the location to do so in my Visual Studio installation.



Visual Studio has created a file called "WebCustomControl1.cs" within that project. You can rename it to whatever you like. This file is where you can insert the code that I'll show below. I'm going to show you the entire code right now. I've put some comments in to explain what's going on. Just copy and paste this code inside the cs file.

using System;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CustomControls.UI.Controls
{
    [DefaultProperty("Text")]
    [ToolboxData("<{0}:CustomTextBox runat=server></{0}:CustomTextBox>")]
    public class CustomTextBox : TextBox //with this you can override all the normal "stuff" within the textbox control
    {

       //Here are the properties that will be used for the command event

        [Bindable(true)]
        [Category("Custom")]
        [DefaultValue("")]
        [Localizable(true)]
        public string CommandName
        {
            get
            {
                string s = ViewState["CommandName"] as string;
                return s == null ? String.Empty : s;
            }
            set
            {
                ViewState["CommandName"] = value;
            }
        }

        [Bindable(true)]
        [Category("Custom")]
        [DefaultValue("")]
        [Localizable(true)]
        public string CommandArgument
        {
            get
            {
                string s = ViewState["CommandArgument"] as string;
                return s == null ? String.Empty : s;
            }
            set
            {
                ViewState["CommandArgument"] = value;
            }
        }

        [Bindable(true)]
        [Category("Custom")]
        [DefaultValue("False")]
        [Localizable(true)]
        public string IsReadOnly
        {
            get
            {
                string s = ViewState["IsReadOnly"] as string;
                return s == null ? String.Empty : s;
            }
            set
            {
                ViewState["IsReadOnly"] = value;
            }
        }
        
        protected static readonly object EventCommandObj = new object();

        public event CommandEventHandler Command
        {
            add
            {
                Events.AddHandler(EventCommandObj, value);
            }
            remove
            {
                Events.RemoveHandler(EventCommandObj, value);
            }
        }

        //this will raise the bubble event
        protected virtual void OnCommand(CommandEventArgs commandEventArgs)
        {
            CommandEventHandler eventHandler = (CommandEventHandler)Events[EventCommandObj];
            if (eventHandler != null)
            {
                eventHandler(this, commandEventArgs);
            }
            base.RaiseBubbleEvent(this, commandEventArgs);
        }

        //this overrides the OnTextChanged event on the normal textbox
        protected override void OnTextChanged(EventArgs e)
        {
            base.OnTextChanged(e);

            if (AutoPostBack)
            {
                //pass the event arguments to the OnCommand event to bubble up
                CommandEventArgs args = new CommandEventArgs(this.CommandName, this.CommandArgument);
                OnCommand(args);
            }
        }

        protected override void CreateChildControls()
        {
            base.CreateChildControls();
        }

        protected override void Render(HtmlTextWriter writer)
        {
            //if its readonly then render the text in a span tag
            if (IsReadOnly == "True")
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID);
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
                writer.Write(this.Text);
                writer.RenderEndTag();
            }
            else
            {
                //if not then render the textbox
                base.Render(writer);
            }
        }
    }
}

The Cake is a Lie

Now anytime you need to have the OnTextChanged event fire and bubble up within a Gridview than just use this control. It will also be very handy to do able to cause the textbox to become truely readonly.

 

kick it on DotNetKicks.com