Monday, December 22, 2008

Flex Error

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at mx.charts::AxisRenderer/calcStaggeredSpacing()[C:\Work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\AxisRenderer.as:2195]
    at mx.charts::AxisRenderer/calcRotationAndSpacing()[C:\Work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\AxisRenderer.as:1586]
    at mx.charts::AxisRenderer/adjustGutters()[C:\Work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\AxisRenderer.as:1326]
    at mx.charts::AxisRenderer/set gutters()[C:\Work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\AxisRenderer.as:798]
    at mx.charts.chartClasses::CartesianChart/updateAxisLayout()[C:\Work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\chartClasses\CartesianChart.as:2028]
    at mx.charts.chartClasses::CartesianChart/updateDisplayList()[C:\Work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\chartClasses\CartesianChart.as:1355]
    at mx.core::UIComponent/validateDisplayList()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:6214]
    at mx.managers::LayoutManager/validateDisplayList()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:602]
    at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:675]
    at Function/http://adobe.com/AS3/2006/builtin::apply()


this error occurs when you have only 1 dataset and your dataset name is wider than the chart..

this is a bug of Flex and you can make a workaround for this. visit this http://bugs.adobe.com/jira/browse/FLEXDMV-1821


Wednesday, November 19, 2008

xml data encoding issue in sql server 2005

Today I found one of my friend is struggling with saving xml to sql server 2005 database with Norwegian characters. When he try to insert xml data error is throwing saying "invalid characters found in line number ....". According to the definitions sql server keeps xml data using utf-16 encoding. so this should support Norwegian characters. The xml document which we are trying to save contains the declarations as

<?xml version="1.0" encoding="utf-8" ?>

If we remove the above xml declaration from the xml document before sending it to sql server, it will be automatically handled by the server using utf-16. you can use .Net to remove the declaration before sending it to server and insert declaration while you retrieve xml from database.

Monday, November 17, 2008

Cairngorm with Flex

Cairngorm is a framework which facilitates to write well structured flex code with MVC architecture. Its Front controller, Model Locator, command and delegate patterns are the main components of the framework. I will try to explain how it works with a simple example application of user search.

  1. App boots up, shows first state
  2. user types in some keywords, clicks the Search button
  3. this fires the doSearch event handler
  4. the doSearch handler creates a CairngormEvent, and dispatches it
  5. the Controller has mapped that type of event to a Command, and thus it runs the command, passing it the event
  6. the Command looks at the event type in the execute function and
    decides what to run, in this case, searchBooks, passing the event’s
    data to the function
  7. search books creates the Business Delegate, and calls its method
  8. the Delegate gets the WebService from the ServiceLocator, fires off the WebService, and waits for a response
  9. if the response is successful, it parses the E4X XML via a Factory to a list of Book ValueObjects
  10. finally, it calls the responder’s onResult function
  11. Since the Command is the Responder, he gets the data, and sets it to the ModelLocator and updates the applications state
  12. The View’s are bound to the state variable and book list in the ModelLocator, so they immediately have their bindings fire
  13. This causes the main app to change state, and show the results DataGrid
  14. The results DataGrid is bound to the books list in the ModelLocator, and shows the results.

Monday, October 20, 2008

Lucene Free text search Engine

When I was working with the Lucene  search engine, I faced with some problems of "Too many clauses" in the search criteria. To avoid above problem always use PrefixFilters

Term term = new Term(_facetName, axisValue.FromValue);
PrefixFilter filter = new PrefixFilter(term);

instead of

Term term = new Term(_facetName, axisValue.FromValue);
Filter p = new QueryWrapperFilter(new TermQuery(term));


You can avoid words which are very short when indexing. This will improve the performance of the searching. Following is a sample of implementing custom analyzer with the Token filter.


   public class CustomAnalyzer : Analyzer {

      private Set stopSet;
      private int _minTokenLength = 3;


      public static  string[] STOP_WORDS = StopAnalyzer.ENGLISH_STOP_WORDS;

      /** Builds an analyzer. */
      public CustomAnalyzer(int minTokenLength)
          : this(STOP_WORDS, minTokenLength)
      {
      }

      /** Builds an analyzer with the given stop words. */
      public CustomAnalyzer(String[] stopWords,int minTokenLength)
      {
        stopSet = StopFilter.makeStopSet(stopWords);
        _minTokenLength = minTokenLength;
      }

      /** Constructs a {@link StandardTokenizer} filtered by a {@link
      StandardFilter}, a {@link LowerCaseFilter} and a {@link StopFilter}. */
      public override TokenStream tokenStream(String fieldName, Reader reader) {
        TokenStream result = new StandardTokenizer(reader);
        result = new StandardFilter(result);
        result = new LengthTokenFilter(result, _minTokenLength);
        result = new LowerCaseFilter(result);
        result = new StopFilter(result, stopSet);
        return result;
      }
}


