اشتراک‌ها
پیاده سازی الگوی ریپازیتوری و تزریق وابستگی در ado.net

Nowadays, I am trying to learn different design patterns in object oriented paradigm that are pretty useful to implement generic solutions for different scenarios. Few weeks ago for a job hunt, I got an assignment to do which was a web application that would interact with database, so I took it up as a challenge and decided to make it loosely coupled using design patterns which were applicable in that scenario.

 
پیاده سازی الگوی ریپازیتوری و تزریق وابستگی در ado.net
اشتراک‌ها
NET 5.0 Preview 8. منتشر شد

Today, we are releasing .NET 5.0 Preview 8. The .NET 5.0 release is now “feature complete”, meaning that very nearly all features are in their final form (with the exception of bug fixes still to come). Preview 8 is, appropriately, the last preview. We plan on releasing two go-live release candidates before the final .NET 5.0 release in November. This post describes a selection of features across the .NET 5.0 release. 

NET 5.0 Preview 8. منتشر شد
اشتراک‌ها
کتاب رایگان NancyFX Succinctly

In NancyFX Succinctly, you'll learn what NancyFX is all about, where it came from, and what it can do for you as a .NET developer. Author Peter Shaw will explain why NancyFX is more than just another web framework, and teach you some of the many tricks that make it as easy as possible for you to create stunning web-enabled applications on the .NET platform.  

کتاب رایگان NancyFX Succinctly
اشتراک‌ها
معرفی کنترل چارت زیبای NVD3
با امکاناتی شامل
  • گروه بندی سطری و ستونی در چارت
  • چارتهای خطی انباشته (cumulative)
  • Pie Chart
  • تولتیپ بر روی نودهای سریها
  • چارتهای پشته ای (Stacked Area)
  • چارتهای Discrete Bar
  • چارتهای حبابی
  • چارتهای گلوله ای (Bullet Chart) 

This project is an attempt to build re-usable charts and chart components for d3.js without taking away the power that d3.js gives you. This is a very young collection of components, with the goal of keeping these components very customizeable, staying away from your standard cookie cutter solutions. 
معرفی کنترل چارت زیبای NVD3
نظرات مطالب
آزمایش Web APIs توسط Postman - قسمت چهارم - نوشتن آزمون‌ها و اسکریپت‌ها
یک نکته‌ی تکمیلی: نمونه‌هایی از آزمایش‌های Postman


بررسی status code دریافتی از سرور
pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});

pm.test("Status code is 200", function () {
    pm.expect(pm.response.code).to.equal(200);
});

pm.test("Request is successful", function () {
    pm.response.to.be.succes;
}); // Status code is in the 2XX range

pm.test("Request results in a client error", function () {
    pm.response.to.be.clientError;
}); // Status code is in the 4XX range

pm.test("Request results in a Not Found error", function () {
    pm.response.to.be.notFound;
}); // 404

pm.test("Status code is 200 or 204", function () {
    pm.expect([200, 204]).to.include(pm.response.code);
});

بررسی هدرهای دریافتی از سرور
pm.test("Response has Content-Type header", function () {
    pm.response.to.have.header("Content-Type");
});

pm.test("Response has Content-Type header with application/json; charset = utf - 8 as value", function () {
    pm.response.to.have.header(
        'Content-Type',
        'application/json; charset=utf-8');
});

بررسی بدنه‌ی درخواست
pm.test("Response has a non-empty body", function () {
    pm.expect(pm.response.text()).not.empty;
});

pm.test("Response has a non-empty body", function () {
    pm.expect(pm.response.json()).not.empty;
});

pm.test("Response has a non-empty body", function () {
    pm.response.to.have.body();
});

pm.test("Response has a non-empty body", function () {
    pm.response.to.have.jsonBody();
});

بررسی خواص اشیاء دریافتی از سرور
var updatedAuthor = pm.response.json();
pm.test("Author properties have been updated", function () {
    pm.expect(updatedAuthor.firstName).to.equal("Vahid");
    pm.expect(updatedAuthor.lastName).to.equal("N");
});
مطالب
مدیریت AccessViolationException در برنامه‌های دات نت 4 به بعد
فرض کنید که از یک برنامه‌ی native ویندوز برای تهیه تصاویر سایت‌ها در یک برنامه‌ی وب استفاده می‌کنید و صبح که به سایت سر زده‌اید پیام در دسترس نبودن سایت قابل مشاهده است. مشکل از کجا است؟!

