Posts

My Introduction to TeamCity

    The purpose of this article is simply to record and document my experiences using Teamcity. I know later down the road I will have a lot more questions about TeamCity but for now just I wanted to write down what I already know and to describe some of the ways that I use it.     I first was introduced to TeamCity in June 2013, where it was setup to automate builds and stared builds based the changes in SVN. Using this setup on daily basis, I could see my commits and others as well. Depending on if it was developing or production code teamcity would build code accordingly and put those changes in a Pending state (or Build Queues). Much like TFS, TeamCity allows me to see the history of changes and who has committed what. One thing I liked the most was that TeamCity would not publish builds that failed. Which was a critical step when developing, especially when pushing to prod  since it gave me a quick double check before going live with my code. Future Questions      Down the r

My Introduciton to Nodejs

Image
Introduction  Much of the material here is based on the chapter 8 in the book:  Programming in HTML5 with Javascript and CSS3  and the  Nodes.js site . Getting started with Nodes.js "Nodes.js is built on the Google Chrome Javascript runtime" "The Platform implements an event-driven, non-blocking I/O model and is lightweight and efficient." "data-intensive,real-time applications that run across distributed devices." "executes your Javascript by using Google's V8 virtual machine" Download  Nodes.js and install, need to accept the licensing agreements.  HelloWorld.js var http= require('http') //" http module is a core built-in, low-level module highly optimized." http.createServer(function (request, response) { response.writeHead(200, {'Content-Type':'text/plain'}); response.end('Hello World from Nodes.js!\n'); console.log('Handled request'); }).listen(8080, '

MVC Excel Email Attachment with NPOI

    The First Question I had after successfully creating a Excel sheet was  how do I create an attachment from a stream?  A second to be more specific was  how do I add an attachment to an email using System.Net.Mail?  Ultimately I wanted to have the  Excel Exports in C# using NPOI  but I started small and thankfully others had already asked and answered these questions. After which was just a matter of knowing  What the correct content-type for excel files was? First Attempt MailMessage mail = new MailMessage(); HSSFWorkbook workbook = CreateExcel(OrderId); MemoryStream ms = new MemoryStream(workbook.GetBytes()); mail.Attachments.Add(new Attachment(ms, "example.xls", "application/vnd.ms-excel")); _emailService.SendEmail("example@example.com", "Email test", "Testing 123"); Changed it to.. MemoryStream ms = new MemoryStream(); workbook.Write(ms); This was based on the QA " NPOI -

MVC Data Exported to Excel with NPOI

This is an article for just writing an Excel file using  NPOI  and I want the quickest and easiest way to export a excel file from Asp.net MVC. To keep everything in work fluid motion I will keep the user on the same page and do a forced download within that page. This is a setup that I have seen in multiple times and I think works great in today's modern website designs. Creates excel files Leniel Macaferi's blog: Creating Excel spreadsheets .XLS and .XLSX in C# Create Excel Spreadsheets Using NPOI var workbook = new HSSFWorkbook(); var ExampleSheet = workbook.CreateSheet("Example Sheet"); var rowIndex = 0; var row = ExampleSheet.CreateRow(rowIndex); row.CreateCell(0).SetCellValue("Example in first cell(0,0)"); rowIndex++; Problems I faced XLS is not the same as CVS which is obvious but truthfully I did not know the difference between the two file types (other than their different extensions). So I asked myself what is the  Difference between CS

C# vs. Javascript Foreach

     This article is about a certain style of writing in Javascript that I like use when iterating through an array combined with a foreach which looks something like the following... var someArray = ["1", "2", "3"]; $.foreach(someArray, function(key, value){ console.log(key + " , " + value); });      Ultimately when I tried to take this same concept over to C# the style did not convert over in the exact same way. I found that the temp variable being used to iterate with did not have any values that tracked where it was in place of the iteration. I found myself asking a similar question in  how do you get the index of the current iteration of a foreach loop?  To see what I tried you can look at another person's  problem  where I had attempted in the same manner. Attempting to use the "current" value in the  GetEnumerator()  sadly does not work. Solution      To summarize the answer for this problem the "foreach&

A Static DropDownList for ASP.Net MVC

Image
     When creating a static dropdowns list in Asp.net MVC, I have a two approaches that I like to commonly use. I know there are many ways to achieve this UI structure and I don't consider either one of the following approaches to be the final solution. However for awhile now  I have been using these two approaches  and I think they are  much  simpler  and easier to maintain  compared to other ways that I have seen . Rather than writing out the HTML select tag and all the options I take advantage of the Html Helper Dropdownlist. I avoid model bind since it is static and I don't want create the list outside of the view. I think this would only create more work to maintain and confusion for other coders if they new to my applications.  I did not come up with either solution  completely on my own and I actually forget where I saw them since it did take a while to find these approach in my research.   What's  important to take away in this article is that if you look carefull

Asp.net MVC4 - Bundling and Minification

    While this article may be very simple and  straightforward,  there are a few concepts here I think are important to note . In my next article will be looking more in depth on the idea of creating a customized Web.config, but for now with this article, I just want to look at activating the bundling and minification feature by using the xml tags inside a MVC's Web.config. This feature is only available i n ASP.NET 4.5  and above. The First Problem With the following inside your Web.config... (transform is with a Captial T.) And with either of the following inside your build config or customized Web.config (I.E. Web.Release.config) This also can be achieved by doing the following...      In both snippets of code you do not need to use the "xdt:Locator" attribute (used only in cases where there are multiples elements of the same name .   What you may not see is that in the Web.config we have the "location" tag

Popular posts from this blog

UI-Bootstrap Collapsible Sticky Footer

Installing Windows on Acer chromebook 15 cb3-532

Aspetcore: NLog with Postgresql