ToenFilter to remove tokens with short lengths

public class LengthTokenFilter: TokenFilter {
    private int minLength;

    public int MinLength
    {
        get { return minLength; }
        set { minLength = value; }
    }

    internal LengthTokenFilter(TokenStream input, int minLength)
        : base(input)
    {
        this.minLength = minLength;
    }

    public override Token next(Token result){

        while ((result = input.next(result)) != null) {
            if (result.termLength() >= minLength) {
                return result;
            }
        }

        return null;
    }
}







Thursday, October 16, 2008

Flex PopupButton

While I am working with Flex PopupButton, I faced with some issues of Event dispatching and propagation. All the events dispatched inside the PopupButton control will not propagate to the parent container components.I couldn't find a way to catch the events from the controls inside the popup button from the main application.

Thursday, October 09, 2008

Adobe Flex

Adobe Flex is one of the best RIA application generation platform and for the current project we have decided to use flex.Flex is a highly productive, free open source framework for building and maintaining expressive web applications that deploy consistently on all major browsers, desktops, and operating systems.You can get more information and resources from
http://www.adobe.com/products/flex/


Monday, September 15, 2008

University of Mortuwa has become the no 1 in google summer code

This Week's Top 10's: Universities for Google Summer of Code 2008. University of moratuwa has become number 1. this is a great news for all the sri lankans.


http://google-opensource.blogspot.com/2008/05/this-weeks-top-10s-universities-for.html

Wednesday, May 21, 2008

SSIS error in merge joins

we have developed a application called File converter which uses SSIS to convert different input file formats(flat files, hierarchical files, xml) different output file formats.

File converter is a web application and these SSIS packages are executed via .NET APIs. The crazy error was when we deploy a SSIS package which contains xml sources and merge joins SSIS package execution hangs. But the funny thing is it executes successfully in windows ZP. But it hands on windows 2000.

Customers production environment is windows 2000. We have installed only SSIS service on this machine where File Converter web application is running. After days of trouble shooting we found the cause for the problem. Hurraayyyyy.....

ITS SQL server service pack 2. If you install service pack 2 to SSIS service it does the work.

for more details see http://support.microsoft.com/kb/938049

If you still have the issue install hot fixes for service pack 2 as well.

Tuesday, May 13, 2008

Once again in Norway

I am with Anura, dileepa and pathi once again in Norway. This time we work with SPN development team to enhance the current Preator system(Predator is a debt collection system) towards next generation CMS system. Predator's core is written in borland c++ and we are re-engineering its data access layer and business layer to migrate Faircom ISAM to Faircom SQL.

SQL Server Management Studio Reports and Dashboard

Good article to read to check the statistics of MSSQL server using reports and dashboards.

http://www.databasejournal.com/features/mssql/article.php/3743596

Monday, February 25, 2008

Understanding the Metabolism

Understand the Metabolism

If you're trying to lose weight and think your metabolism might be the culprit, there are changes you can make to improve it. But with the commercialism surrounding "metabolism-enhancing" products, it can be hard to separate fact from fiction (or advertising) and pin down techniques that are scientifically proven to change one's metabolism.

1. Understand what metabolism is. In the simplest terms, metabolism is the rate at which your body burns calories. The rate differs significantly from person to person. You and your friend can have the same activity level, diet, and weight but still gain or lose weight at different rates based on differences in metabolism.
2. Determine what is influencing your metabolism. There are some factors that you can change, and some factors that you can't.

* Age - metabolism slows 5% per decade after age 40
* Sex - men generally burn calories faster than women
* Heredity - you can inherit your metabolic rate from previous generations
* Thyroid disorder - problems in the thyroid gland can slow metabolism but this is rare
* Proportion of lean body mass - metabolism increases with muscle mass
3. Calculate your resting metabolic rate (RMR). RMR is often used interchangeably with basal metabolic rate (BMR); although they are slightly different, estimating either is sufficient for the purpose of losing weight. To calculate your RMR, use the Mifflin-St Jeor equation (which is more reliable than the Harris-Benedict equation). There are also calculators online that can do this for you:

* RMR = (9.99w + 6.25s) - 4.92a + 166g
* w = weight in kilograms; if you know your weight in pounds, divide by 2.2 to get your weight in kilograms
* s = height in centimeters; if you know your height in inches, multiply by 2.54 to get your height in centimeters
* a = age in years
* g = gender = 1 for males, 0 for females
4. Adjust your diet accordingly. Your RMR will tell you how many calories you need to maintain your body at rest. Your daily consumption to maintain your weight should be:

* RMR x 1.15
* E.g. RMR = 2000, so the maintenance intake is 2000 x 1.15 = 2300
* To lose weight safely, consume no more than your maintenance intake but no less than your RMR.
* Count calories by recording what you eat and looking up how many calories each food item contains (either on the food packaging or in tables provided in books or online).

more : http://www.wikihow.com/Increase-Your-Metabolism

Saturday, February 16, 2008

sweden trip

We traveled to Sweden from sandefijord by Ferry. This trip was not interesting as we have expected. We spend around 8 hours at Stormstad, Sweden and visited around the city. It was not a big city.

Strömstad is a town (pop. 5,800) in Bohuslän in western Sweden and the seat of Strömstad Municipality, Västra Götaland County.


Strömstad is, despite its small population, for historical reasons normally still referred to as a city. Statistics Sweden, however, only counts localities with more than 10,000 inhabitants as cities.

some links

http://www.vastsverige.com/templates/default____2349.aspx

Photos








Ferry to sweden




Stormstad city

Amsterdam Visit

I traveled to Amsterdam central and enjoyed the boat trip. It was a two hour journey which goes around the Amsterdam city via ancient canals. We could see all different types of building with different eras. This is a nice trip to enjoy.





Amsterdam central




Boat trip around the city

Norway again for Customer Site SPN

I am again at Norway for onsite development at customer site SPN. I left from colombo on 25th of January. It was a long journey. Traveled to Quatar, Amsterdam and finally sandefijord. I myself with three other developers are enjoying the Nordic weather now. Its snowing at sandefijord but not that much cold as last time of my visit.

Thursday, January 03, 2008

Wednesday, January 02, 2008

An unhandled exception occurred in the user interface.Exception Information: OSearch (SPSearchAcct)

Setting up SharePoint? Accounts need their domain.
I have been meaning to post this forever and keep forgetting. A very common issue I am seeing people have when setting up and configuring SharePoint is the way they are specifying account names. You must always specify domain\username. Even though SharePoint will never tell you this is the problem it is. Many users are tempted to just type in username for a service and then the password then they are greeted with a random/cryptic error message. After about an hour (or a day of reinstalling) they realize it was because they forgot to specify the domain name.

I will attempt to compile a list of error messages that have been caused by this issue and post them here. If you have one please post it in the comments and I will update the post. Thanks

Sample Error:

An unhandled exception occurred in the user interface.Exception Information: OSearch (SPSearchAcct)

Tuesday, January 01, 2008

SSIS training at Sandejord, Norway

Last week (09/12/2007) I traveled to Norway for a SSIS training for my customer SPN(System Partner Norge). Hasith yaggahawita one of my company mate also joined with me for this visit. We flew to Frankfurt, Germany and then using a Scandinavian air lines we landed to Oslo. It was a quite large air travel. This was my first visit to Norway and winter is beginning there. It was quite cold and temperature was around -10 Celsius.

We then traveled to Sandefjord by the train. It was a two hours journey and Sandefjord is very beautiful and quite. there are no big building and looks like a village.

SPN outside view



The apartment we lodged was beautiful and near to the railway station. SPN is 15 minutes from the apartment.

My Apartment





From Monday to Friday I had conducted the SSIS training for SPN employees and last day(Friday) We had the Christmas part which was organized in the Ferry to Sweden. This was my first experience in a Ferry. We really enjoyed the Norwegian foods and drinks.

Saturday I with my friend hasith backed to Oslo. We have visited the city as well as Castle.
We had the return flight on Sunday through Frankfurt.

Trees with friezed FOG