اشتراک‌ها
کتابخانه gridstack.js

gridstack.js is a jQuery plugin for widget layout. This is drag-and-drop multi-column grid. It allows you to build draggable responsive bootstrap v3 friendly layouts. It also works great with knockout.jsangular.js and touch devices.  Demo  Demo

کتابخانه gridstack.js
اشتراک‌ها
کتاب رایگان Go Succinctly

The Go programming language is relatively small and concise, but its depth makes it an ideal option for solving modern-day development problems. In Go Succinctly, author Mark Lewin guides readers through the basics of Go, and he provides documentation and resources that allow users to dive into the language and learn it for themselves. By the end of the book, novices and experienced programmers alike will be conversant in a language quickly gaining traction around the world.

Table of Contents
  1. Welcome
  2. Introducing Go
  3. Let’s Go!
  4. Variables, Constants, and Assignments
  5. Basic Data Types
  6. Control Structures
  7. Arrays, Slices, and Maps
  8. User-Defined Types
  9. Concurrency
  10. Standard Packages
  11. Go Further 
کتاب رایگان Go Succinctly
اشتراک‌ها
WebWindow؛ جایگزین الکترون برای برنامه‌های NET Core.

My last post investigated ways to build a .NET Core desktop/console app with a web-rendered UI without bringing in the full weight of Electron. This seems to have interested a lot of people, so I decided to upgrade it to newer technologies and add cross-platform support.

The result is a little NuGet package called WebWindow that you can add to any .NET Core console app. It can open a native OS window (Windows/Mac/Linux) containing web-based UI, without your app having to bundle either Node or Chromium. 

WebWindow؛ جایگزین الکترون برای برنامه‌های NET Core.
اشتراک‌ها
9 کتابخانه جاوااسکریپتی جهت ایجاد نمودار
 So you have in your hand tons of data, with a number of variables, that you have to somehow relay to somebody else. Raw, unorganized data is going to be difficult for them to understand. This is why you need help from charts. In web design, charts are one of the best tools for data visualization. It is easy to read, easy on the eyes and relatively easy to set up. 
9 کتابخانه جاوااسکریپتی جهت ایجاد نمودار
اشتراک‌ها
همکاری با DevComponents در زمینه تولید کامپوننت!

سال‌هاست که از کامپوننت‌های DevComponents در کارهای خودم استفاده می‌کنم. شاید شما هم از طرفداران این کامپوننت‌ها باشید چرا که در بین شرکت‌های موجود، ارائه کیفیت در عین حفظ کمترین تعداد dllها از ویژگی‌های بارز DevComponents محسوب می‌شود.
در حالیکه برای بررسی نخسه‌های آخر سری به وب‌سایت و بعد وبلاگشون زدم، متوجه شدم که DevComponents علاقمند به همکاری با برنامه‌نویسان و طراحان از سرتاسر دنیاست. متن آغازین این همکاری برام خیلی جالب بود:

"There are three kinds of people in this world: Those who make things happen; those who watch things happen; and those who just wonder what a heck happened? "

خلاصه اگر به دسته اول تعلق دارید، می‌توانید از این فرصت بهره‌مند شوید. تنها چیزی که به آن احتیاج دارید بستر اینترنت خوب برای برقراری ارتباط می‌باشد.

You can be located anywhere in the world as long as you have internet connection. You can work any hours you want as long as work gets done. You have freedom and control over your working hours. All we ask for is that things get done. You will also get responsibility of supporting whatever you develop since we believe that is the best way to understand what our customers need. 

همکاری با DevComponents در زمینه تولید کامپوننت!
اشتراک‌ها
کلاس‌های Codility


Refactor yourself
Become a better programmer. Develop your coding skills with our lessons. Take part in our challenges.

