mikedopp

Geekswithblogs (edition)

  Home  |   Contact  |   Syndication    |   Login
  68 Posts | 0 Stories | 46 Comments | 0 Trackbacks

News

Twitter












Tag Cloud


Archives

My Blogs

Wednesday, September 10, 2008 #

I have been coding using Microsoft technologies for a long while. Recently I was given the chance to do a little bit of web mastering. Due to my system admin background I was most definitely game for this.

Learning IIS 6.0 was not a huge leap as I had done a lot of development using IIS5.1(Windows XP Professional); however I had not as yet used Host headers in IIS (IIS 5.1 only allows for one site. I will post about that later.). This was a learning experience (Don’t even get me started on the issue of multiple SSL sites or web gardens). Aa479040.scalability_fig02(en-us,MSDN.10)

I was doing some trail blazing while coming up with a build document to track my progress and to double check all my configurations. I highly recommend this process due to it has saved my bacon multiple times.

Uploaded all the sites and got the host headers configured correctly and moved the SSL (Secure Socket Layer)certifications over to the virgin IIS server when I noticed that not all my sites were happily working. Rendering was slow and some were just crashing. Crap time to take out the build document and rehearse my steps.

Getting through all the steps and all seemed fine. I could not find a reason my sites were acting all sorts of funky and the server processes were pegged out (running at 100%). I stressed and then went to my friend Google for some answers. I found some interesting little applications to monitor and test your sites.

IISReporter Cool little app to see how many people are logged in as well as a log viewer.

IISTrafficMonitor Another great application for watching real time traffic as well as a log viewer *may add extra cpu cycles*

IIS Web Application Stress Tool Just like the name implies it stresses your web applications

LoadRunner Add web traffic load to see what you Server(IIS) can handle. Before it all comes crashing down.

Web Application Stress Tool Another great Stress tool.

The rest are Microsoft utilities for your disposal.

IIS Diagnostics Toolkit 

IIS 6.0 Resource Kit Tools

Windows Server 2003 Resource Kit Tools

Creating Stress Tests for Web Applications

WCat Web Capacity Analysis Tool

These tools are guaranteed to help you in testing your server as well as your applications.

Digg This

Wednesday, September 03, 2008 #

Too Many cooks in the kitchen. When is too many developers one project a bad idea?

So I had the chance to meet with some friends the other day.AgileCrapDevelopement Of course they work as developers like me. They work for one of those companies with allot of money to throw at a web site (a == 1). I found it interesting having 20 developers writing code for a web site. They called it Agile programming or Extreme Programming (Developer Humping). The reason I  called it this was as they (my friends) described agile as two developers sit in a cubicle(but of course no office unless your management right?) one developer coded while the other sat behind him correcting his mistakes.

So what bothered me most was having another developer watching over your shoulder as you coded. Like what the hell. How is that environment inviting to any developer? So here is my way of disgracing this habit as well as promoting it I guess.

Disgracing:

1. Cost is way more than your ROI (Return of Investment) on any project (yes I will argue this.)

2. It is said this type (Developer Humping) of development is good for the customer. what? how does that translate?

3. Somehow Projects get done faster? (wow I could argue that all day.) This goes back to the too many cooks in the kitchen mentality.

Promoting:

1. Both developers learn quick and bounce ideas off of each other.

2. Micro management of developers is much easier.

So in theory if your company has the money to spend tons of money on 2 developers per cubie(cubicle for those not in cubicles) and developing for 1 web site good on you. Truly in my humble opinion Agile development should be used for large “Software” companies with budgets for multiple projects.

This is what our friends at Wikipedia had to say:

Extreme Programming (or XP) is a software engineering methodology (and a form of agile software development)[1][2][3] prescribing a set of daily stakeholder practices that embody and encourage particular XP values (below). Proponents believe that exercising these practices—traditional software engineering practices taken to so-called "extreme" levels—leads to a development process that is more responsive to customer needs ("agile") than traditional methods, while creating software of better quality.

So why do I seem against this type of development? I guess I am not all that much impressed with it. I love team development. I truly encourage it. I am not of the mind “put a developer in a closet with pizza and a coke and leave him/her be”. I however like my space and love to collaborate with my fellow developers on multiple projects.

Currently I work on multiple web sites at the same time. I like to call it the shotgun development method. I work with 2 other excellent web developers. One is front end (the famous joe) his code is second to none. Then I work with new guy Bryan (still waiting on a blog bryan) who is the C# guru. We all have our pieces of the projects we work on. This is a great work environment. Typically called the Waterfall method.

No developer humping here just straight work hard and enjoy the team work involved.

 

Let me know how you feel.

