Gunnar Peipman's ASP.NET blog

ASP.NET, C#, SharePoint, SQL Server and general software development topics.

Sponsors

News

 
 
 
DZone MVB

Links

Social

January 2009 - Posts

Five questions from customers about web pages

Here is my little QA posting about what customers have asked me and what kind of answers I have given. Feel free to write your opinions to comments as your comments are always welcome here.

1. I want my page to be #1 in Google!

Easiest way to achieve it is to publish banners in Google that are shown before search results. If you want to be #1 position in search result then start from acknowledging yourself that SEO is process and not a one time activity. There are many good resources available in web, also you can find many good books about SEO. All your activities may or may not to guarantee better results but #1 is very hard thing to achieve. Indexing algorithms are not public, so nobody can sell you a service like “Get number one position in Google”.

2. How Flash affects my homepage visibility?

Some spiders can read Flash but most of them can’t. Keep your Flash page as alternative page to the one you made in HTML. All spiders are able to read HTML. Of course, there are pages where Flash is must-be. Don’t be afraid to create Flash sites when it is needed. You can always use other web marketing tricks to make those pages popular.

3. Why documents on my web page have better positions than pages that link to them?

I have seen this happening couple of times. One of my customer has product pages with some information about those products. The pages had short product description and couple of technical characteristics. And… links to full product specifications. Well, spiders found more keywords from specifications than from pages linking to them. As those product pages ranked extremely poorly then indexed documents got better positions in search results. You can avoid that effect by creating keyword rich pages for products. Also you have to follow basic SEO advices.

4. How dynamic menus may affect my page?

Spiders can read and analyze JavaScript but they don’t run it. So, if you have fully dynamic JavaScript menus that are created on the fly then spiders doesn’t see those menus. If you are using divs that are located on the page then spiders see that you have links on page. If you have to use fully dynamic menus then at least put link to your sitemap on all the pages you have. Otherwise spiders cannot see navigation options and your pages may rank not so well.

5. Is it possible to make cool things without Flash?

Yes, it is. If your cool things contain important keywords then some things you can do with JavaScript and dynamic HTML. It is also easier for visitors computer if it doesn’t have to load some content to plug-ins that have their own runtime engines.

Five steps to more successful SharePoint solutions

Some points about how to succeed in SharePoint projects. Nothing special but my little experiences.

  • Create a prototype. It is always good idea to go step by step through analysis document and think how to solve different problems and how to build up the solution. If there is something you are not sure about – try to solve the problem. It is cheap thing to do when you have no deadlines, it is highly risky and maybe very expensive thing to do when you have deadlines. If you have prototype it is easier for you to detect the parts of solution where workarounds are needed or where additional decisions from customer are needed. 
      
  • Don’t go too far. Use as much that SharePoint has to offer as possible. When customers needs something special then think how to solve the problem using SharePoint features. Don’t start thinking how to hack and code. There are many ways how to solve different problems on SharePoint. You can also suggest your customers to do things a little bit differently – as long as customer doesn’t have to go too far from his or her logic of solution.
     
  • Don’t hack if there are better ways. It is always easy to make fast modifications through SharePoint Designer without analyzing if this modification is just exceptional case or is it better to develop some new field type or feature or workflow that you can use also in other parts of current solution (or in any other solution).
     
  • Keep your code close to SharePoint. It is not hard to write code that does exactly what customer needed. It is a little bit harder to write the same code in SharePoint way using SharePoint classes. If you add new functionality by extending existing SharePoint classes then your code stays safely close to SharePoint and you don’t have to struggle through creating functionalities that SharePoint already offers.
      
  • Test your code under different accounts. In your own development machine you are usually administrator and you have access to all features that SharePoint provides. If your code has to run also for users with another permissions then always test your code also under the other user accounts. This way you can discover all permissions related problems early and you have time enough to change your code or update administrators guide so they know what permissions one or another user group needs.

