Learning programming

Note: An old unpublished post; publishing now…
—————————————————-

Every day a new technology or a programming language emerges in software industry. Keeping an eye on them, learning them and being an early adopter is an immense task; especially if you are in the software development community. Google does help me in finding the relevant links, however either they are specific to the subtopic or they cover the topic partially. (just a thought – Ganapati Bappa Morya is a popular slogan these days on account of Ganesh Chaturthi. For a software professional Google is the new God – Google Bappa Morya!)

http://www.w3schools.com is the best when it comes to knowing about the new technology in a nutshell. I would strongly recommend it to students and the beginners.

One thing I particularly like about w3schools is they have a Tryit Editor where you can edit and view the results instantly on the same page. For example, in this link http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_video_bear you can edit the source code and view the results instantly.

Being a Microsoft .NET developer primarily working on C#/VB.NET, you can tinker around these languages online at https://dotnetfiddle.net.

Advertisements

Online .NET Trainer/tutor

If you are looking for an online training/tutoring class in Microsoft .NET technologies, then you have come to the right place. I have 11 years of professional experience working on Microsoft .NET technologies in banking, education and software MNCs. I have also given training to students and employees, both in class and online.

Subject/topics could be C#, VB.NET, .NET framework, Visual Studio, SQL Server, ASP.NET, Win Forms, Design patterns, ADO.NET, web services, Windows Communication Foundation (WCF), LINQ, Entity Framework etc…

If you are looking for the online trainer/tutor, contact me on LinkedIn or Facebook.

Image reference: https://www.parenting.com

Links to .NET books

This is a recommended list of books for those programmers working on technologies related to Microsoft .NET platform.

I will be adding the .NET books as well as those related interview questions as a handy reference for me and friends. The list will be updated on a regular basis. Feel free to comment if you know of a good book that is not present in the list.

C# complete Reference 3.0
http://zeus.nyf.hu/~bajalinov/my_special/SW/C%23%203.0%20-%20The%20Complete%20Reference%20-%20Herbert%20Schildt.pdf

C# complete Reference 4.0 (new version)
http://memberfiles.freewebs.com/02/83/78118302/documents/McGraw.Hill.CSharp.4.0.The.Complete.Reference.Apr.2010.pdf

C# Pocket reference – a short and handy reference guide
http://takadesigner.com/Files/b.pdf

ASP.NET MVC Interview questions
http://www.interviewquestionspdf.com/2014/06/aspnet-mvc-interview-question-pdf-book.html

ASP.NET MVC Interview Questions and Answers
http://www.dotnet-tricks.com/Home/MVCInterviewBook

Douglas Crockford’s book “JavaScript: The Good Parts” is a must read for a developer working on front-end.
http://www.maritimejournal.com/__data/assets/pdf_file/0020/1033940/Javascript-The-Good-Parts.pdf

JavaScript in 10 mins
https://github.com/spencertipping/js-in-ten-minutes/blob/master/js-in-ten-minutes.pdf

More free programming books at https://www.ebooks-it.net

Concatenate multiple rows for a column using LINQ

Note: I wrote this post after I encountered a programming problem.

Lets say I have 4 columns in DB2 table called “Table1”-

Id (int)

Code (varchar)

SequenceNumber (int)

Message (varchar)

Id, Code and SequenceNumber act as a unique key for this table.

Data is stored in this table using following condition:

For each Id and Code, if message size exceeds column MAX size,

then the message is split and stored in multiple rows using SequenceNumber in incremental form.

 

Consider this table has following data:

Id Code SequenceNumber Message
1 ABC 1 test1
1 ABC 2 test2
2 XYZ 1 message1
2 XYZ 2 message2
3 PQR 1 hello

The requirement is to concatenate messages for all sequence numbers in Message column, for each row which has unique combination of {Id and Code}.

So my required table should have following columns-

Id

Code

Message (concatenated messages)

Id Code Message
1 ABC test1 test2
2 XYZ message1 message2
3 PQR hello

Please note that SQL CONCAT function concatenates two strings or two column values. Here we want to concatenate column values across rows.

I am not sure if this requirement can be programmed using SQL query. We had this exact requirement in our project and I used LINQ to implement it.

