Posts tagged C#
Alensa Online
Feb 11th

Position: Team Leader and Lead Developer in Alensa Online – Software Development department
I was part of Alensa team between January 2007 and August 2008. Only the opportunity to study Media Informatics Master, held by RWTH Aachen University, could gave me enough reasons to leave Alensa Online that I enjoyed so much for almost two years.
I was in charge with our brand new solution for an online Healthcare project – Alensa Online. The Alensa Online Shopping site (www.alensa.ro) consists of an internet healthcare platform in Europe that would simplify research and self education related to health issues, and provides the customers with an interface allowing them to easily get their health questions answered by professionals. It was first developed by a third party company, then I took over the responsibility of developing and maintaining the solution.
My responsibilities were quite complex because I was the first hired person, very similar with Softwise company. This reminded me about the joy and responsibility that comes with this. Another nice surprise was to find in person of Mr. Alex Savic, the CEO of the company, a friend with whom I shared both technical discussions and personal development ones, he was one the most supportive about my decision to study in RWTH Aachen.
Shortly, at Alensa Online I were in charge with:
- Architecting and developing the web based solution using Microsoft ASP.NET / C# and SQL 2005 Server technologies;
- Performing server administration, configuration and maintenance for the Windows 2003 server, for IIS 6 and for SQL 2005 database server;
- Executing architectural modifications in order to make the website user friendly;
- Identifying, designing and developing solutions;
- Periodically testing the site functionalities and thus creating a real test environment, test cases and bug fixes;
- Performing code review, corrections and code optimization;
- Analyzing hardware/software requirements and proposing hardware/software improvements and suggestions (for example, choosing an appropriate hosting partner);
- Implementing real time traffic analysis tool to help the management department;
- Conducting internal training for his colleagues. Read the rest of this entry »
Adding events to LINQtoCSV library
Feb 6th
The User Experience that a library provides must be at least equal with is quality and speed. And frankly, CSVtoLINQ rocks on latest two, as I presented in previous articles Import CSV file and query it with LINQ and continuing in LINQ wonder world, but lacks a little on the User Experience(in our case Developer Experience) by not having some events of starting, progress and ending of the parsing.
Especially important, while parsing huge files, is a confirmation for the user that something happens and (ideally) the point in which the processing is. That is why, thanks to Matt Perdeck for sharing the entire source of the library, I was able to improve it by adding events.
So, let’s see some code!
Modifications into LINQtoCSV library – CSVContext.cs
Important: All modifications will be made in the CsvContext class from LINQtoCSV namespace – the CSVContext.cs file.
First we’ll add the ReadStarted event to the library – it will fire when the reading of the CSV file has started.
// defining the delegate
public delegate void ReadStartedHandler(object sender, EventArgs e);
// here we define the event
public event ReadStartedHandler ReadStarted;
// the call of the event processing
protected virtual void OnReadStarted() {
if (ReadStarted != null) {
// we use empty eventargs because nothing is needed on readstarted event, just the confirmation of parsing started
ReadStarted(this, EventArgs.Empty);
}
}
LINQ wonder world
Feb 5th
I am sure that, if you are a developer, at some point in your career heard about and asked yourself: what is LINQ? If not, there’s no problem, you’ll find out now : LINQ comes from language-integrated query and it is a collection of extensions to the .NET Framework that encompass language-integrated query, set, and transform operations. It helps developers by extending both C# and Visual Basic, adding native querying capabilities to these languages. It also comes with class libraries to get the full advantage out of these capabilities.
As we discussed in my previous article, Import CSV file and query it with LINQ, we are able to load and parse the file into a IQuerable collection, thus giving us the oportunity to do more and more SQL- like operations on it.
The C# 3.0 specification defines a so-called Query Expression Pattern along with translation rules from a LINQ expression to an expression in a subset of C# 3.0 without LINQ expressions. The translation thus defined is actually un-typed, which, in addition to lambda expressions being interpretable as either delegates or expression trees, allows for a great degree of flexibility for libraries wishing to expose parts of their interface as LINQ expression clauses. For example, LINQ to objects works on IEnumerable<T>s and with delegates, whereas LINQ to SQL makes use of the expression trees.
How to make a Print Screen on Microsoft Source using WPF
Nov 1st
After we took a look inside of Microsoft Surface, let’s see how to take a later look on the surface, by creating printscreens of the application.
In some WPF applications you’ll need to take a quick screenshot of the user’s screen, allowing him (or them, in case of Multi User Surface) for later reviewing. Now, on Surface there can be only one full screen and active application. So it use the entire screen of the device.
Here are the steps in order to accomplish that:
First, we need to add to Visual Studio project the references to the libraries that we’ll use:
using System.Drawing; using System.Drawing.Imaging; using System.Windows.Forms;
Then, we will add create the method that will do the actual saving to a specific file, with the format PNG:
public void MakeScreenshot(String fileName)
{
Bitmap bmpScreenshot;
Graphics gfxScreenshot;
//first, we create&set a bitmap object to the size of the screen
bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
//Using the bitmap, we create a graphics object
gfxScreenshot = Graphics.FromImage(bmpScreenshot);
//Copy the rectangle (the screen in our case) - from the upper left corner to the right bottom corner
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
// Do the saving, outputing a file by supplying the name and format it as PNG
bmpScreenshot.Save(fileName, ImageFormat.Png);
}
That’s all, folks – Use and enjoy!
MIX09 Scott Hanselman’s FILE|New Project …
Mar 22nd
Scott Hanselman had a presentation at Mix 09 conference – File | New Company: Creating NerdDinner.com with Microsoft ASP.NET MVC. This was in its unique style – fun, rich in content, tricks, advices but most of all was fun.
This year he managed to create a new type of presentation – without the actual presentation! No more constrained to some slides, just him, Visual Studio and the audience. Yes, the audience – who seemed to absorb any words spoken there, helping Scott with few advices in some key points.
Create GUID in Visual Studio 2005
Dec 21st
From time to time you need to create a GUID (Global Unique IDentifier) in order to mark your dlls. Looking in my Visual Studio 2005 I saw that this command wasn’t available in any tools menu, nor in the Customize toolbars one as a shortcut to a command.
After a quick digging on MSDN site I found this. It is written in Microsoft style – a lot of information, but no solution. It just mentioned something like ”hey, we have something that you want, but guess what – we don’t have it any more”:
-
On the Tools menu, click Create GUID. The Create GUID tool appears with a GUID in the Result box.
So I started creating my own Create GUID command.
Happily, the Microsoft team provided the tool in the <visual studio install>\Common7\Tools\ directory. Usually, the <visual studio install> dir is C:\Program Files\Microsoft Visual Studio 8.
Actually, there are 2 tools for creation of GUIDs:
- GUI interface: <visual studio install>\Common7\Tools\guidgen.exe
- Console line tool: <visual studio install>\Common7\Tools\uuidgen.exe
At first look, uuidgen seemed the winner. Running uuidgen in command line revealed the needed parameters:
I proceeded to setup the Create GUID command. From Visual Studio 2005 menu > Tools > External tools you can add and setup a new command to an external tool. The setup window is straight forward for experts, but new guys can be impressed by it.
Clicking on Add button will create a new element in the list, called [New tool 1]. This name will be overridden by whatever you write in the Title text box. Next, the command text box will be filled with exact path to the tool. Clicking the ellipsis button, you’ll be sent straight to Tools dir, where you can easily find the tool required. As arguments I put the ‘c’ value which means that the output will be upper case UUID (as you can see in the previous image).
And when clicking OK, the corresponding name, as in my case Create GUID appears in the Tools menu, just above the External Tools menu.
But surprise, when I clicked the menu button, the command prompt flashed and nothing happened.
After a brief investigation, I figured out that the tool worked, but it’s output was retained in the command prompt window. This closes immediately after the tool runes successfully, outputting the GUID.
What to do ? I switched to the next tool, Guidgen. This was simply accomplished by changing the command to the corresponding tool name and removing the argument.
So after clicking on Visual Studio 2005 menu > Tools > Create GUID I got this window, in which I checked, as you can see, Registry format and then click on Copy button. Then clicking on Exit you dismiss the tool. By pasting the Clipboard content into a class, you will get this :
{949213E9-0658-4546-B3D1-F41C0475E805}
Good luck with the implementation!
PDC 2008 – Developing Applications Using Data Services
Dec 1st
This presentation, is done by Mike Flasko, Program Manager at Microsoft Corporation. Smart, well prepared and having good oratorical skills, he is one of the best presenters that I have listen to. He has several other blogs, interesting to see is also this one. He leads the Astoria team which has an interesting blog here.
For all of us who didn’t had the pleasure to go to the actual event, the link is on Channel 9 PDC area. Maybe next year we’ll shake hands with Mr. Mike Flasko.
Here are some of the things presented (this listing is just a teaser, you should discover the rest) :
- New models for communication
PDC 2008 – Apps for babies in .Net 4.0
Nov 15th
My personal Software engineer model, Mr. Scott Hanselman, had a very nice presentation at PDC 2008.
He explained the usage of Microsoft’s .Net 4.0 framework in real life examples, creating an interesting environment for very young people (less than 4 years) using Silverlight, PDAs, the new Surface device, webservices, real time interrogation to data bases by auto updating reports and others.
http://channel9.msdn.com/pdc2008/TL49/
Join Scott Hanselman for this lots-of-code-minimal slides talk that walks through the sheer joy of building out a .NET Framework application with Visual Studio using many of the new advances in the .NET Framework 3.5SP1 and 4.0. We have a data layer with Entity Framework, use REST web services with WCF and ADO.NET Data Services, write an ASP.NET site for reporting using Dynamic Data and MVC. All the data will come from a WPF client application and a Silverlight application that the audience will run live! All this, plus it’s an application that babies and toddlers will love!
Enjoy!
ASP .Net Page.Header with custom meta tags
Jul 5th
One of this days a friend of mine shared with me some SEO techniques and one of them was to change the meta tags associated with a product page. So after a little research I found out a way to accomplish this : modify the Header property of ASP .Net page and add several HtmlMeta tags who can hold the data needed to be changed.
Each ASP .Net page has a property called Header who is the “hidden” header code of each HTML page. It is available starting with .Net version 2.0 and exposes also the meta tags object collection. Actually, all elements in the header are available in Header.Controls
// Render: HtmlMeta meta1 = new HtmlMeta(); meta1.Name = "keywords"; meta1.Content = "pharmacy, online pharmacy, home delivery"; // Render: HtmlMeta meta2 = new HtmlMeta();meta.Name = "verify-v1";meta.Content = "DmMArCJQq9KV45wvKMwrWASh3R8UWTd7NfBD"; // Render: HtmlMeta meta3 = new HtmlMeta();meta.Name = "revisit-after";meta.Content = "2 days"; Header.Controls.Add(meta1);Header.Controls.Add(meta2);Header.Controls.Add(meta3);
Euro
Lira sterlina
Dolar SUA
Francul elvetian
Gramul de aur



