Sunday, April 17, 2011

Dropdown box Index issue

I have one dropdownbox(ddlCountry) containing allcountries,If i select USA it will display grid displaying Tax information related to USA.If i edit information in grid and if we change country USA to UK in dropdown box in the ddlCountry(not the dropdownbox coming in the edit window of grid,,no problem for that) it displaying error like

Specified argument was out of the range of valid values. Parameter name: ItemHierarchicalIndex Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: ItemHierarchicalIndex

Source Error:

Line 86: } Line 87: Line 88: if( rgStateTax.EditItems.Count > 0 ) Line 89: { Line 90: foreach( GridDataItem item in rgStateTax.Items )

Source File: c:\Projects\ACS\sample.Acs.Administration\UserControls\TaxManager.ascx.cs Line: 88

Stack Trace:

[ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: ItemHierarchicalIndex] Telerik.WebControls.GridItemCollection.get_Item(String hierarchicalIndex) +323 Telerik.WebControls.GridDataItemCollection.get_Item(String hierarchicalIndex) +37 Telerik.WebControls.RadGrid.get_EditItems() +215 sample.Acs.Administration.TaxManager.rgStateTax_PreRender(Object sender, EventArgs e) in c:\Projects\ACS\sample.Acs.Administration\UserControls\TaxManager.ascx.cs:88 System.Web.UI.Control.OnPreRender(EventArgs e) +8682870 System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +31 Telerik.RadGridUtils.RadControl.OnPreRender(EventArgs e) +36 Telerik.RadGridUtils.RadAJAXControl.OnPreRender(EventArgs e) +37 Telerik.WebControls.RadGrid.OnPreRender(EventArgs e) +40 System.Web.UI.Control.PreRenderRecursiveInternal() +80 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

this is the grid(rgstatetax) prerender event

protected void rgStateTax_PreRender( object sender, EventArgs e )
    {
        if( rgStateTax.MasterTableView.IsItemInserted )
        {
            foreach( GridItem item in rgStateTax.Items )
            {
                item.Visible = false;
            }
        }

        if( rgStateTax.EditItems.Count > 0 )
        {
            foreach( GridDataItem item in rgStateTax.Items )
            {
                if( item != rgStateTax.EditItems[0] )
                {
                    item.Visible = false;
                }
            }
        }

Code in UI

protected void ddlCountryTax_SelectedIndexChanged( object sender, EventArgs e ) { long locationId = ddlCountryTax.SelectedItem.Value.AsLong();

        ContentAdministrationServiceClient client = null;
        List<DCTaxRate> taxRate = null;
        try
        {
            client = new ContentAdministrationServiceClient();
            taxRate = client.GetTaxRatesByCountryIdAndLocationTypeName( locationId, "State" );
            client.Close();
        }
        catch( FaultException )
        {
            AbortClient(client);
            throw;
        }

        rgStateTax.DataSource = taxRate;
        rgStateTax.Rebind();

    }

Code in wrapper layer

public List GetTaxRatesByCountryIdAndLocationTypeName( long countryId, string locationTypeName ) { DCTaxRateCollection taxRates = new DCTaxRateCollection(); taxRates.GetByCountryIdAndLoactionTypeName( countryId, locationTypeName );

        return taxRates.ToList();
    }

    public void GetByCountryIdAndLoactionTypeName( long countryId, string locationTypeName )
    {
        IBOTaxRateCollection iboTaxRates = new BOTaxRateCollection();
        iboTaxRates.GetByCountryIdAndLocationTypeName( countryId, locationTypeName );

        SetItems( iboTaxRates );
    }

In Bo layer

    public void GetByCountryIdAndLocationTypeName( long countryId, string locationTypeName )
    {
        ISingleResult<TaxRate> taxRates = Database.TaxRateReadByCountryIdAndLocationTypeName( countryId, locationTypeName );
        PopulateCollection( taxRates );
    }
From stackoverflow
  • This occurs when the list of values in the dropdown does not include the value being bound to the SelectedValue property. If this is because you have a null value you could get the data adapter to return an empty string when the field is null (if that is the problem) and then insert a value in the dropdown list to match:

    <asp:DropDownList ID="dd_bound" runat="server" AppendDataBoundItems="True">
        <asp:ListItem Value="" Text="Select one..." />
    </asp:DropDownList>
    

    Note the AppendDataBoundItems value.

    peter : i made appenddatabounditems to true still the same error coming
    Richard : do you know what the value being bound to is? is it null or another value which is not in the list?
    peter : reading the country collection/ list beyond its bound into the dropdown.Thats wat hapened here ..Any way thanks 4 the replay
  • This link will give some what related to this issue

    http://www.telerik.com/community/forums/aspnet/grid/specified-argument-was-out-of-the-range-of-valid-values-parameter-name-itemhierarchicalindex.aspx

Search in SVN repository for a file name

Issue:- Search in SVN epository for with file name.

The Problem is:- We have a bulk repository for code contain thousands of folder and sub folder, i want to search under this repositor with file name or with some word.

Exp:-

Root folder a\ b\ c\ d\ e\ f\ab\ f\ab\cd.txt

I want to search for cd.txt but dont know where it is in SVN Repository, for that i want to perform a search on the root folder of SVN where i will put the file name cd.txt and run the command, will check in each folder and will display the file details result....

Hope requirement is clear. Can you please help me on this.

From stackoverflow
  • svn list --depth infinity <your-repo-here> to get a list of files in the repo, and then svn cat to get contents. You can add --xml key to list command to make parsing a bit simpler.

  • If the file is in your working copy, then if you are using svn 1.5:

    svn list --depth infinity | grep <filename>
    

    or an earlier version of svn:

    find . -name <filename> -not -path '*.svn*'
    

    If you need to find the file in history (deleted or moved):

    svn log -v | less
    

    and search for it with:

    \<filename><return>
    

Abuse of version control

Is version control suited for a project where content is essentially binary data files ? I am thinking about package that weight something like 10 giga, with a lot of BMP and TGA files.

Can subversion handle something like this ? Is it possible to generate some kind of binary patch that would allow users to download only what was modified. Rsync could be an option, but then there is no going back. I would really like to be able to go back to an earlier version easily.

I looked at this question too, but was not satisfied with the answer

From stackoverflow
  • Subversion only sends the differences over the line, not the entire files, when doing updates. However the initial checkout of the files DO require a download of all the files. Which will basically mean download 10GB. Also binary files are a nightmare to merge so as long as you work in a master / slave environment where only 1 person can commit and the others are slaves who only update the files this will work very well. Otherwise you're likely to end up with conflict after conflict.

    Is it not possible to split the 10GB over multiple repositories ? Do they really need to be versioned as a whole ?

  • You issue is a release management one which includes:

    • building: how and how fast are you able to regenerate some or all of the delivery content ?
    • packaging: how many files are present in that delivery ?
      if your content includes too many files, it will simply not be easy to deploy (i.e. copy or rsync) in any remote environment, not so much because of the global size, but because of the number of transactions needed.
    • publishing: where do you store your delivery and how to you link it to the initial development environment that produced it ?

    I would argue that such a massive delivery is not made to be published in a VCS, but rather store in a filesystem-based repository, with a proper name (or version.txt) to be able to identify its version and link it back to the development content (stored and tagged in subversion).
    Maven is an example of such a repo.

    I would also point out a content made to be delivered should include a limited number of files, which means:

    • compressed lots of related files together into one compressed file
    • run a script which does not just rsynch, but also un-compressed those files
  • Subversion uses xdelta for binary files.

    http://subversion.tigris.org/faq.html#binary-files

    BTW. related question: http://stackoverflow.com/questions/538643/how-good-is-subversion-at-storing-lots-of-binary-files

    leppie : I somehow doubt SVN uses xdelta for binary diff, as SVN would have to be GPL licensed then, and it is using an Apache/BSD style license.
    vartec : Xdelta 2.0 (that's when SVN started using it) was BSD licensed -- http://www.xcf.berkeley.edu/~jmacd/xdelta.html
    vartec : http://subversion.tigris.org/svn_1.2_releasenotes.html "The repository is now using the xdelta differencing algorithm (instead of vdelta)" http://subversion.tigris.org/svn_1.4_releasenotes.html "Subversion uses the xdelta algorithm to compute differences between strings of bytes."
  • You might want to look at some dedicated asset managing system, instead of trying to violently bend a source versioning system into your needs. The only one I've heard of (but have no experience nor affiliation with) is http://www.alienbrain.com/ - and it co$t$.

  • The short answer is yes.

    We used subversion for a relatively large (40GB checkout) game development project. I will say it handled binaries surprisingly well. The downside is for now you will only get text information for changes, ie: "Changed texture to fit updated main character model." But even this little bit of information can save you when you're looking for performance issues and simply making sure that every one is using the same binary files for development. Patching, as far as I know, would require the full file.

  • Well, but allienbrain is also version control, right?

    Tom : this should be a comment, not an answer.
    pablo : True, sorry, didn't realize

Windows Username maximim length

How long is the maximium lenght of a windows username incl. domain?

domain\username

regards

From stackoverflow

Adding a new dimension based on a key in fact table linked to one of the dimension tables

Hi, I have a fact table that holds all date & time attributes as keys which links to actual DATE & TIME dimension. When I create a cube on top of it using SSAS 2005, these datetime attributes are split into individual dimensions for the CUBE, which is OK.

Problem is when I add a new datetime attribute to the fact table, my cube doesn't accept that and would not create a new datetime dimension just like the other ones, unless I recreate the cube from scratch.

Can anyone please suggest, how can I add this new attribute separately as a dimension, without having to recreate the cube?

From stackoverflow
  • I'm struggling to understand your issue.

    It sounds as if you are trying to add a new datetime column(fact) (referenced to your apporpriate Dimension/s attribute) to the Fact table. If so, this changes the structure of the cube and so requires that the cube be re-processed.

    To qualify correct use of terminology, a Dimension contains Attributes. A Fact table contains Facts not attributes.

    The following reference may be of use.

    http://msdn.microsoft.com/en-us/library/aa905984(SQL.80).aspx

    Re: Comments

    Any structural changes need to be applied/registered within the Data Source View (DSV) in the Business Intelligence Development Studio (BIDS), prior to processing the cube. Clicking the refresh button on the DSV, should prompt you with an option to apply any discovered changes to your tables. Also, should any of your additions/modifications be to the underlying tables of Dimensions, then you may also need to add the attributes in question to the appoprirate Dimension .dim file, prior to re-processing the cube.

    Hope this makes sense.

    Vineet : Well I guess I got the terminology wrong but here is the actual problem. Add a new datetime column(fact), refreh data source view, this does not bring the appropriate dimension(inheriting datetime dimension attributes) in the cube by itself. I hope it makes sense this time. Any idea why?
    Vineet : Re processing the cube doesn't help as it is not taking up this new structural change to the cube. Even tried Process Structural Chages option while processing the cube.
  • The problem usually comes because of Unknown Member and Null Processing options setup along with the snowflake schema if you have it in your cube. I figured out what the problem actually was. If you have a case as one mentioned, then SSAS doesn't bring up the structural changes by itself when you refresh the Data source view. In my case, since it was date & time dimensions, I had to add new dimensions manually (Cube dimensions) and setting their NULL Processing options correctly (in my case UnknownMember and not Automatic).

    Since it can be tad difficult to do these changes for all such new columns added to underlying fact table, you can try updating the XMLA script using Find & Replace method, carefully crafted.

SQL Server - An error occurred while executing batch. Error message is: The directory name is invalid.

Our database server had run out of disk space, after freeing up some disk space any query run in sql server management studio, with the results sent to grid view, resulted in this error:
An error occurred while executing batch. Error message is: The directory name is invalid.

When the results sent to text view the queries worked fine.

Does anyone know why this error occurs and how to get rid of it?

From stackoverflow
  • I know it can sound like a joke, but have you tried restarting SQL Server instance?

  • Is the "Default Location for saving Query Results" set to a valid path in Tools/Options/Query Results/SQL Server/General?

    Do the TMP/TEMP environment variables point to valid directories?

    Reinstalling the client tools will probably fix the problem.

Software design vs. software architecture

Could someone explain the difference between software design and software architecture? More specifically; if you tell someone to present you the 'design' - what would you expect them to present? Same goes for 'architecture'.

My current understanding is:

design: UML diagram/flow chart/simple wireframes (for UI) for a specific module/part of the system

architecture: component diagram (showing how the different modules of the system communicates with each other and other systems), what language is to be used, patterns...?

Correct me if I'm wrong. I see Wikipedia has articles on http://en.wikipedia.org/wiki/Software_design and http://en.wikipedia.org/wiki/Software_architecture, but I'm not sure if I have understood them correctly.

From stackoverflow
  • Yep that sounds right to me. The design is what you're going to do, and architecture is the way in which the bits and pieces of the design will be joined together. It could be language agnostic, but would normally specify the technologies to be used ie LAMP v Windows, Web Service v RPC.

  • You're right yes. The architecture of a system is its 'skeleton'. It's the highest level of abstraction of a system. What kind of data storage is present, how do modules interact with eachother, what recovery systems are in place. Just like design patterns, there are architectural patterns: MVC, 3-tier layered design, etc.

    Software design is about designing the individual modules / components. What are the responsibilities, functions, of module x? Of class Y? What can it do, and what not? What design patterns can be used?

    So in short, Software architecture is more about the design of the entire system, while software design emphasizes on module / component / class level.

    Asaf R : Also, architecture usually deals with what (is done) and where (it's done), but never with how. That is think is the principle difference - design completes the how that architecture doesn't (and shouldn't) talk about.
  • Software architecture is best used at the system level, when you need to project business and functions identify by higher architecture levels into applications.

    For instance, your business is about "Profit and Loss" for traders, and your main functions involved "portfolio evaluation" and "risk computation".

    But when a Software Architect will details his solution, he will realize that:

    "portfolio evaluation" can not be just one application. It needs to be refined in manageable projects like:

    • GUI
    • Launcher
    • Dispatcher
    • ...

    (because the operations involved are so huge they need to be split between several computers, while still being monitored at all times through a common GUI)

    a Software design will examine the different applications, their technical relationship and their internal sub-components.
    It will produce the specifications needed for the last Architecture layer (the "Technical Architecture") to work on (in term of technical framework or transversal components), and for the project teams (more oriented on the implementation of the business functions) to begin their respective projects.