Stories recently tagged with 'Programming' Subscribe to this feed

A* pathfinding search in C# - Part 3 (www.leniel.net)

submitted by lenielleniel(415) 2 months, 8 days ago

This is the last installment in the series about A* search. The C# source code implemented is available in the final part of this post. As promised in the last words of A* pathfinding search in C# - Part 2 today we’re gonna run a test case using the Romania map. This post shows a test case in which the application outputs the shortest path from Arad to Bucharest. I used the ViewOtherPaths method to show the different possible routes. This way we can have a look at why the A* algorithm has chosen such shortest path. read more...

add a comment | category: | Views: 4

tags: another

A* pathfinding search in C# - Part 2 (www.leniel.net)

submitted by lenielleniel(415) 2 months, 8 days ago

This post describes step by step the methods used to implement the A* search algorithm. To illustrate the path finding problem and how it can be solved using A* I decided to use the Romania map (with the same Cities I used in Breadth and depth first search series of posts). Now I modified it adding more connections between the cities so that we have more fun while debugging the code. This time I decided to get the real values of latitude and longitude for the cities shown in the Romania map. See how a graph of cities is assembled using the real geocode values for latitude and longitude using Google Maps service. read more...

add a comment | category: | Views: 2

tags: another

Parallel LINQ (PLINQ) with Visual Studio 2010 (www.leniel.net)

submitted by lenielleniel(415) 3 months, 7 days ago

On the last day of May I wrote about how to calculate prime numbers with LINQ in C#. To close that post I said that I’d use the primeNumbers delegate to evaluate PLINQ (Parallel LINQ) and measure the performance gains when the same calculation is done in parallel instead of in a sequential fashion. As promised, today I show the performance gains when the same delegate is run in 2 cores (parallel) instead of only 1 core (sequential). In this post you'll also see the new parallel debugging windows that come with Visual Studio 2010: Parallel Stacks and Parallel Tasks. read more...

add a comment | category: | Views: 16

tags: another

Finding missing numbers in a list using LINQ with C# (www.leniel.net)

submitted by lenielleniel(415) 3 months, 28 days ago

Let’s say you have a list of integer values that represent the days of a month like this: 6, 2, 4, 1, 9, 7, 3, 10, 13, 15, 19, 11, 18, 13, 22, 24, 20, 27, 31, 25, 28 - Clearly we have missing numbers/days in the list. They are: 5 8 12 14 16 17 21 23 26 29 30. It’s really easy to get a list of missing numbers using LINQ with C# and the Except operator. LINQ is the greatest addition to the C# language. I can imagine how life would be difficult if we hadn’t LINQ! This post shows how I implemented a missing numbers finder using a C# extension method. read more...

add a comment | category: | Views: 13

tags: another

NPOI with Excel Table and dynamic Chart (www.leniel.net)

submitted by lenielleniel(415) 3 months, 29 days ago

NPOI is a great open source project that enables us to create Excel spreadsheets in code using Microsoft .Net Framework. A reader of my blog commented on the post titled Creating Excel spreadsheets .XLS and .XLSX in C# about a problem he was having to get NPOI working with an Excel table bound to a chart. The chart should get updated whenever new data is inserted into the table. NPOI doesn't achieve what the user desires at first but in this post I experiment a workaround to the problem so that you can use NPOI to insert new data on a template spreadsheet that has a table bound to chart. Read on... read more...

add a comment | category: | Views: 26

tags: another

Regex matching and naming groups in C# (www.leniel.net)

submitted by lenielleniel(415) 4 months, 14 days ago

Let’s say you have a string and want to match individual groups of characters against that string. How would you do that? That’s the question I asked myself. The following code is the outcome of some research on how to get this done. It shows you how to capture/match and name groups of characters using a regex. read more...

add a comment | category: | Views: 20

tags: another

Creating Excel spreadsheets .XLS and .XLSX in C# - ASP.NET MVC Project (www.leniel.net)

submitted by lenielleniel(415) 7 months, 7 days ago

Recently I had to implement some code to create an Excel spreadsheet/report using C#. The task was: given an Excel spreadsheet template - a .XLS file (with formulas, pivot tables, macros, etc) I had to fill some data in one of the sheets of the spreadsheet and send this modified spreadsheet back to the user requesting such an operation (Excel report). I had a great time while studying the possible ways of doing what the task asks for. In this article I present an ASP.NET MVC project that shows you how to create an .XLS file using NPOI and an .XLSX file using ExcelPackage. read more...

add a comment | category: | Views: 332

tags: another

Creating Excel spreadsheets .XLS and .XLSX in C# - ASP.NET MVC Project (www.leniel.net)

submitted by lenielleniel(415) 7 months, 7 days ago

