Blogs

  • Announcement: Welcome to Windows Coding 2.0

  • Microsoft Visual Studio 2010 Beta 1 is coming to MSDN on May 18th.

    So far I have been very impressed with the CTP builds of Visual studio 2010. There are some really welcoming changes that are apart of Visual Studio 2010 like UI Unit tests and a completely new IDE written in WPF. The only area where I thought was lacking was the responsiveness of the application. Last night a few members of the Visual Studio team announced that one of there main goals for Beta 1 and RTM is on Performance. I am very excited to hear this.

    "During these last weeks we’ve made a lot of progress, I’m sure you’re going to feel the product is a lot snappier than the builds we provided at the PDC. But of course I’m never satisfied – there are even more wins coming later. I worked with many different teams to help us with our startup, with UI transitions, with memory usage, with threading issues – especially with how WPF and our main thread synchronize” Rico Mariani.

    Jihad Dannawi from Microsoft Australia reports that MSDN will have the latest bits of Visual Studio 2010 on May 18th, So keep an eye open.

     

    MSDN download Link.

    Posted to Blake Niemyjski by Blake Niemyjski on 05-15-2009
    Filed under:
  • How to protect your Community Server site from spammers

    One should always be aware that your site could be attacked by spam bots if you don’t take the proper precautions. The easiest and quickest way to help prevent 500+ spam users from joining your site is to configure the default options to make it harder for spam bots to create accounts. Please note that this can also reduce the number of registrations on your site due to the extra steps it takes to register.

    1. Navigate to the Account Settings tab in the control panel (/controlpanel/membership/AccountSettings.aspx).
    2. In the Registration Settings tab Set Account Activation to Email.Email Settings
    3. If you have a full time moderator then you can also set New user Moderation Level to User is Moderated.
    4. Navigate to the Post Settings in the control panel (/controlpanel/Settings/AdvancedConfiguration.aspx).
    5. Make sure Enable Anonymous Posting is set to No.
    6. Navigate to the Username Filters in the control panel (/controlpanel/tools/UsernameFilter.aspx).
    7. Add any words you think are necessary, like offensive words. I would also add words of medication, payment or buying keywords, and health.
    8. Navigate to the Manage Spam Blocker in the control panel (controlpanel/tools/ManageSpamRules.aspx).
    9. Enable User Creation IP Frequency and configure the minutes to be 1440. This will stop all the spammers from joining from the same IP.
    10. Enable any rules you think would benefit your community.
    11. Click Save.

    If you came to this article because you already had your site taken over by spam users created by bots, then continue reading. Please note: before continuing please create a database backup and continue at your own risk. I am not liable for any harm that comes to your database or community after running the following query.

    1. Navigate to Manage Users in the control panel (controlpanel/membership/membersearch.aspx?SelectedNavItem=BrowseMembers).
    2. Next if you know the email address of the spam account in question then enter *aspamdomain.com (replacing the domain name with the email domain in question). Now if this returns only the spam accounts in question continue, otherwise you will need to modify the search criteria until you see the list of spam accounts.
    3. Open SQL Server Management Studio and connect to your community server database.
    4. Now backup your community server database. Here is a how to guide.
    5. Run the following query and make sure it returns the list of user accounts you want to remove.  You may need to update this query and change the domain name from step 2.
         1: SELECT * FROM cs_users WHERE Email LIKE '%@aspamdomain.com'
    6. If you notice that you had a bunch of users join your site all from a certain domain then this TSQL script will work for you out of the box. Also if your spam bots have created posts, you may want to create a new user of which you want to assign the spam posts to. All you need to do is to create a new user account and change line 18 from Anonymous to the case sensitive user name you created.  I modified the following query quite a bit to fit this scenario. Please note: you will need to update line 10 to match the like query in step 5 and also change the domain name.
         1: declare @Proc nvarchar(50)
         2: declare @RowCnt int
         3: declare @MaxRows int
         4: declare @ExecSql nvarchar(255)
         5: declare @user_id int
         6:  
         7: select @RowCnt = 1
         8:  
         9: declare @Import table (rownum int IDENTITY (1, 1) Primary key NOT NULL , UserID int NOT NULL)
        10: insert into @Import (UserID) select UserID from cs_users where Email like '%@aspamdomain.com'
        11:  
        12: select @MaxRows = count(*) from @Import
        13:  
        14: while @RowCnt <= @MaxRows
        15: begin
        16:     select @user_id = UserID from @Import where rownum = @RowCnt
        17:  
        18:     execute [dbo].[cs_User_Delete] @user_id, 'Anonymous'
        19:  
        20:     Set @RowCnt = @RowCnt + 1
        21: end
    7. Go back and run the query from step 5, If it returns no results then all the spam accounts have been removed.
  • How to protect your Community Server site from rouge spiders with a robots text file.

    Over the course of the past two years, I have worked on a number of Community Server sites. The goal of these tips are to share useful information about Telligent's Community Server platform. There are a few ways you can protect yourself from rouge search bots from stealing your content and bringing down your site. 

    The easiest way is to setup a robots text file, which will tell search engines to ignore certain files or directories. I found this guide which was very helpful on setting up a robots.txt file in the root directory of your website. There are a few disadvantages to this approach.

    • It isn’t guaranteed to work. There are companies out there who don’t care what safe guards you have setup. They are just concerned with indexing or stealing your content.
    • People do list there private directories in the robots file thus opening themselves for making public any documents they think are hidden.

    If this doesn’t work, and trust me sometimes it doesn’t always work as I learned a few months ago, then you need to go to the extra step. If you take a look at your exception log in community server by navigating to (/controlpanel/Tools/Reports/ExceptionsReport.aspx) or by running the following SQL Query:

       1: SELECT [Frequency], [IPAddress], [UserAgent], [HttpReferrer], [HttpVerb], [PathAndQuery], [Exception], [ExceptionMessage], [DateLastOccurred] FROM [dbo].[cs_Exceptions] ORDER BY DateLastOccurred DESC

    You will see the IP Address and the name of the spider that's bringing down your site. From here you need to open up Internet Information Services (IIS) Manager. Once open you need to navigate to the site you want to block the IP or IP Range from accessing and then click on IP Address and Domain Restrictions

    Internet Information Services (IIS) Manager (2)

    Next right click and click Add Allow Entry or Add Deny Entry and fill in the information.

    Add Allow Restriction Rule 

    The spider has now been blocked. I’d suggest keeping an eye on this and blocking the IP Range of the spider. The last step is to contact the owner of the spider and ask them to stop. You can get this information by looking up the IP Address through Network Solutions.

    Posted to Blake Niemyjski by Blake Niemyjski on 05-12-2009
    Filed under: ,
  • CodeSmith 5.1 Released

    On May 6th we released CodeSmith 5.1. This update brings in many welcoming changes, to name a few: .netTiers 2.3, PLINQO 3.0. Also CodeSmith and now requires that the .NET 3.5 Framework is installed before CodeSmith installs.

    Final

    • Updated installer to launch CodeSmith after install.
    • Loading a CSP on a new machine with an new connection string will cause TableSchema's UI to be blank.
    • Fixed a bug where removing a data source from Database Explorer wouldn't permanently remove the data source.
    • Fixed a threading error when removing a data source from Database Explorer.
    • Fixed a bug where CodeSmith would throw an exception when it couldn't access the systems registry.
    • Fixed a bug where Copy Properties would throw an exception when called on a unsaved template.
    • Fixed a bug where the SqlCompactSchemaProvider connection string builder class could corrupted additional connection string options.
    • Fixed a bug where the SqlCompactSchemaProvider timestamp/rowversion columns were returning a "rowversion" native type name, should be "timestamp".
    • Added CodeSmith Customer Improvement Program.
    • Various other minor changes.

    Beta

    • Fixed a bug where Generate Outputs would throw an error if a Visual Studio Solution contained a Setup and Deployment project.
    • Various minor updates to Visual Studio's Integration.
    • Updated Visual Studio Integration to unlock assemblies after generation.
    • Fixed a bug where a CSP in Solution folder causes ERROR: Object reference not set to an instance of an object.
    • CodeSmith Studio now requires that .NET 3.5 SP1 to be installed. 
    • Fixed a bug where CodeSmith Studio would attempt to save a csp for a unsaved template. 
    • Fixed a bug where a NullReferenceException would be thrown when toggling the properties window when no template properties existed.
    • Fixed a bug where extracting mapping files could cause an exception.
    • Added Widening, Narrowing, Like, Let, CUInt, CULng, CUShort, and Operator to the VB.NET keyword list.
    • Added var to the C# keyword list.
    • Fixed a bug when using Intellisense and Math. or some variable names would throw an ArgumentOutOfRangeException.
    • Updated CodeSmith Options dialog's.
    • Added support to give feedback and send detailed error information from within CodeSmith.
    • Updated Menu in CodeSmith Explorer, Users can now view the mapping editor, submit feedback, help, or configure options.
    • Updated Manage Outputs and child dialogs to save the window dimensions.
    • Added IndexedEnumerable, this is used to smartly enumerate collections and get a IsEven, IsLast, IsFirst property.
    • Added Linq Querying support to all SchemaExplorer Collections.
    • Added MergeProperty functionality for parsing properties from a CodeTemplate that inherits from an assembly.
    • Added Insert Class Merge Strategy.
    • Added CodeParser.
    • Added support to detect an embedded SDK License.
    • CodeSmith Configuration no longer uses xml files.
    • Updated the documentation for IDbSchemaProvider and DataObjectBase.
    • Fixed a bug in OracleSchemaProvider where AllowDBNull would always be set to true for view columns.
    • Fixed a bug in OracleSchemaProvider where the TableSchema.PrimaryKeys collection wasn't being populated correctly.
    • Updated OracleSchemaProvider's configuration to be configurable via the options dialog.
    • Added SQL CLR Support to the SqlSchemaProvider. To see if a command is a CLR procedure check the "CS_IsCLR" extended property.
    • Fixed a bug in SQLSchemaProvider where an xml index would be set to null after upgrading a SQL Server 2005 database to SQL Server 2008.
    • Fixed a bug in SQLSchemaProvider where the ExtendedData query was missing the PropertyBaseType and Minor columns when querying SQL Server 2000 ExtendedData.
    • Added PostgreSQLSchemaProvider, SqlCompactSchemaProvider, SQLiteSchemaProvider, VistaDBSchemaProvider.
    • Updated .netTiers to version 2.3 RTM.
    • Updated PLINQO to version 3.0.
    • Added CSLA Beta templates.
    • Various other minor changes.

    Please click here for more information.

    Posted to Blake Niemyjski by Blake Niemyjski on 05-12-2009
    Filed under:
  • How to open a mini dump file (mdmp) with WinDbg

    Today I was debugging an issue where Microsoft Visual Studio was closing at random in a Microsoft Visual Studio Package. We narrowed down the issue to a previous Microsoft bug report: Fatal Execution Error. I came to a point where Microsoft Visual Studio was creating a mini dump file.

    Microsoft Visual Studio 2008 After some quick thinking, I downloaded and installed Debugging Tools for Windows. I then opened WinDbg and clicked on “Open Crash Dump” and navigated to the location above.

    WinDbg6.11.0001.404 AMD64

    Your final result will look something like this:

    Dump CUsersBlakeAppDataLocalTempWER73C8.tmp.mdmp - WinDbg6.11.0001.404 AMD64  

    If you are looking for more information on how to analyze a mini dump file or how to tell WinDbg to use a symbol server then continue reading here.

  • CodeSmith CSLA templates - Part 1: Introduction

    I've been working on CSLA templates periodically over the past few months at CodeSmith Tools . We have designed the templates from the ground up around the CSLA.NET Framework version 3.6.2. You might be thinking what's the big deal it's just another set of CSLA templates. You are mistaken, we have done a lot of research and gathered a lot of feedback. The end result is a streamlined CSLA experience that is highly customizable.

    To start using the CSLA templates just navigate in the Template explorer to CodeSmith.CSLA and open the Quick start template.  This will change once the templates have reached Release To Web. From here all you need to do is configure the namespaces and select your data source and click generate. CodeSmith will crunch statistics on your schema and generate a working CSLA solution based on your relationships. We know that this won't be the default case for many of you but it does give you a great starting point to play with CSLA.

    We have thought a lot about plug ability and generation customization. Each of the 14 template types (Criteria, EditableRoot, EditableRootList...) have been split up into three partial classes. For the simplicity of this walk through I'll pick a database table called Account, it will have two generated partial classes Generated and DataAccess and another non generated partial class.

    Account will be the name of the class and the name of the file will be Account.cs. The sole purpose of this partial class is to hold any class customizations and custom business rules.

    Account.Generated.cs is the second generated partial class that holds all the properties and factory methods. This has been separated out so there is some separation when it comes to the Data Access portion of the class.

    Account.DataAccess.cs is the third generated partial class and holds the DataAccess implementation for the business object. Currently there are two generation options for the data access: you can generate parameterized SQL or just the method stubs. In the future this will also include Object factory, Linq to SQL, or NHibernate.

    Please stay tuned for more information and documentation on the CSLA templates. Please give us your feedback on what you think of our CSLA templates. We will also be releasing some  VB.NET CSLA templates before version 1.0 has been completed.

    Please stay tuned for part two where we go over customizing the templates and template features.

    Continue to Part 2.

    Posted to Blake Niemyjski by Blake Niemyjski on 04-24-2009
    Filed under: ,
  • .netTiers 2.3.0 Beta 2

    The .netTiers team released .netTiers 2.3.0 Beta 2 today.  .netTiers 2.3.0 is a maintenance release containing many bug fixes and patches. We have also added various requested features like Enterprise Library version 4.1 as well as support for Visual Studio 2008. I would have to say the biggest and most requested feature that went into .netTiers 2.3.0 Beta 2 was support for Oracle!

    Here is a list of all the changes since .netTiers 2.3.0 Beta 1:

    11/30/2008
                    - Changed Build numbers to reflect version 2.3 Beta 2
                    - [Issue #118] Adding a separator template to the TableRepeater.cst / ViewRepeater.cst (Contrib pzycoman).
                    - [Fix] OracleClient Views classes were not named correctly for DependentUpon.
                    - [Issue #115] Web service data layer is not using the generic client
                    - [Issue #126] WinForms Edit controls do not have the Name property set (Contrib stevehiner).
                    - [Issue #128] Bound Hyperlink fields on nullable data column (Contrib Michael Daniel).
                    - [Issue #132] Support for IsolationLevel.Snapshot.
                    - [Issue #116] Added SET NOCOUNT ON to the SQL procedures.
                    - [Fix] A bug where the entlib v4_1 config template was not registered.
                    - [Issue #129] A bug where the Validation Type would always be set to entlib 4.0 when the validation type was switched.
                    - Updated default template values.
                    - [Fix] Drop all procedures by different schema owners. (Contrib Polar)
    11/25/2008
                    - [Fix] Major bug in GetProcNameForGetByIX... Oracle Proc names should all be unique and meet the 30 character limit.
                    - Updated Oracle Stored Procedures naming conventions and fixed a bug where a ; might be placed in a wrong spot.
                    - Other Small Oracle Fixes.
    11/24/2008
                    - [Fix] A bug where the EntityTransactionModule wasn't being resolved properly in the web.config.
                    - Updated Oracle :)
    11/12/2008
                    - [Issue #123] Added Enterprise Library 4.1 support (contrib james.patterson).
    11/6/2008
                    - Updated Oracle Stored Procedures ( Made minor tweaks, fixed SCOPE_IDENTITY() bug ).
    11/5/2008
                    - Updated Oracle Stored Procedures
    11/3/2008
                    - Completed Oracle Stored Procedures,
                    - Updated XML Comments in CommonSqlCode code behind.
    10/30/2008
                    - Updated CommonSqlCode so it works with the latest build of CodeSmith 5
    10/6/2008
                    - [Issue #112] - Entity Tracking enhancements(entity tracking not working correctly in some cases), Entity Tracking performance improvements(minor)
    10/6/2008
                    - [Issue #111] - Custom Procedures with output parameters causing problems with WebServices
                    - [Issue #107] - Problems with IncludeFind options
                    - [Issue #102] - ViewDataSource didn't handle the custom stored procedures paging correctly
                    - [Issue #89] - Utility.cs in DataAccessLayer, SqlInjection --> DetectSqlInjection(string whereClause) returns always true (contrib fred.theuws)
                    - [Issue #74] - EntLib Validation - WCF attribute generation
                    - [Issue #15] - ConnectionProvider is not initialized correctly (contrib GRAW)
                    - [Issue #8] - CancelChanges() on Entity causes exceptions
    10/5/2008
                    - Updated Oracle Support.  All procedures are 100% working besides, for Find procedures and paged procedures. (Coming Soon)
                    - Updated CommonSqlCode to use the ParameterPrefix.
                    - Fixed some Generic Provider related bugs in the NetTiers.cst
    9/10/2008
                    - [FIX] - Updated View Providers!!!
    9/8/2008
                    - [Issue #46] - Added a NetTiers option to set whether or not custom procedures with multiple results will return the Custom return type or attempt to match to the Table / View to return a TList or VList.
    9/8/2008
                    - [Issue #87] - EntityState is Added after WCF serialization
                    - [Issue #86] - Layer Exception Policy not named properly in ServiceLayer
                    - [Issue #95] - ServiceResult now showing errors properly (contrib gregpakes)
    9/2/2008
                    - [ENH] - Added Initial Support for Oracle. More Will come shortly... NOTE: It seems that the View Provider Support is broken if you are not using SQL Server.
    7/28/2008
                    - [Issue #39] - ***BREAKING CHANGE***: Changed the AppendId to be able to handle ' and , in the search string.  Instead of passing in a string, you now pass in a string[] of what you want the in clause to contain.
    7/28/2008
                    - [Issue #82] - .netTiers Templates through null exception error when used with CodeSmith 5.0

    7/27/2008
                    - [Issue #72] - Stored procedures where dynamic sql is generated, switched to using VARCHAR(MAX) for Sql 2005 (contrib gregpakes)
                    - [Issue #77] - Changed the Windows Forms library option description
                    - [Issue #81] - Timestamp columns with special characters caused an error (contrib njappboy)
    7/16/2008
                    - [Issue #28] [FIX] Warnings when compiling under VS2008. Removed duplicate methods. (contrib sisyphe)
    07/10/2008
                    - [Issue #65] [FIX] Exception thrown using custom generated methods when not using stored procedures.
                   
    07/01/2008
                    - [Issue #57] [FIX] TList.FindAllBy and VList.FindAllBy throws NullReferenceException if searching for null property (contrib PhilBolduc)
                    - [Issue #66] [FIX] .netTiers Fails to generate adventureworks when executed with CodeSmith 5.0 Beta

    06/26/2008
                    - [Issue #56] [FIX] Entity fails to compile when using Guid as primary key (contrib johnyewang)
                    - [Issue #57] [FIX] FindCore throws NullReferenceException if searching for null property (contrib PhilBolduc)
    06/18/2008
                    - [Issue #54] [FIX] Logo and links are dead / need to be updated.
                    - [Issue #53] [FIX] fix for Services layer generated save methods always commit transaction - even if it is part of a larger transaction

    06/17/2008
                    - [Issue #51] [FIX] Patch implemented in Issue 25 breaks SQL 2000 Insert statements that use UniqueIdentifier primary keys with newid() default values.  Added checks to stored procedure generation to make sure SQL 2005 is selected.  Refactored IncludeDataFeaturesProperty into CommonSqlCode.cs.

    You can download the 2.3.0 Beta 2 templates at the following locations: SVN or Google code. Please submit all bug reports to http://code.google.com/p/nettiers/issues/list.

    Posted to Blake Niemyjski by Blake Niemyjski on 11-30-2008
    Filed under: , ,
« First ... < Previous 2 3 4 5 6 Next > ... Last »
windowscoding.com;
Copyright © 2008 Windows Coding
Microsoft and Microsoft logo's are trademarks of Microsoft Corporation.