That’s all for now. Of course, it is possible to write a long list of best practices but I consider these ones as basic ones that must be followed in every project your are participating.

If you think I am missing something then please feel free to add your ideas to comments block of this blog entry. :)

Posted: Jan 16 2009, 05:22 AM by DigiMortal | with 2 comment(s)
Filed under:
Getting Results From Software Development Teams

Getting Results from Software Development Teams @ Amazon
Getting Results from Software Development Teams
Getting Results From Software Development Teams is book about software projects management. Author of this book, Lawrence J. Peters, is one of the veterans in field who has worked on software projects management over 40 years. I think it is solid experience to share with others. The book is pretty new – it was published in June 2008.

Getting Results From Software Development Teams is not another witchery book that gives us mysterious advices how to make miracles in projects. Also this book doesn’t go too deep with theory. Through eight solid chapters we get overview of activities of project managers in different project stages.

This book is not easiest reading for sure. You have to think when you read because otherwise you may miss some very important points. All topics in this book appear in logical order that make up a perfect whole. I think this book is mandatory reading for project managers and suggested reading for developers who want to be the best ones. Without understanding other peoples role in project makes it hard to be a good team member.

Refactoring: extract method

Extract method is one of the most popular refactoring method when dealing with legacy code. In legacy code we can often find methods that are very long. My favorite findings methods about 2000 lines of code. Cool, isn’t it? Those methods have usually many responsibilities and they are hard to debug. Having more than one responsibility in one method leads also to duplicated code because some responsibility is required in more than one place in code.

As an example let’s see the following code written in PHP.


function get_active_users()
{
    // find active users
    $query = mysql_query("select * from plah where id=$id");
    while($result = mysql_fetch_assoc($query))
    {
        if($result['sec_code']==security_code($result['id']))
            $results[] = $result;
    }

    // create options array
    $options = array();
    foreach($results as $val)
    {
        $optid = $val['id'];
        $opttext = $val['title'];
        $options[] = "<option value='$optid'>$opttext</option>";
   }
    return $options;
}


This method is useful for sure and it works like expected but it does more then expected. What if we want to use array of active users elsewhere in the code? This may be not new need. We have to search through code to see if this code is duplicated also in some other method.

What we have to do is to move code that finds active users to another method. This way we have one method that returns users array and the other that creates list of options based on it. After extracting active users finding code to another method we have code like this.


function get_active_users()
{
    $query = mysql_query("select * from plah where id=$id");
  
    while($result = mysql_fetch_assoc($query))
    {
        if($result['sec_code']==security_code($result['id']))
            $results[] = $result;
    }

    return $results;
}

function get_active_users_options()
{
    $active_users = get_active_users();
    $options = array();
  
    foreach($active_users as $val)
    {
        $optid = $val['id'];
        $opttext = $val['title'];
        $options[] = "<option value='$optid'>$opttext</option>";
    }

    return $options;
}


Now we have two methods instead of one. This may seem like bad idea because the number of methods grows. But there is no problem because we have now two methods and both of them have only one responsibility. All we have to do now is to find out other parts in code where list of active users is needed and replace the code with method call. When logic of finding active users changes we have to make the change only in one method.


kick it on DotNetKicks.com pimp it Shout it
You must use the dbSeeChanges option with OpenRecordSet when accessing a SQL Server table that has an IDENTITY column

One error you may get when querying SQL Server databases through MS Access is "You must use the dbSeeChanges option with OpenRecordSet when accessing a SQL Server table that has an IDENTITY column". This error appears when you open recordset that contains IDENTITY column. Usually you have to do something like this to get this error (FindTrainer query gets data from SQL Server table).