Recently I had to implement some code to create an Excel spreadsheet/report using C#. The task was: given an Excel spreadsheet template - a .XLS file (with formulas, pivot tables, macros, etc) I had to fill some data in one of the sheets of the spreadsheet and send this modified spreadsheet back to the user requesting such an operation (Excel report). I had a great time while studying the possible ways of doing what the task asks for. In this article I present an ASP.NET MVC project that shows you how to create an .XLS file using NPOI and an .XLSX file using ExcelPackage. read more...

add a comment | category: | Views: 332

tags: another

Creating Excel spreadsheets .XLS and .XLSX in C# - ASP.NET MVC Project (www.leniel.net)

submitted by lenielleniel(415) 7 months, 7 days ago

Recently I had to implement some code to create an Excel spreadsheet/report using C#. The task was: given an Excel spreadsheet template - a .XLS file (with formulas, pivot tables, macros, etc) I had to fill some data in one of the sheets of the spreadsheet and send this modified spreadsheet back to the user requesting such an operation (Excel report). I had a great time while studying the possible ways of doing what the task asks for. In this article I present an ASP.NET MVC project that shows you how to create an .XLS file using NPOI and an .XLSX file using ExcelPackage. read more...

add a comment | category: | Views: 332

tags: another

Creating Excel spreadsheets .XLS and .XLSX in C# - ASP.NET MVC Project (www.leniel.net)

submitted by lenielleniel(415) 7 months, 7 days ago

Recently I had to implement some code to create an Excel spreadsheet/report using C#. The task was: given an Excel spreadsheet template - a .XLS file (with formulas, pivot tables, macros, etc) I had to fill some data in one of the sheets of the spreadsheet and send this modified spreadsheet back to the user requesting such an operation (Excel report). I had a great time while studying the possible ways of doing what the task asks for. In this article I present an ASP.NET MVC project that shows you how to create an .XLS file using NPOI and an .XLSX file using ExcelPackage. read more...

add a comment | category: | Views: 332

tags: another

A* pathfinding search in C# - Part 1 (www.leniel.net)

submitted by lenielleniel(415) 7 months, 20 days ago

Standing on the shoulders of giants just like Eric Lippert, this is my try to create a running sample of the code he has presented in his magnific series of posts titled Path Finding Using A* in C# 3.0. Eric wrote the base structure of the A* pathfinding algorithm but didn’t provide a complete running sample. I basically added some code I had already posted on the series of posts titled Breadth and depth first search and created some properties here and there to get the whole thing running. It’s nothing more than code reuse. In this implementation you'll find interesting data structures as a priority queue and and immutable stack. read more...

add a comment | category: | Views: 21

tags: another

Var Wars – Abuse of the CSharp var (theahmadblog.blogspot.com)

submitted by ahmadadnanahmadadnan(30) 8 months, 1 day ago

CSharp 3.0 introduced the var keyword for declaring variables without having to explicitly specify the type. This was done for using anonymous types returned from LINQ queries. Now, I am seeing many developers use it all over their code and think its a good thing. read more...

add a comment | category: | Views: 73

tags: another

CodeRun - Online Development Platform (maximumcs.wordpress.com)

submitted by codegurucodeguru(75) 8 months, 2 days ago

CodeRun is a browser-based Integrated Development Environment (IDE), built on top of the Amazon Elastic Compute Cloud (EC2). It allows programmers to easily develop, test, deploy and publish code online, without requiring powerful hardware or complex software. read more...

add a comment | category: | Views: 3

tags: another

Core: An Aspect Oriented Business Objects Framework (www.dotnet-tv.com)

submitted by martinigmartinig(470) 8 months, 7 days ago

Learn about aspect-oriented design patterns and how they can be used to quickly add common functionality to your business objects. Josh Heyse explains how Aspect-Oriented Programming allows for the separation of true business logic and the code written allowing interaction with user interfaces. The Core framework is a generation model that dynamically adds common services, such as logging, auditing, persistence, and security to business objects. read more...

add a comment | category: | Views: 16

tags: another

Calculating prime numbers with LINQ in C# (www.leniel.net)

submitted by lenielleniel(415) 8 months, 9 days ago

It is a beautiful proof of the power and expressiveness of LINQ. The query expression states that from each value i in the Enumerable.Range(2, max - 1) where all elements of the range Enumerable.Range(2, i – 2) satisfy the condition All(j => i % j != 0), we select i. read more...

add a comment | category: | Views: 39

tags: another

Logging NHibernate SQL with log4net in ASP.NET (www.leniel.net)

submitted by lenielleniel(415) 8 months, 17 days ago

Have you ever wondered how to log the SQL generated by NHibernate? This post tries to exemplify just that. NHibernate uses HQL to leverage its expressiveness to the developer, but behind the scenes there is an engine that transforms the HQL into pure SQL that is executed against the database. This SQL can be logged so that you can see its... read more...

add a comment | category: | Views: 81

tags: another