Digg This

Monday, June 23, 2008 #

Technorati Profile

Tuesday, June 10, 2008 #

 

TitlePic

I know what your thinking. Oh crap here he goes again with recommending tools and or services. My question is have I ever steered you wrong?

Yes I normally deal in freeware tools. Mostly due to me being cheap and thinking my skills should push me past that latest issue with code. So why recommend a commercial tool? Good question. A friend recommended to me this tool. I had used tools like .net reflector to look into DLL’s to understand the application I am adding. I had heard rumor of NDepend however with all the different “N” products out there I was like another database OR mappers right? Or maybe another subversion type software.

So I downloaded the tool to see what if anything this tool had to offer. So once I downloaded the software and ran it. I was interested to see what it would do.

InstallNDependVS

 

 

 

 

 

 

 

 

 

 

It installed nicely into Visual Studio 2005 as well as Visual 2008. A plugin for an Addin for Reflector.

I wanted to see what it would do with one of my most complicated E-commerce applications (http://www.Buylifetime.com). I was surprised to notice the amount of extra DLL’s I was not in need of to make the application to work.

Simply put this application should be included with all Visual Studio Installs. It is that important. If Performance as well as clean code is important to you or your business you should have this to view all your important applications.

I would like to go over all the great features as well as the benefits however they are too much and too many to list.Purchase your copy today and see how much more rapid your development becomes.

NDepend  includes a list of CQL rules and queries in VisualStudio that will update it in real-time each time the developer compiles. This way, the developer know as soon as he is doing a mistake. Also, the possibilituy to query the codebase real-time can be useful in Visual Studio.

 

 

 


Wednesday, May 14, 2008 #

Have you ever been styling your page and the design asks for a 1px dotted?

Take a moment breath and I mean breath without expelling a whole lot of cuss words due to the fact IE 6 and 7 see 1px dotted as a solid line.

Let the designer know you have to bump up the pixels to 2px for dotted lines to work.

This hint would have helped me in hours of pulling out my hair and arguments.

Enjoy!


Thursday, May 01, 2008 #

If your like me you develop in multiple servers. Using Terminal Services is a easy way to move through these servers remotely and with ease. Often I have 6 or more Remote Sessions open at one time. This as you can well imagine can get very confusing. I got to the point I felt I needed better way to brand my Desktop sessions. I tried wallpaper which by the way works well also. However this trick works as a supplement to the wallpaper trick.This registry edit will add text to the login string on the login after you hit "ctrl alt delete" giving you a chance to identify the machine in case you get confused.

"

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]

"welcome"="Good Times Enter your own welcome message here"

 

"

Make sure the "welcome" is a String when adding it to the registry.


Thursday, April 24, 2008 #

Most of you would rather the the first title before or.
Can't Remember where I got most of this script(if you know please send me a hate email) however I did some enhancements and I am reposting it.

DECLARE @DBName varchar(255)

DECLARE @DATABASES_Fetch int

DECLARE DATABASES_CURSOR CURSOR FOR
    select
        DATABASE_NAME   = db_name(s_mf.database_id)
    from
        sys.master_files s_mf
    where
       -- ONLINE
        s_mf.state = 0

       -- Only look at databases to which we have access
    and has_dbaccess(db_name(s_mf.database_id)) = 1

        -- Not master, tempdb or model
    and db_name(s_mf.database_id) not in ('Master','tempdb','model')
    group by s_mf.database_id
    order by 1

OPEN DATABASES_CURSOR

FETCH NEXT FROM DATABASES_CURSOR INTO @DBName