Public Function GetTrainerId(strTrainerName As String) As Integer
Dim query As QueryDef
Dim rs As Recordset

    Set query = CurrentDb.QueryDefs("FindTrainer")
    query.Parameters("pName") = strTrainerName
    
    Set rs = query.OpenRecordset()
    
    If rs.RecordCount = 0 Then
        rs.AddNew
        rs("Name") = strTrainerName
        rs.Update
        rs.MoveLast
        rs.MoveFirst
    End If
    
    GetTrainerId = rs("ID")
    
    Set rs = Nothing
    Set query = Nothing
    
End Function

To avoid this error you should use dbSeeChanges option when opening the recordset. You can see that I am using two parameters when I open recordset. First one, dbOpenDynaset, sais to Access that I need dynamic recordset and second one, dbSeeChanges, sais that there may be changes that are made in server and we need to retrieve row again after inserting or updating it.


Public Function GetTrainerId(strTrainerName As String) As Integer
Dim query As QueryDef
Dim rs As Recordset

    Set query = CurrentDb.QueryDefs("FindTrainer")
    query.Parameters("pName") = strTrainerName
    
    Set rs = query.OpenRecordset(dbOpenDynaset, dbSeeChanges)
    
    If rs.RecordCount = 0 Then
        rs.AddNew
        rs("Name") = strTrainerName
        rs.Update
        rs.MoveLast
        rs.MoveFirst
    End If
    
    GetTrainerId = rs("ID")
    
    Set rs = Nothing
    Set query = Nothing
    
End Function

After adding these two parameters to recorset opening calls the error disappeared and everything started to work normally.

SharePoint and constant [Today]

If you are creating views on sites that use different language than english then you cannot use constant [Today]. This constant is translated to site language and it depends on language you are using. Example: when developing sites in estonian language I have to use constant [Täna] instead of [Today]. Otherwise error message will be shown and I cannot save the view.

Posted: Jan 14 2009, 02:28 AM by DigiMortal | with 1 comment(s)
Filed under:
Software Estimation - Demystifying the Black Art

Software Estimation - Demystifying the Black Art
Software Estimation: Demystifying the Black Art (Best Practices (Microsoft))
Software Estimation - Demystifying the Black Art is another masterpiece by Steve McConnell. I introduced in last june book Code Complete 2 by same author - it is suggested reading for developers. Software Estimation, as title sais, tells about how to estimate software projects. Estimating is not easy thing to do if you want to achieve good estimates.

People who are afraid of another semi-mathematical book of estimation techniques may calm down - this book is for everybody who is interested in topic. There are no "complex stuff" like integrals, derivatives etc.

You can use this book as manual to get started with your own estimation methods and practices. Estimation methods are ordered logically, there are good explanations about different methods and great examples. Your job is only to sit down and get started. :)

Table of contents

  • 1 What is an "Estimate?"
  • 2 How Good an Estimator Are You?
  • 3 Value of Accurate Estimates
  • 4 Where Does Estimation Error Come From?
  • 5 Estimate Influences
  • 6 Introduction to Estimation Techniques
  • 7 Count, Compute, Judge
  • 8 Calibration and Historical Data
  • 9 Individual Expert Judgment
  • 10 Decomposition and Recomposition
  • 11 Estimation by Analogy
  • 12 Proxy Based Estimates
  • 13 Expert Judgment in Groups
  • 14 Software Estimation Tools
  • 15 Use of Multiple Approaches
  • 16 Flow of Software Estimates on a Well-Estimated Project
  • 17 Standardized Estimation Procedures
  • 18 Special Issues in Estimating Size
  • 19 Special Issues in Estimating Effort
  • 20 Special Issues in Estimating Schedule
  • 21 Estimating Planning Parameters
  • 22 Estimate Presentation Styles
  • 23 Politics, Negotiation, and Problem Solving
  • A. Answers to Quiz to Chapter 2
  • B. Bibliography
  • C. Summary of Estimation Tips
  • Index
Posted: Jan 10 2009, 01:11 AM by DigiMortal | with 2 comment(s)
Filed under:
More Posts « Previous page