Blog Home  Home Feed your aggregator (RSS 2.0)  
kevin Mocha - Friday, February 22, 2008
Bookmarks collected from web.
 
 Friday, February 22, 2008
<ItemTemplate>
    <tr class='<%# (Container.DataItemIndex % 2 == 0)?"even":"odd" %>'>    
<td>
<asp:LinkButton ID="EditButton" CommandName="Edit" runat="server"
Text="Edit"></asp:LinkButton> <asp:LinkButton ID="DeleteButton"
OnClientClick="return confirm('Delete Record?');"
CommandName="Delete" CommandArgument='<%# Eval("CustomerID")%>'
runat="server" Text="Delete"></asp:LinkButton> </td> <td> <%# Eval("CustomerID") %> </td> <td> <%# Eval("CompanyName") %> </td> <td> <%# Eval("ContactName") %> </td> <td> <%# Eval("ContactTitle") %> </td> <td> <%# Eval("Address") %> </td> <td> <%# Eval("City") %> </td> <td> <%# Eval("Country") %> </td> <td> <asp:LinkButton ID="lbOrders" runat="server" Text="Orders"
CommandName="ViewOrders"
CommandArgument='<%# Eval("CustomerID") %>' /> </td> </tr> <tr id="trOrders" runat="server" visible="false"> <td>&nbsp;</td> <td colspan="8"> <asp:GridView id="gvOrders" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" BorderStyle="Solid"
BorderWidth="1px" CellPadding="3" ForeColor="Black" GridLines="Vertical" Width="500px" EnableViewState="false"> <FooterStyle BackColor="#CCCCCC" /> <Columns> <asp:BoundField DataField="OrderID" HeaderText="OrderID" SortExpression="OrderID" /> <asp:BoundField DataField="OrderDate" HeaderText="OrderDate" SortExpression="OrderDate" HtmlEncode="false"
DataFormatString="{0:d}" /> <asp:BoundField DataField="RequiredDate"
HeaderText="RequiredDate" SortExpression="RequiredDate" HtmlEncode="false"
DataFormatString="{0:d}" /> <asp:BoundField DataField="ShippedDate"
HeaderText="ShippedDate" SortExpression="ShippedDate" HtmlEncode="false"
DataFormatString="{0:d}" /> </Columns> <AlternatingRowStyle BackColor="#eaeaea" /> </asp:GridView> </td> </tr> </ItemTemplate>
Friday, February 22, 2008 9:24:45 PM UTC  #    Comments [0]    |   |  Trackback

Update: David Findley posted something that I hadn't thought of using that's even easier.  Adding this to web.config will dump email messages sent from an ASP.NET application to the specified path:

<system.net>
  <mailSettings>
    <!--
    Production setting
    
    <smtp deliveryMethod="Network">
      <network host="localhost" port="25" />
    </smtp>
    
    -->

    <smtp deliveryMethod="SpecifiedPickupDirectory">
      <specifiedPickupDirectory pickupDirectoryLocation="C:\TestMessages" />
    </smtp>

  </mailSettings>
</system.net>
Friday, February 22, 2008 9:02:18 PM UTC  #    Comments [0]    |   |  Trackback
 Tuesday, February 19, 2008

http://daptivate.com/archive/2008/02/12/top-10-best-practices-for-production-asp-net-applications.aspx

Top 10 Best Practices for Production ASP.NET Applications

12 Feb, 2008.

In no particular order, here are the top ten things I've learned to pay attention to when dealing with production ASP.NET applications.  Hopefully they will help you save you some time and headaches.  As always, your thoughts and additions are welcome.

1.  Generate new encryption keys

When moving an application to production for the first time it is a good idea to generate new encryption keys.  This includes the machine validation key and decryption key as well as any other custom keys your application may be using.  There is an article on CodeProject that talks about generating machineKeys specifically that should be helpful with this.

2.  Encrypt sensitive sections of your web.config

This includes both the connection string and machine key sections.  See Scott Guthrie's post for some good references.  Note that if your application runs in a clustered environment you will need to share a custom key using the RSA provider as described in an MSDN article.

3.  Use trusted SQL connections

Both Barry Dorrans and Alex Chang have articles which discuss this in detail.

