Starting from February 2010 I will lead a team of .NET software engineering professionals who will teach the course “Web Applications Development with .NET Framework and ASP.NET” at the Technical Univesity - Sofia (TU-Sofia). The course complements the fundamental university education with contemporary Web development technologies. The outcomes for the students are the acquisition of practical skills for building rich-data Web applications based on .NET Framework, LINQ-to-SQL, SQL Server, ASP.NET, AJAX and Silverlight.
Course Organizers
The course is organized by the Students Council in TU-Sofia who invited Svetlin Nakov and his team to teach it for all students in TU-Sofia. The course is supported and sponsored by Telerik Corporation (large Bulgarian software development company which was recently listed in the Red Herring: Global 100 Winners).
Course Annotation
The „Web Applications Development with .NET Framework and ASP.NET” course objective is to introduce the students to the fundamentals of C#, .NET Framework, databases and Web application development with ASP.NET and AJAX. Students will learn how to build dynamic data-driven Web applications with SQL Server and ASP.NET. The course starts with the basics of C# language (data types, expressions, statements, loops, arrays, methods, strings, collections, exceptions, etc.), object-oriented programming with C# (classes and interfaces, constructors, properties, events, methods, etc.), relational databases, SQL language and SQL Server, data access technologies (LINQ and LINQ-to-SQL). The main focus is on Web technologies, starting from HTTP, HTML, CSS and JavaScript, through the fundamentals of ASP.NET and ASP.NET Web Forms. Advanced topics include building rich-data applications with ASP.NET data-bound controls, using master pages, AJAX and Silverlight. All topics covered in the course will be demonstrated in a practical session demonstrating how to build building a sample dynamic rich-data Web application from scratch, step-by-step.
Training Program
- Course Overview – Presenting the Course Objectives, Lecturers, Exams, etc..NET Framework Overview – .NET, .NET Framework, CLR, MSIL, Assemblies, CTS, .NET languages
- C# Language Overview – Part I – Data Types, Operators, Expressions, Statements, Console I/O, Conditional Statements, Loops, Arrays, Methods
- C# Language Overview – Part II – Creating and Using Objects, Exceptions, Strings, Generics, Collections, Attributes
- Object-Oriented Programming with C# – Defining Classes, Constructors, Properties, Methods, Delegates, Events, Static Members, Interfaces, Inheritance, Polymorphism
- Databases, SQL and MS SQL Server – RDBMS, SQL Language, SQL SELECT, Joins, Aggregate Functions, Grouping, SQL INSERT, SQL UPDATE, SQL DELETE, MS SQL Server, SQL Server Management Studio
- LINQ and LINQ-to-SQL – LINQ Operators and Expressions, Projections, Conversions, Aggregations, LINQ-to-SQL, Visual Studio LINQ-to-SQL Designer, Using DataContext to Read / Create / Update / Delete Data
- Web Technologies Basics – HTTP, HTML, Text, Images, Tables, Forms, CSS, JavaScript
- ASP.NET – Part I – ASP.NET Web Forms, Code Behind Pages, Page Execution Model, Web Server Controls, HTML Server Controls, Creating Simple Web Applications
- ASP.NET – Part II – Data Binding and Data-Bound Controls: Data Sources (LinqDataSource, ObjectDataSoucre), GridView, FormView, DetailsView, DataList, Repeater, ListView, Pager
- ASP.NET – Part III – Session and State Management, Master Pages and Navigation, User Controls, Web.config, ASP.NET Membership, IIS and Deployment
- ASP.NET AJAX – ScriptManager, UpdatePanel, AJAX Control Toolkit
- Silverlight – XAML, Text, Images, Graphics, Shapes, Creating Silverlight Applications, Text Controls, Buttons, List Controls, Data Binding and Data-Bound Controls
- Practical Project Demo – Creating Dynamic Rich-Data ASP.NET Web Application – Step-by-Step Live Demo
- Additional Topic #1 – Student will Suggest Interesting Topics
- Additional Topic #2 – Student will Suggest Interesting Topics
Lecturers Team
- Svetlin Nakov – Manager Technical Training, Telerik Corporation, Telerik Academy, Blog: http://www.nakov.com/blog
- Ivaylo Hristov – Managing Partner, Komfo Bulgaria, Blog: http://ivaylo-hristov.net/
- Mihail Stoynov – Technical lead, Materna Bulgaria, Blog: http://mihail.stoynov.com/blog/
- Ventsislav Popov – Developer, Crossroad
- Branislav Abadjimarinov – Senior .NET Developer, ProPeople, Blog: http://abadjimarinov.net/
- Svetlin Ralchev – software engineer, Telerik Corporation, Blog: http://blog.ralch.com/
- Ivaylo Bratoev – software engineer, Telerik Corporation, Blog: http://blogs.telerik.com/ivaylobratoev/
Requirements to Attend the Course
- Basic computer programming skills
- Basic understanding of object-oriented-programming (OOP) concepts
- English language
Assesment and Exams
Students will be assigned to develop as a practical project dynamic Web application based on .NET Framework, ASP.NET Web Forms, SQL Server and LINQ-to-SQL. Sample projects: dynamic photo album, CMS system, blog system, dating site, online game, Web mail, etc.Authors of the best projects will be awarded by our sponsor Telerik.
Official Web Site
Visit the official Web site of the course “Web Applications Development with .NET Framework and ASP.NET”: http://aspnetcourse.telerik.com/.
Posted by nakov as .net, news, blog at 3:24 PM EET
Comments Off
In the last few months I am working as full-time consultant for the training initiatives in Telerik. It is really an exciting company and I really enjoy my job as manager of the technical training and university relations. I still can’t believe that Telerik is really perfectly organized company, beyond my expectations and even dreams. It is unusual company with specific culture, structure and traditions. Unlike traditional companies our CEO sits behind me along with few developers, not in a separate “big boss room”. I will blog about Telerik in details another day. Now let me present my main work at Telerik.
Telerik Academy
Today I launched a new long-term training project called “Telerik Academy“. Telerik Academy is an initiative of Telerik Corporation aiming to provide free real-world practical training for young people who want to turn into skillful .NET software engineers and join the company development teams. The training complements the traditional University education with the cutting edge industry technologies from Microsoft and best practices in software engineering.
During the Telerik Academy training program highly motivated young people are attracted and candidates covering the program requirements are trained free of charge in the fundamentals of computer programming, logical algorithmic thinking, data structures, algorithms, problem solving and object-oriented concepts. The best of them are selected through exams and interviews and continue to the next level of training – .NET Development Essentials course, covering the .NET Framework class library, databases, SQL Server and LINQ, Web technologies, ASP.NET and AJAX, Windows Forms, WPF and Silverlight, as well as software engineering. Having successfully finished this stage the top students qualify for an additional specialized course in one of the following technological directions used in Telerik: ASP.NET & AJAX, Windows Presentation Foundation (WPF) and Silverlight, Windows Forms and Data-Centric Development. Finally, those who graduate will be presented with the opportunity to join the Telerik team and help us deliver exceptional software to the world.
Telerik Pays to Students to Study .NET Technologies
Telerik pays its trainees at Telerik Academy to learn the .NET technologies for few months and provides job for the best graduates. We are growing even during the global financial crisis and Telerik Academy is our way to grow with highly-motivated and skillful junior developers. Our learning track takes 6 months:
- Foundations of C# Programming (Part 1) - 100 people, free of charge, 1 month, 8 hours/week, staring in February
- Foundations of C# Programming (Part 2) - 50 people (filtered by exam), free of charge, 1 month, 12 hours/week, staring in Marh
- .NET Programming Essentials - 15-20 students, 3 months, 4 hours/day, staring in April
- ASP.NET / Windows Forms / Silverlight & WPF / Data-Centric - 10-15 students, paid to be trained, 1 month, 8 hours/day
- All successfully graduated people start work in Telerik
Program Requirements
The minimum requirements for any candidate are:
- Ability and willingness to work at full time (8 hours/daily) - after the first 2 months
- High motivation to become software engineering professional
- Technical English
- Computer literacy
- Long term commitment
Apply for Telerik Academy
To apply for free 6-months .NET training visit the Telerik Academy official web site.
Posted by nakov as .net, news, blog at 10:13 PM EET
Comments Off
For my last project we used Oracle 10g and NHibernate ORM framework (the project was started 4-5 yars ago, long before LINQ and ADO.NET Entity Framework). I had a database table which holds payment information along with scanned images of the payment documents. Usually such tables are mapped with a class fully corresponding to the table fields. The usual approach works well but has a performance problem: when the table needs to be displayed, the binary images holding the payment documents do not need to be loaded from the database because they consume much memory and take time to load. NHibernate supports lazy loading for associations only but does not support lazy column / property loading. To achieve a normal performance I needed to do a quick hack and I believe it could be useful for other projects so I want to shera it with the community.
The hack is to map all columns of the database table except the large binary column (BLOB type in Oracle). The large binary column is handle differently with additional select / update operations. See the payment entity definition below:
The database schema of the PAYMENTS table is as follows:
I use NHibernate annotations because I want to have the entity class and the .hbm mapping in the same file.
The idea behind the “column lazy loading” hack is to skip mapping the large BLOB column and to red/write it on demand with additional SELECT / UPDATE command.
This approach is applicable to other ORM frameworks that do not support lazy column loading.
Enjoy.
Posted by nakov as .net, blog at 11:24 PM EET
Comments Off
Today I with Vesko Kolev started a new project: writing a C# book in Bulgarian for beginners that covers the fundamental concepts of computer programming, data structures and algorithms as well as object-oriented concepts, high-quality programming code and problem solving. The book is titled “Introduction to Programming with C#” and will be based on its well-known sister, the book “Introduction to Programming with Java”. Most of the book content will be adaptation of its Java variant but some new concepts will also be introduced. The book focuses on the fundamental concepts of computer programming, not just the C# language. It covers topics like recursion, data structures (linear, trees, graphs, hash-tables and sets), combinatorial algorithms and problem solving which can not be found in every C# book. The book does not cover software engineering, Web programming, databases, desktop applications, mobile applications and other software technologies, just the bases of computer programming, logical thinking and problem solving. The book is free and open-source and is driven by volunteers who like to share their knowledge and skills with the young developers who try to make their first steps in computer programming and software engineering.
The book’s official Web site will be located at: http://www.introprogramming.info.
The developer’s Web site is located in Google Code: http://code.google.com/p/introcsharpbook/.
The SVN repository containing all project assets is located at: http://introcsharpbook.googlecode.com/svn/trunk/.
The developer’s mailing list (discussion group) is located at: http://groups.google.com/group/introcsharpbook.
Authors and editors are welcome to help the project. To join to this open-source voluntary project please contact Svetlin Nakov or Vesko Kolev. The working language is Bulgarian (some day we plan to publish an English version but let’s do the things step-by-step).
Posted by nakov as .net, news, blog at 2:46 AM EET
Comments Off
Last week I needed to implement a piece of software for scanning small documents (bank payment orders). The problem was to scan documents with specific size (less than A4) in 300 DPI and with normal brightness and contrast. I found that in C# there are two general approaches to this problem:
- Using the TWAIN interface
- Using Windows Image Acquisition (WIA) API
Both interfaces are not natively supported in .NET Framework so some kind of wrappers was necessary to be developed. I choose WIA because it was simpler and higher level API with sufficient enough power.
To use WIA you need to download it from Microsoft (it is a COM server, distributed freely): http://www.microsoft.com/downloads/details.aspx?familyid=a332a77a-01b8-4de6-91c2-b7ea32537e29&displaylang=en.
The next step is to add it as COM object reference in Visual Studio (you need a single file called wiaaut.dll that you need to register with regsvr32). Once you add the reference to WIA COM object in Visual Studio, you get the namespace WIA. All you need to scan image is in this namespace. The most important classes are: Device, Item and CommonDialogClass.
I will not get into more details because developers need code and usually read the text only if the code is not working. Am I right? Did you tread this text?
The above example scans a small area of the page in 300 DPI (color mode), saves the result in PNG format and displays it in a picture box. Download the entire example’s source code: playingwiththescanner.zip.
The interface of WIA is really ugly and is not C# friendly, but that’s the life. Enjoy….
Posted by nakov as .net, news, blog at 1:36 AM EET
Comments Off
ASP.NET membership providers are nice framework for managing users and roles in ASP.NET Web applications but they have a strong weakness: they do not support transactions.
Why We Need Transactions During User Registration?
We may need to use transactions for example when we want to register new user account, assign few roles to it and configure some other tables for the new user, e.g. a table keeping user’s postal address and phone number. In this case if user registration fails for some reason and we are not in a transaction, the user could be partially registered and the database could become in inconsistent state. Imagine that during the registeration of new user called “peter” his address it too long to fit in the corresponding table column. The user registration will fail but the user will be partially registered and when Peter try to register again with a shorter address his preffered username “peter” will no longer be available. This is called “partially registered user”. Obviously we need to perform the entire user registration process in a transaction to avoid partially registered users, right?
Standard ASP.NET Membership Providers Do Not Support Transactions
To avoid incorrect behaviour during the user registration process described above we need to use transactions. We have two options:
- Traditional ADO.NET transactions.
- Using TransactionScope based transactions.
Standard ADO.NET Transactions
Using the traditional transactions from ASP.NET is not directly possible with ASP.NET membership providers because each operation they provide is supposed to open a new (their own) database connection with separate autonomous transaction. You cannot pass an open database connection and already started transaction as parameter to Membership.CreateUser(…), at least with the latest Oracle providers (ODP.NET 11.1.7.20). The membership provider will always establish a new database transaction and will register the user in separate database session and transaction.
TransactionScope and Distributed Transactions with Oracle
Using TransactionScope could potentially solve the problem but it will cause use of a distributed transaction (one transaction for your database connection and another transaction for the connection that the membership provider internally opens). This is a little bit tricky with the latest Oracle 11g Data Providers for .NET (ODP.NET). First you need to configure the connection parameters in a specific way (see the ODP.NET documentation). Second you need to install and run a special service called OracleMTSRecoveryService (which failed to install on 2 of my 3 testing environments with freshly installed Windows). Third, the Microsoft Dictributed Transaction Coordinator (MSDTC) should be running to handle the two-phase commits. Last, but very important problem is that distributed transactions just do not work with some combinations of Oracle database, Oracle Client and ODP.NET (I don’t remember the exact versions but some combinations just fail with an internal Oracle.DataAccess unmanaged exception). After few hours of testing TransactionScope and distributed transactions with Oracle database on various environments and reading lost of negative comments in the community forums I concluded that using distributed transactions with Oracle in tricky and I prefer to avoid it.
Hacking the Oracle ASP.NET Membership Provider
Due to the problems with the distributed transactions described above I decided to extend the Oracle.Web.dll library that implements the Oracle membership provider, Role provider, SiteMap provider, etc. with functionality allowing to pass an open database connection with an associated active transaction to all major operations (e.g. CreateUser, DeleteUser, etc.). What I did was to decompile the Oracle.Web.dll with .NET Reflector and its plugin called Reflector.FileDisassembler and obtain C# source code and Visual Studio 2008 project. The provider was not obfuscated and the bugs introduced during the compilation were fixable in few minutes (decompilation always is imperfect and the code is uncompilable). Adding additional parameter to all major provider functionality could take an hour or so and you can compile the Oracle.Web.dll library for x86 or x64 platforms. Note that Oracle.Web.dll is platform independed but uses Oracle.DataAccess.dll which has unmanaged code and is platform specific (32-bit or 64-bit).
The final result was my libraries called Extended.Oracle.Web.dll and Extended.Oracle.Web-x64.dll which extend the standard Oracle Membership provider (comming with ODP.NET) with ability to provide an open database connection when using the provider functionality. Using such functionality is simple:
Finally we have transactions with the Oracle membership provider but without distributed transactions. Happy hacking!
P.S. I will not provide the modified x86 and x64 versions of Oracle.Web.dll and Oracle.DataAccess.dll because I believe that decompiling and redistributing non-open-source software from Oracle is “a little bit illegal” and I did the above decompilations just for training purposes and experiments (until the opposite is proven).
Posted by nakov as .net, blog at 1:06 AM EEST
Comments Off
All .NET and Microsoft oriented developers are invited to DevReach 2009 conference - the premier conference for Microsoft technologies for the Balkans and Eastern Europe region. This year the conference attracts distinguished speakers who will deliver talks about Silverlight, WPF, ASP.NET 4.0, ASP.NET MVC, AJAX, IIS 7, Visual Studio 2010, SharePoint, SQL Server 2008, business intelligence, data access and ORM, LINQ, RESTful applications, WCF, WWF, .NET service bus, Scrum and many others. Some of the speakers:
- Chris Sells - Program Manager for the Business Platform Division Microsoft
- Luka Debeljak - CEE DPE Regional Technical Lead at Microsoft
- Kent Alstad - Microsoft ASP.NET MVP and principal at Strangeloop
- Stephen Forte - Microsoft Regional Director for NY
- Christian Weyer - Microsoft Regional Director and co-founder of thinktecture
- Tiberiu Covaci - INETA Country Leader for Sweden
- Hadi Hariri - Technical Lead iMeta Technologies
- Todd Anglin - Telerik Chief Technical Evangelist
- Richard Campbell - .NET Rocks and RunAs Radio
- Shawn Wildermuth - Microsoft MVP
For more information visit the DevReach conference official web site: http://www.devreach.com/.
Posted by nakov as .net, news, blog at 7:00 PM EEST
Comments Off
The .NET Framework does not provide standard functionality for resolving a path relative to the application root to a physical file system path. Thus in ASP.NET Web applications we need to use Server.MapPath(), but in console and Windows Forms applications we need to rely on the current directory. Moreover if we run a Web application in the “Visual Studio Development Web Server”, the current directory is the root of the Web application, but when we deploy the application in IIS we find that the current directory is different. .NET developers need functionality that resolves a relative path in “tilde” style to a physical path that works in both Web and desktop scenario. Thus they can always use relative paths like “~/config/users.xml” and don’t need to change anything when moving a code from a Web application to desktop application.
Below is the source code in C# of my universal file path resolver that many developers could find useful:
Note that this class removes automatically the “\Bin\Debug” directory suffix generated by Visual Studio during the compilation so you can rely that “~” denotes the root directory of the application not depending of the project type (Web / Console / Windows Forms / WPF / Class Library / Windows Service / etc.).
Note also that we should use Assemble.CodeBase instead of Assembly.Location because in certain circumstances these locations differs (e.g. if the application runs inside NUnit Runner). The above code of course would work under the assumption that the assembly is stored locally (comming from the file system, not from the network) [as of 13-Nov-2009].
Posted by nakov as .net, blog at 2:27 PM EEST
Comments Off
I needed to enumerate all COM ports in C# and get their name (e.g. COM1, COM2, …) and their description shown in the Windows Device Manager (e.g. “Communications Port”, “RT USB MRTD Reader”). You could find lots of unmanaged code for doing this but I think this C# code could be helpful to people who perform communication through the serial interface in .NET:
Posted by nakov as .net at 6:17 PM EEST
Comments Off
Today a customer of mine requested to integrate our ASP.NET based Web application with Microsoft CRM 3.0. Initially I thought this will be a simple task but few hours later I found that this is not straightforward.
Accessing MS CRM 3.0 from .NET
The best way to access MS CRM 3.0 from .NET application is to use its Web services. We first need to add a Web reference to the CRM Web sirvice URL. In my case it was the following:
http://crm.myserver.com/MSCRMServices/2006/CrmService.asmx?WSDL
I hope in CRM 4.0 it will be similar. Assume we are given the name “MSCRM30″ for my Web reference.
Listing all Existing Leads
To list all existing leads we can use the following C# code:
Creating a Lead
To create a new lead we can use the following C# code:
Posted by nakov as .net at 9:06 PM EEST
Comments Off