کلاس‌های Codility
اشتراک‌ها
پیاده سازی یک Filter سفارشی برای نگاشت استثنای همزمانی به خطاهای MadelState
 public class HandleConcurrencyExceptionAttribute : FilterAttribute, IExceptionFilter
    {
        private PropertyMatchingMode _propertyMatchingMode;
        /// <summary>
        /// This defines when the concurrencyexception happens, 
        /// </summary>
        public enum PropertyMatchingMode
        {
            /// <summary>
            /// Uses only the field names in the model to check against the entity. This option is best when you are using 
            /// View Models with limited fields as opposed to an entity that has many fields. The ViewModel (or model) field names will
            /// be used to check current posted values vs. db values on the entity itself.
            /// </summary>
            UseViewModelNamesToCheckEntity = 0,
            /// <summary>
            /// Use any non-matching value fields on the entity (except timestamp fields) to add errors to the ModelState.
            /// </summary>
            UseEntityFieldsOnly = 1,
            /// <summary>
            /// Tells the filter to not attempt to add field differences to the model state.
            /// This means the end user will not see the specifics of which fields caused issues
            /// </summary>
            DontDisplayFieldClashes = 2
        }


        public HandleConcurrencyExceptionAttribute()
        {
            _propertyMatchingMode = PropertyMatchingMode.UseViewModelNamesToCheckEntity;
        }

        public HandleConcurrencyExceptionAttribute(PropertyMatchingMode propertyMatchingMode)
        {
            _propertyMatchingMode = propertyMatchingMode;
        }


        /// <summary>
        /// The main method, called by the mvc runtime when an exception has occured.
        /// This must be added as a global filter, or as an attribute on a class or action method.
        /// </summary>
        /// <param name="filterContext"></param>
        public void OnException(ExceptionContext filterContext)
        {
            if (!filterContext.ExceptionHandled && filterContext.Exception is DbUpdateConcurrencyException)
            {
                //Get original and current entity values
                DbUpdateConcurrencyException ex = (DbUpdateConcurrencyException)filterContext.Exception;
                var entry = ex.Entries.Single();
                //problems with ef4.1/4.2 here because of context/model in different projects.
                //var databaseValues = entry.CurrentValues.Clone().ToObject();
                //var clientValues = entry.Entity;
                //So - if using EF 4.1/4.2 you may use this workaround
                var clientValues = entry.CurrentValues.Clone().ToObject();
                entry.Reload();
                var databaseValues = entry.CurrentValues.ToObject();

                List<string> propertyNames;

                filterContext.Controller.ViewData.ModelState.AddModelError(string.Empty, "The record you attempted to edit "
                        + "was modified by another user after you got the original value. The "
                        + "edit operation was canceled and the current values in the database "
                        + "have been displayed. If you still want to edit this record, click "
                        + "the Save button again to cause your changes to be the current saved values.");
                PropertyInfo[] entityFromDbProperties = databaseValues.GetType().GetProperties(BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.Instance);

                if (_propertyMatchingMode == PropertyMatchingMode.UseViewModelNamesToCheckEntity)
                {
                    //We dont have access to the model here on an exception. Get the field names from modelstate:
                    propertyNames = filterContext.Controller.ViewData.ModelState.Keys.ToList();
                }
                else if (_propertyMatchingMode == PropertyMatchingMode.UseEntityFieldsOnly)
                {
                    propertyNames = databaseValues.GetType().GetProperties(BindingFlags.Public).Select(o => o.Name).ToList();
                }
                else
                {
                    filterContext.ExceptionHandled = true;
                    UpdateTimestampField(filterContext, entityFromDbProperties, databaseValues);
                    filterContext.Result = new ViewResult() { ViewData = filterContext.Controller.ViewData };
                    return;
                }



                UpdateTimestampField(filterContext, entityFromDbProperties, databaseValues);

                //Get all public properties of the entity that have names matching those in our modelstate.
                foreach (var propertyInfo in entityFromDbProperties)
                {

                    //If this value is not in the ModelState values, don't compare it as we don't want
                    //to attempt to emit model errors for fields that don't exist.

                    //Compare db value to the current value from the entity we posted.

                    if (propertyNames.Contains(propertyInfo.Name))
                    {
                        if (propertyInfo.GetValue(databaseValues, null) != propertyInfo.GetValue(clientValues, null))
                        {
                            var currentValue = propertyInfo.GetValue(databaseValues, null);
                            if (currentValue == null || string.IsNullOrEmpty(currentValue.ToString()))
                            {
                                currentValue = "Empty";
                            }

                            filterContext.Controller.ViewData.ModelState.AddModelError(propertyInfo.Name, "Current value: "
                                 + currentValue);
                        }
                    }

                    //TODO: hmm.... how can we only check values applicable to the model/modelstate rather than the entity we saved?
                    //The problem here is we may only have a few fields used in the viewmodel, but many in the entity
                    //so we could have a problem here with that.
                    //object o = propertyInfo.GetValue(myObject, null);
                }

                filterContext.ExceptionHandled = true;

                filterContext.Result = new ViewResult() { ViewData = filterContext.Controller.ViewData };
            }
        }
پیاده سازی یک Filter سفارشی برای نگاشت استثنای همزمانی به خطاهای MadelState
اشتراک‌ها
ضبط و پخش مجدد درخواست های Http توسط کتابخانه داتنتی VCR Sharp

Vcr-sharp lets you record and playback HTTP requests! In this example, WithCassette is an extension method on HttpClientFactory. That extension method sets up a DelgatingHandler to a ReplayingHandler. That ReplayingHandler "loads the cassette" and returns it as a cached response. 

  using (var httpClient = HttpClientFactory.WithCassette( "my-test-scenario" ))      
  {        
    var request =  new HttpRequestMessage(HttpMethod.Get,  "http://www.iana.org/domains/reserved" );   
    var response = await httpClient.SendAsync(request);     
    var body = await response.Content.ReadAsStringAsync();      
    body.ShouldContain( "Example domains" );     
  }
ضبط و پخش مجدد درخواست های Http توسط کتابخانه داتنتی VCR Sharp