4.  Set retail="true" in your machine.config

    <configuration>
    <system.web>
    <deployment retail="true"/>
    </system.web>
    </configuration>
    This will kill three birds with one stone.  It will force the 'debug' flag in the web.config to be false,  it will disable page output tracing, and  it will force the custom error page to be shown to remote users rather than the actual exception or error message.  For more information you can read Scott Guthrie's post or the MSDN reference.

5.  Create a new application pool for your site

When setting up your new site for the first time do not share an existing application pool.  Create a new application pool which will be used by only by the new web application.

6.  Set the memory limit for your application pool

When creating the application pool, specifically set the memory limit rather than the time limit which is set by default.  Asp.net has a good whitepaper which explains the value of this:

By default IIS 6.0 does not set a limit on the amount of memory that IIS is allowed to use. ASP.NET’s Cache feature relies on a limitation of memory so the Cache can proactively remove unused items from memory.

It is recommended that you configure the memory recycling feature of IIS 6.0.

7.  Create and appropriately use an app_Offline.htm file

There are many benefits to using this file.  It provides an easy way to take your application offline in a somewhat user friendly way (you can at least have a pretty explanation) while fixing critical issues or pushing a major update.  It also forces an application restart in case you forget to do this for a deployment.  Once again, ScottGu is the best source for more information on this.

8.  Develop a repeatable deployment process and automate it

It is way too easy to make mistakes when deploying any type of software.  This is especially the case with software that uses configuration files that may be different between the development, staging, or production environments.  I would argue that the process you come up with is not nearly as important as it being easily repeatable and automated.  You can fine tune the process as needed, but you don't want a simple typo to bring a site down.

9.  Build and reference release versions of all assemblies

In addition to making sure ASP.NET is not configured in debug mode, also make sure that your assemblies are not debug assemblies.  There are of course exceptions if you are trying to solve a unique issue in your production environment ... but in most cases you should always deploy with release builds for all assemblies.

10.  Load test

This goes without saying.  Inevitably, good load testing will uncover threading and memory issues not otherwise considered.

Tuesday, February 19, 2008 2:24:48 PM UTC  #    Comments [0]    |   |  Trackback
 Friday, February 08, 2008
 Wednesday, January 30, 2008
Wednesday, January 30, 2008 12:42:56 AM UTC  #    Comments [0]    |  Trackback
 Friday, January 25, 2008

http://developer.apple.com/iphone/devcenter/designingcontent.html

http://www.practicalecommerce.com/blogs/developers-diary/archives/104

 

I'm getting ready to setup an HTC Excalibur and I wanted to post my list of favorite sites to visit with my Mobile Browser and a list of the apps I really need to install to make my Windows Mobile Smartphone complete.

  • Amazon Mobile - http://m.amazon.com - A basic, but very usable site, focused on search, that lets folks who've setup their Amazon account ahead of time purchase directly from the phone. Nice if you have Amazon Prime Free Shipping.
  • BBC PDA - http://www.bbc.co.uk/mobile/pda or http://www.bbc.co.uk/mobile - BBC has a mobile site and a PDA site, but the PDA site looks best on Smartphones or Blackberries. The best of the BBC on my phone. The mobile site would look good on an old black-and-white WAP Nokia.
  • CNN Mobile - http://m.cnn.com - Same here, mobile CNN, some pics, I use this site a lot.
  • Engadget Mobile - http://m.engadget.com - My favorite tech and gadget blog, now with mobiley goodness. I wish I could see comments though.
  • Hanselman.com - http://www.hanselman.com - Ha! See what I did right there? Back in the day, we taught dasBlog about mobile devices and if you hit hanselman.com from a Blackberry or Windows Mobile browser (and a number of other tiny browsers), we'll detect it and give you a mobile experience. Yay!
  • Facebook - http://m.facebook.com - In terms of pure functionality, I'd say that Facebook's mobile site is, hands-down, the most functional. It feels like you can most everything you'd ever want to using only Tiny HTML. This site and this company continue to impress, probably because it's running entirely on Red Bull and 20-year-olds.
  • Flight Stats - http://mobile.flightstats.com - This fine site has saved my tuckus a number of times while traveling. Their Airport Chatter section is interesting also.
  • Google - http://www.google.com/xhtml - The Tiny XHTML version of Google includes location specific searches and personalization with News, Weather, Movies, etc.
    • +1-800-GOOG-411 (+1-800-4664-411) - If you're able to call this number, either domestically or internationally, it's worth a try because it's amazing. Much better than the "1-800-Tell-Me stuff back in the day, but still of the same vein. I use this a LOT.
  • Microsoft Live - http://wls.live.com or http://m.live.com - If you hit wls you'll get your browser detected and possible prompted to download a nice applet for your phone. If you hit m.live.com you'll get tiny Windows Live Search.
  • Gmail - http://m.gmail.com - If you hit gmail with your phone you should get detected and sent over to the mobile version. If not, you can hit m.gmail.com or https://mail.google.com/mail/x/ where the x is magic. If you're running Google Apps for Your Domain (GAFYD) you can hack that URL also.
  • Joystiq - http://m.joystiq.com - Tiny Gaming Site. Interestingly, while they use (I think) the same back end as Engadget, sometimes the fonts are all wonky.
  • Mobile MSN - http://m.msn.com - A decent mobile portal and good jumping off point. The mobile stocks are particularly good.
  • MSNBC - http://www.msnbc.msn.com - It's astonishingly LAME that you can't get to this site from http://m.msnbc.com but perhaps they'll read this and make that DNS change, because this is a really good tiny news site.
  • Alarm.com - https://www.alarm.com/pda - I use Alarm.com to manage my security systems at the house and our rentals from my phone. If you've got a service available over the web, you really ought to have a minimal mobile website so kudos to them for having one.
  • Twitter - http://m.twitter.com - Does exactly what it says it does...mobile twitter, although I'd like to be able to see Direct Replies in the interface.
  • Wapedia (Mobile Wikipedia) - http://wapedia.mobi/en - Very useful for winning arguments with the wife self-edification, it's the mobile Wikipedia.