Here are the steps I used in VB.NET (it being the programming language used in our project)-

1) Connect to DB2

2) Fetch all data from Table1 and store it in DataTable called “dt”. This DataTable has 4 columns – Id, Code, SequenceNumber and Message.

3) Write LINQ query to concatenate data as per the requirement. Here is the VB.NET code

Dim query = From r In dt _

Order By r.Field(Of Short)(“SequenceNumber”) Ascending _

Group r By ID = r.Field(Of String)(“Id”), _

Code = r.Field(Of String)(“Code”) _

Into g = Group _

Select New With { _

Key ID, Code, _

.MESSAGE = String.Join(“”, g.Select(Function(a) a.Field(Of String)(“Message”)).ToArray())}

Note that grouping is done on columns “Id” and “Code” and rows are ordered in ascending order for column “SequenceNumber”.

I used String.Join to concatenate the values in Message column.

4) “query” object is an IEnumerable collection. I can iterate over it using “for each” loop and extract the data or perform further processing.

I would be delighted to see a better/improved approach to implement this requirement.

Utility to list Programs in Add/Remove Programs

I wanted a simple utility to create a list of all programs listed in Add/Remove Programs on my laptop. I searched on net for the utility and got a vbscript code for the same. However I tweaked it to my personal taste. Here is the code:

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Product",,48)

For Each objItem in colItems
WScript.Echo objItem.Name
Next

Write this code in a text editor and save the file with the extension .vbs. Open command prompt, navigate to the directory where you saved the .vbs file. Type following command :

cscript temp.vbs  > temp2.txt

Open temp2.txt and you will see the list of programs as follows:

Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

Feedback Tool
Windows Media Player Firefox Plugin
Microsoft Visual Studio 2010 Service Pack 1
Adobe Common File Installer
…..

By default, cscript command displays a logo when the script runs under CScript. The logo, which appears prior to any of the output from the script, looks like this:Microsoft (R) Windows Script Host Version 5.6Copyright (C) Microsoft Corporation 1996-2000. All rights reserved.

You can get rid of the logo using //nologo option as follows:

cscript //nologo temp.vbs  > temp2.txt

Limitation:

This utility lists the programs that were installed using Windows Installer. That was my requirement. You can tweak it to lists programs installed using other installers too.

More about the Win32_Product WMI class is given on MSDN.

.NET tools/projects on codeplex

Here are some of the open source projects/tools developed in .NET which are available on codeplex:

1)      Silverlight Audio Player

http://slaudioplayer.codeplex.com

2)      Managed Extensibility Framework – New in .NET framework 4.0, this framework can be used for creating extensible applications and components.

http://mef.codeplex.com

3)      MEF Visualizer Tool – Helps to see what is going on inside the MEF Composition Container. A visualization tool for MEF.

http://mefvisualizer.codeplex.com

4)      .NET Gadgeteer – a rapid prototyping system for pluggable modules in place of plugging in electronic devices. The end user site is at http://netmf.com/gadgeteer. To learn more, check out a Channel 9 Video on it.

http://gadgeteer.codeplex.com

Check out more on CodePlex.

Yahoo! Big Thinkers India Series in Pune

Yahoo! Research conducts a series of lectures quarterly under the Yahoo! Big Thinkers India Series. The lectures are conducted in Bangalore, however for the first time Yahoo hosted the April 2011 lecture outside Bangalore, in LeMeridian hotel in Pune. The lecture titled ‘web retrieval: The surprising role of users’ was conducted by Yeolle Maarek -a senior Director of Yahoo! Research.

Yeolle explained the role of users in a pretty nice way-it reminded me of film 21 in which Professor Micky Rosa (Kevin Spacey) puts up a stupendous job in his opening scene of the class.

Although the session was scheduled on a weekday (yersterday), we went to attend the session. The session proved to be a catalyst to think about something that we as web users should care about and was a good lecture in terms of content as well as presentation rather than those boring  meetings. Apart from this, the attendees got a nice and heavy snacks-the snacks in LeMeridian was really tasty, a key chain and a Yahoo! diary:) I know some people came solely for these things 😉

I hope the video of the session will be available on Bigthinkers site soon. The recorded sessions of previous lectures are available in the archives.