یک مثال ساده

using System;

namespace AccessViolationExceptionSample
{
    class Program
    {
        private static unsafe void AccessViolation()
        {
            byte b = *(byte*)(8762765876);
        }

        static void Main(string[] args)
        {
            try
            {
                AccessViolation();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            Console.WriteLine("Press a key...");
            Console.ReadKey();
        }
    }
}
برنامه‌ی کنسول فوق را پس از فعال سازی Allow unsafe code در قسمت تنظیمات پروژه، کامپایل کرده و سپس آن‌را خارج از VS.NET اجرا کنید. احتمالا انتظار دارید که قسمت catch این کد حداقل اجرا شود و سپس سطر «کلیدی را فشار دهید» ظاهر گردد. اما ... خیر! کل پروسه کرش کرده و هیچ پیام خطایی را دریافت نخواهید کرد. اگر به لاگ‌های ویندوز مراجعه کنید پیام زیر قابل مشاهده است:
 System.AccessViolationException.  Attempted to read or write protected memory.
 This is often an indication that other memory is corrupt.
و این نوع مسایل هنگام کار با کتابخانه‌های C و ++C زیاد ممکن است رخ دهند. نمونه‌ی آن استفاده از WebControl دات نت است یا هر برنامه‌ی native دیگری. در این حالت اگر برنامه‌ی شما یک برنامه‌ی وب باشد، عملا سایت از کار افتاده‌است. به عبارتی پروسه‌ی ویندوزی آن کرش کرده و بلافاصله از طرف ویندوز خاتمه یافته است.


چرا قسمت catch اجرا نشد؟

از دات نت 4 به بعد، زمانیکه دسترسی غیرمجازی به حافظه صورت گیرد، برای مثال دسترسی به یک pointer آزاد شده، استثنای حاصل، توسط برنامه catch نشده و اجازه داده می‌شود تا برنامه کلا کرش کند. به این نوع استثناءها Corrupted State Exceptions یا CSE گفته می‌شود. اگر نیاز به مدیریت آن‌ها توسط برنامه باشد، باید به یکی از دو طریق زیر عمل کرد:
الف) از ویژگی HandleProcessCorruptedStateExceptions بر روی متد فراخوان کتابخانه‌ی native باید استفاده شود. برای مثال در کدهای فوق خواهیم داشت:
   [HandleProcessCorruptedStateExceptions]
  static void Main(string[] args)
  {
ب) و یا فایل کانفیگ برنامه را ویرایش کرده و چند سطر ذیل را به آن اضافه کنید:
 <?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <runtime>
     <legacyCorruptedStateExceptionsPolicy enabled="true" />
  </runtime>
</configuration>
در این حالت مدیریت اینگونه خطاها در کل برنامه همانند برنامه‌های تا دات نت 3.5 خواهد شد.
اشتراک‌ها
حسابداری برای توسعه دهنده‌ها

Accounting For Software Engineers

The difference between accountants and software engineers, when it comes to accounting systems, is about what we primarily care about. Accountants care about meaning: is the quick ratio in good shape? Is income growing at an expected rate? How do we deal with an upcoming expense? Software engineers care about: will we properly move money around so that the balances are correct given certain latency, concurrency, etc.? Do we have the information required to generate the Income Statement? How do we represent a credit memo?

حسابداری برای توسعه دهنده‌ها
نظرات اشتراک‌ها
برای ساخت ویندوز 10 از چه زبان‌های برنامه نویسی استفاده شده‌است؟
The full source tree with all the code, test code and everything that together constitutes the “Windows source code” is more than a half terabyte in size, in more than 4 million files. You can spend a year (seriously) just drilling down the source tree, more than a half million folders containing the code for every component making up the OS workstation and server products and all their editions, tools, and associated developement kits, and see what’s in there, read the file names and try to figure out what does what. It would take a life (or two) to read it all.