I think it's funny that folks thought that the ".mobi" top level domain extension was a good idea and that the internet just changed "www.foo.com" to "m.foo.com" and saved the registration fee. Plus, I don't have to tap out the "obi" which saves me, like minutes.

What are your must-have mobile websites, Dear Reader?

Friday, January 25, 2008 10:01:26 PM UTC  #    Comments [0]    |  |  |  |   |  Trackback
 Thursday, January 24, 2008
 Friday, January 11, 2008
 Monday, January 07, 2008

http://blog.emanuelebartolesi.com/post/2007/12/Log4net-Simple-way-to-use-in-your-Aspnet-application.aspx

Introduction

Log the actions of your applications is very important especially when you develop new features or develop very difficult logical business.
But it is also important when users use your applications to understand the critical issues or problems.
To implement quickly the log operations Apache developed an opensource library for .Net developers.

Download

You can download the latest version of Log4net from this location.

Add reference to your solution

In Visual Studio 2005 select Project -> Add Reference.
In the tab Browse, find and select the dll Log4net.dll in your local folder.

Modify web.config

Into web.config file add this code into the section Configuration->Configsections:
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>

Yet, add the section:

<log4net>

<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">

<file value="c:\temp\web.log" />

<appendToFile value="true" />

<maximumFileSize value="1024KB" />

<maxSizeRollBackups value="10" />

<layout type="log4net.Layout.PatternLayout">

<conversionPattern value="%date %level %logger - %message%newline" />

</layout>

</appender>

<root>

<level value="DEBUG" />

<appender-ref ref="RollingFile" />

</root>

</log4net>

In this configuration will create a log file into the folder "c:\temp\" until its size is 1024Kb.
After this size the name of file will be web.log.1 until 10.
At this link you can find another configurations.

Global.asax

In the event "Application_Start" of the file Global.asax add this line:
log4net.Config.XmlConfigurator.Configure();
Begin to log

In every page you want to log something, add the static variable like below:
private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

This class has 5 levels of severity to log the operations:

log.Debug("log something at this level")
log.Info("log something at this level")
log.Warn("log something at this level");
log.Error("log something at this level");
log.Fatal("log something at this level");

Simple and fast to use.
You find the official documentation at this link.

Monday, January 07, 2008 10:28:47 PM UTC  #    Comments [0]    |   |  Trackback
Things to think about if you want to be a consultant

http://devlicio.us/blogs/derik_whittaker/archive/2008/01/02/things-to-think-about-if-you-want-to-be-a-consultant.aspx

I was chatting a buddy recently and he was thinking about making the jump to the consulting world (not solo, through a consulting firm).  As he has never been a consultant I gave him my 2cents on questions to ask during the interview as well as things he has to accept before making the jump.