WHILE @@FETCH_STATUS = 0
BEGIN
    declare @DBFileName varchar(256)   
    set @DBFileName = datename(dw, getdate()) + ' - ' +
                       replace(replace(@DBName,':','_'),'\','_')+ '.BAK'

    exec ('BACKUP DATABASE [' + @DBName + '] TO  DISK = N''D:\dbbackup\' +
        @DBFileName + ''' WITH NOFORMAT, INIT,  NAME = N''' +
        @DBName + '-Full Database Backup'', SKIP, NOREWIND, NOUNLOAD,  STATS = 100')

    FETCH NEXT FROM DATABASES_CURSOR INTO @DBName
END

CLOSE DATABASES_CURSOR
DEALLOCATE DATABASES_CURSOR

Make sure the backup path exists on the server.


Sunday, March 30, 2008 #

So here is a question why would you want to add your Meta Tags via code? Kinda silly right? Cause if you were a great developer you probably have a whole list of meta tags you have created for your portfolio of web sites right?

Well if you are the developer who has those templates you most likely will stop reading here and think this mikedopp character is kinda wierd or is one of those "because you can" type people. I know I am adding much too much fluff to this whole entry and spending too much time with words so here is the code to add meta tags to your on load event of either your master pages or just to that web site that you need to get out the door tonight.

private void AddMetaTags()
    {
        if (this.Page != null)
        {
            base.Title = Server.HtmlEncode(this.Page.Title);
            base.AddMetaTag("keywords", Server.HtmlEncode(this.Page.Keywords));
            base.AddMetaTag("description", Server.HtmlEncode(this.Page.Description));
        }
    }

As an added bonus you could just create a large list of meta tags in your web.config file or another dot config file within your application or site that is just read into the site on_load.

There is also the possibility of having a large SQL/XML table that holds all your tags and is read in based upon the name of the page and content that is requested.

#Region ---This is where I go on a rant--- Feel free to get some popcorn and a diet mountain dew---

However since the only search provider that reads meta tags is MSN Live search and not google as I have been told (I still don't believe that).

There is no point to this post. So go ahead an move on to the next post on how to put all your keywords in a database and read them into the page content based on the same factors (for Google of course).

#EndRegion---End of rant

 


If you don't know by now you can reset your web applications and or web sites with a simple change to the web.config. For example you can FTP(if remote or hosted) to your server and edit the web.config by adding a space or removing a space. Basically you want the application your using editing with think something has changed since you touched the document. Save the form after this has happened and IIS will recycle the application / web site.

This however can be tedious and just well feel like a bit of hacking. So what I have come up with is not rocket science and you most likely do not want in a easy to access area on your web form.

I add this little snippet to a button event on the form. So when ever the site needs a cleansing for what ever reason I push the button of recycle.

public bool RecycleApplication()
   {
       bool Success = true;

       //Method #1
       //   It requires high security permissions, so it may not
       //   work in your environment
       try
       {
           HttpRuntime.UnloadAppDomain();
       }
       catch (Exception ex)
       {
           Success = false;
       }

       //if (!Success)
       //{
       //    //Method #2
       //    //   By 'touching' the Web.config file, the application
       //    //   is forced to recycle
       //    try
       //    {
       //        string WebConfigPath = HttpContext.Current.Request.PhysicalApplicationPath + "\\\\Web.config";
       //        IO.File.SetLastWriteTimeUtc(WebConfigPath, DateTime.UtcNow);
       //    }
       //    catch (Exception ex)
       //    {
       //        Success = false;
       //    }
       //}

       return Success;

   }
   protected void Button1_Click(object sender, EventArgs e)
   {
       RecycleApplication();
   }

 

Once again probably not a standards compliant and not an elegant way of recycling the application / web site. However it does the job.


Thursday, March 20, 2008 #

This has been pooled together from a number of resources:

What is ASP.NET?

Microsoft ASP.NET is a server side technology that enables programmers to build dynamic Web sites, web applications, and XML Web services. It is a part of the .NET based environment and is built on the Common Language Runtime (CLR) . So programmers can write ASP.NET code using any .NET compatible language.

What are the differences between ASP.NET 1.1 and ASP.NET 2.0?

A comparison chart containing the differences between ASP.NET 1.1 and ASP.NET 2.0 can be found over here.

Which is the latest version of ASP.NET? What were the previous versions released?

The latest version of ASP.NET is 2.0. There have been 3 versions of ASP.NET released as of date. They are as follows :

ASP.NET 1.0 – Released on January 16, 2002.

ASP.NET 1.1 – Released on April 24, 2003.

ASP.NET 2.0 – Released on November 7, 2005.

Additionally, ASP.NET 3.5 is tentatively to be released by the end of the 2007.

Explain the Event Life cycle of ASP.NET 2.0?

The events occur in the following sequence. Its best to turn on tracing(<% @Page Trace=”true”%>) and track the flow of events :

PreInit – This event represents the entry point of the page life cycle. If you need to change the Master page or theme programmatically, then this would be the event to do so. Dynamic controls are created in this event.

Init – Each control in the control collection is initialized.

Init Complete* - Page is initialized and the process is completed.

PreLoad* - This event is called before the loading of the page is completed.

Load – This event is raised for the Page and then all child controls. The controls properties and view state can be accessed at this stage. This event indicates that the controls have been fully loaded.

LoadComplete* - This event signals indicates that the page has been loaded in the memory. It also marks the beginning of the rendering stage.

PreRender – If you need to make any final updates to the contents of the controls or the page, then use this event. It first fires for the page and then for all the controls.

PreRenderComplete* - Is called to explicitly state that the PreRender phase is completed.

SaveStateComplete* - In this event, the current state of the control is completely saved to the ViewState.

Unload – This event is typically used for closing files and database connections. At times, it is also used for logging some wrap-up tasks.

The events marked with * have been introduced in ASP.NET 2.0.

You have created an ASP.NET Application. How will you run it?

With ASP.NET 2.0, Visual Studio comes with an inbuilt ASP.NET Development Server to test your pages. It functions as a local Web server. The only limitation is that remote machines cannot access pages running on this local server. The second option is to deploy a Web application to a computer running IIS version 5 or 6 or 7.

Explain the AutoPostBack feature in ASP.NET?

AutoPostBack allows a control to automatically postback when an event is fired. For eg: If we have a Button control and want the event to be posted to the server for processing, we can set AutoPostBack = True on the button.

How do you disable AutoPostBack?

Hence the AutoPostBack can be disabled on an ASP.NET page by disabling AutoPostBack on all the controls of a page. AutoPostBack is caused by a control on the page.

What are the different code models available in ASP.NET 2.0?

There are 2 code models available in ASP.NET 2.0. One is the single-file page and the other one is the code behind page.

Which base class does the web form inherit from?

Page class in the System.Web.UI namespace.

Which are the new special folders that are introduced in ASP.NET 2.0?

There are seven new folders introduced in ASP.NET 2.0 :

\App_Browsers folder – Holds browser definitions(.brower) files which identify the browser and their capabilities.

\App_Code folder – Contains source code (.cs, .vb) files which are automatically compiled when placed in this folder. Additionally placing web service files generates a proxy class(out of .wsdl) and a typed dataset (out of .xsd).

\App_Data folder – Contains data store files like .mdf (Sql Express files), .mdb, XML files etc. This folder also stores the local db to maintain membership and role information.

\App_GlobalResources folder – Contains assembly resource files (.resx) which when placed in this folder are compiled automatically. In earlier versions, we were required to manually use the resgen.exe tool to compile resource files. These files can be accessed globally in the application.

\App_LocalResources folder – Contains assembly resource files (.resx) which can be used by a specific page or control.

\App_Themes folder – This folder contains .css and .skin files that define the appearance of web pages and controls.

\App_WebReferences folder – Replaces the previously used Web References folder. This folder contains the .disco, .wsdl, .xsd files that get generated when accessing remote web services.

Explain the ViewState in ASP.NET?

Http is a stateless protocol. Hence the state of controls is not saved between postbacks. Viewstate is the means of storing the state of server side controls between postbacks. The information is stored in HTML hidden fields. In other words, it is a snapshot of the contents of a page.

You can disable viewstate by a control by setting the EnableViewState property to false.

What does the EnableViewState property signify?

EnableViewState saves the state of an object in a page between postbacks. Objects are saved in a Base64 encoded string. If you do not need to store the page, turn it off as it adds to the page size.

There is an excellent article by Peter Bromberg to understand Viewstate in depth.

Explain the ASP.NET Page Directives?

Page directives configure the runtime environment that will execute the page. The complete list of directives is as follows:

@ Assembly - Links an assembly to the current page or user control declaratively.

@ Control - Defines control-specific attributes used by the ASP.NET page parser and compiler and can be included only in .ascx files (user controls).

@ Implements - Indicates that a page or user control implements a specified .NET Framework interface declaratively.

@ Import - Imports a namespace into a page or user control explicitly.

@ Master - Identifies a page as a master page and defines attributes used by the ASP.NET page parser and compiler and can be included only in .master files.

@ MasterType - Defines the class or virtual path used to type the Master property of a page.

@ OutputCache - Controls the output caching policies of a page or user control declaratively.

@ Page - Defines page-specific attributes used by the ASP.NET page parser and compiler and can be included only in .aspx files.

@ PreviousPageType - Creates a strongly typed reference to the source page from the target of a cross-page posting.

@ Reference - Links a page, user control, or COM control to the current page or user control declaratively.

@ Register - Associates aliases with namespaces and classes, which allow user controls and custom server controls to be rendered when included in a requested page or user control.

This list has been taken from here.

Explain the Validation Controls used in ASP.NET 2.0?

Validation controls allows you to validate a control against a set of rules. There are 6 different validation controls used in ASP.NET 2.0.

RequiredFieldValidator – Checks if the control is not empty when the form is submitted.

CompareValidator – Compares the value of one control to another using a comparison operator (equal, less than, greater than etc).

RangeValidator – Checks whether a value falls within a given range of number, date or string.

RegularExpressionValidator – Confirms that the value of a control matches a pattern defined by a regular expression. Eg: Email validation.

CustomValidator – Calls your own custom validation logic to perform validations that cannot be handled by the built in validators.

ValidationSummary – Show a summary of errors raised by each control on the page on a specific spot or in a message box.

How do you indentify that the page is post back?

By checking the IsPostBack property. If IsPostBack is True, the page has been posted back.

What are Master Pages?

Master pages is a template that is used to create web pages with a consistent layout throughout your application. Master Pages contains content placeholders to hold page specific content. When a page is requested, the contents of a Master page are merged with the content page, thereby giving a consistent layout.

How is a Master Page different from an ASP.NET page?

The MasterPage has a @Master top directive and contains ContentPlaceHolder server controls. It is quiet similar to an ASP.NET page.

How do you attach an exisiting page to a Master page?

By using the MasterPageFile attribute in the @Page directive and removing some markup.

How do you set the title of an ASP.NET page that is attached to a Master Page?

By using the Title property of the @Page directive in the content page. Eg:

<@Page MasterPageFile="Sample.master" Title="I hold content" %>

What is a nested master page? How do you create them?

A Nested master page is a master page associated with another master page. To create a nested master page, set the MasterPageFile attribute of the @Master directive to the name of the .master file of the base master page.

What are Themes?

Themes are a collection of CSS files, .skin files, and images. They are text based style definitions and are very similar to CSS, in that they provide a common look and feel throughout the website.

What are skins?

A theme contains one or more skin files. A skin is simply a text file with a .skin extension and contains definition of styles applied to server controls in an ASP.NET page. For eg:

<asp:button runat="server" BackColor="blue" BorderColor="Gray" Font-Bold ="true" ForeColor="white"/>

Defines a skin that will be applied to all buttons throughout to give it a consistent look and feel.

What is the difference between Skins and Css files?

Css is applied to HTML controls whereas skins are applied to server controls.

What is a User Control?

User controls are reusable controls, similar to web pages. They cannot be accessed directly.

Explain briefly the steps in creating a user control?

· Create a file with .ascx extension and place the @Control directive at top of the page.

· Included the user control in a Web Forms page using a @Register directive

What is a Custom Control?

Custom controls are compiled components that run on the server and that encapsulate user-interface and other related functionality into reusable packages. They can include all the design-time features of standard ASP.NET server controls, including full support for Visual Studio design features such as the Properties window, the visual designer, and the Toolbox.

What are the differences between user and custom controls?

User controls are easier to create in comparison to custom controls, however user controls can be less convenient to use in advanced scenarios.

User controls have limited support for consumers who use a visual design tool whereas custom controls have full visual design tool support for consumers.

A separate copy of the user control is required in each application that uses it whereas only a single copy of the custom control is required, in the global assembly cache, which makes maintenance easier.

A user control cannot be added to the Toolbox in Visual Studio whereas custom controls can be added to the Toolbox in Visual Studio.

User controls are good for static layout whereas custom controls are good for dynamic layout.

Where do you store your connection string information?

The connection string can be stored in configuration files (web.config).

What is the difference between ‘Web.config’ and ‘Machine.config’?

Web.config files are used to apply configuration settings to a particular web application whereas machine.config file is used to apply configuration settings for all the websites on a web server.

Web.config files are located in the application's root directory or inside a folder situated in a lower hierarchy. The machine.config is located in the Windows directory Microsoft.Net\Framework\Version\CONFIG.

There can be multiple web.config files in an application nested at different hierarchies. However there can be only one machine.config file on a web server.

What is the difference between Server.Transfer and Response.Redirect?

Response.Redirect involves a roundtrip to the server whereas Server.Transfer conserves server resources by avoiding the roundtrip. It just changes the focus of the webserver to a different page and transfers the page processing to a different page.

Response.Redirect can be used for both .aspx and html pages whereas Server.Transfer can be used only for .aspx pages.

Response.Redirect can be used to redirect a user to an external websites. Server.Transfer can be used only on sites running on the same server. You cannot use Server.Transfer to redirect the user to a page running on a different server.

Response.Redirect changes the url in the browser. So they can be bookmarked. Whereas Server.Transfer retains the original url in the browser. It just replaces the contents of the previous page with the new one.

What method do you use to explicitly kill a users session?

Session.Abandon().

What is a webservice?

Web Services are applications delivered as a service on the Web. Web services allow for programmatic access of business logic over the Web. Web services typically rely on XML-based protocols, messages, and interface descriptions for communication and access. Web services are designed to be used by other programs or applications rather than directly by end user. Programs invoking a Web service are called clients. SOAP over HTTP is the most commonly used protocol for invoking Web services.

del.icio.us Tags: , , , , ,

LiveJournal Tags: , , , , ,