Skip to main content

Posts

Showing posts from March, 2015

Creating PDF in MVC 5 using ITextSharp

Creating PDF in MVC 5 using ITextSharp For a long time I have been looking for free and cheaper ways of creating pdf documents within MVC. I have tried all the other options and none was able to give me the standard of document I wanted. After long and tiresome nights of trying to figure out the solution I stumbled upon ItextSharp... This was my life changer. Maybe it might be for you too..  Process Download ItextSharp using the Nuget Package manager and if you prefer using command line arguments you an use: Install-Package iTextSharp full documentation to this can be retrieved here Create a class that will be used to write the data you created as a byte array. How this works can be found here  or here   public class BinaryResult : ActionResult { private byte[] _fileBinary; private string _contentType; private string _fileName; public BinaryResult(byte[] fileBinary, string contentType, string fileName) { _fileBinary = f

HACKER Edition pset1

How I come to tackle the hacker Edition of pset one... My comments might not be that straight forward but feel free to comment. I opted not to use the string class for the return type for the longToString() because I was getting issues when trying to do the conversion in the calculation for the digits. ################################################################################# #include <stdio.h> #include<cs50.h> #include <string.h> //method to get number of digis input but the user int lengthString(long long int cc); //Function to check the if the length is a valid length to proceed bool isValidLength(int numOfDigits); //Fuction that will use Luhns algorithim to check validity bool isValid(int numOfDigits, long long int cc); //Function that returns the card type int cardType(int numOfDigits, long long int cc); //function that converts the card to char array char* longToString(int numOfDigits, long long int cc); /