Questions to ask the consulting firm

  • What percent of travel is the norm?
    This is very important to know up front.  Because if you don't want to travel much and they tell you they are 100% travel, then move on. 
    One thing you need to keep in mind, is that they can give you a number, that number is NOT in stone.  It can/will change from client to client.  In my 5 years of consulting, I never left the greater Chicago area.  And for 2+ years I worked out of our home office.
  • What is your bench policy?
    Ask what the policy is for being on the bench?  More importantly ask the billable % expectation is for a consultant.  This can be important because if they expect you to be billable 90% of the year then they may not be able to handle any rough patches.  However, if they expect you to be billable for only 80% then they should be better set for rough patches.
    I also found that if a company has higher expectations about billable %, they may not be willing to provide non-billable training as it eats into the bottom line.
    If you are on the bench, do they have something for you to do?  Can you go to training during that time?  Or can you simply stay home and collect a check (i wish)?
  • What is your training policy?
    Ask what type of training they budget for?  Do they pay for conferences, weekly training classes?  Do they EXPECT you to take some sort of training. 
    A good firm will have a defined budged that will allow for adequate training of all there consultants.  Actually, it is in their best interest to keep you trained as you become more marketable.
  • What is the 'standard' number of billable hours you expect?
    What is the standard number of hours do they expect you to bill for in a giving year?  Is it 1800, is it 2000?  This makes a difference because if they tell you 2000+ then are telling you they EXPECT you to work over time (more on that below).
    A full year with no time off is 2080 hours (52 weeks * 40 hours).  But if you get 2 weeks vacation and 10 paid holidays you are only at 1920 (48 weeks * 40 hours). 
    Again, now keep in mind that the 'standard' number is just a rule of thumb, but it is good to know.  The higher the number, the less room in the budget they may have for when times get tough. 
    Also, keep in mind that during my 5 years consulting, my average work week was about 45-50 hours.  So if you are looking for the 40 hours and go home, you may not want to do consulting.
  • How are bonuses/raises calculated?
    Do they give bonuses/raises?  Are they based on billable hours?  If they are based on billable hours, that can be good and bad. 
    Example.  My old firm would give a flat bonus, but if you worked 200 extra hours a year you got a bump, if you worked 300 you got an extra bump, etc.
    This is good because i knew that the more i billed, the larger my bonus. 
    This was bad because i only got a sliver of the extra billable hours and in the long run did not pay off in the end.
  • How does overtime work?
    Some firms don't do anything special for overtime (as is the case in most salary positions).  However, some will actually pay you extra for your overtime (these places typically don't give bonuses).  Other places bank your overtime and build that into your vacation (worked out well for my buddy).
    But i would say that most common is that nothing happens with your overtime, except the companies profits increase at your expense.

Thing you have to accept as part of the job

  • The tech/environment will change with every new client
    With every new client/project your environment along with the technology will change.  For some people this is a show stopper, for others it is just another chance to learn.
    Keep in mind that if you work on site at the client you will be expected to follow ALL their rules.  So if they are business formal, you will be expected to dress in business formal.  If they say you cannot come in till 9 and must stay till 6, then that is what you must do.
    If you are not willing to accept this, then consulting may not be for you.
  • You may not always be working on 'cool/fun' tech
    Since each project may change technology you may not always be working on 'fun, cool' stuff.  You may go from doing cutting edge development on project to doing report writing on the next one. 
    If you are not willing to accept this, then consulting may not be for you.
  • You are the '***' of the client, at their mercy
    Since you are a 'hired gun' you are the mercy of the client.  Don't expect to have the same treatment as full timers (a lot of places today treat their consultants as part of the family, but not all).  Don't expect to get subsidized meals (if offered) or gym memberships, etc.
    Also, be ready to work in some of the worst spaces you can think of.  On place i worked the consultants all sat in a single 15-20 office.  They basically lined up desks along the wall and filled it with 6 people.  I felt bad for them :).
  • The people you will meet
    The coolest part is the people you will meet, the connections you will make.  This is great because networking is the best way to move ahead in this business.  I have meet some great people and have made some great contacts.

This was my 2cents to him.

Did I miss anything?  Am I wrong?  Let me know

Till next time,

Monday, January 07, 2008 10:27:00 PM UTC  #    Comments [0]    |  Trackback
Copyright © 2009 Kevin Mocha. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: