Skip to main content

Posts

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) { _...

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); /...

System requirement checklist

This checklist doest explain how to make good requirements but gives you a heads up to what to look for from a requirement document before implementing a system.  Some of the items might not apply on small projects, but on large projects its a must to go through all of them and see where you stand.  Specific Functional Requirements Are all the inputs to the system specified, including their source, accuracy, range of values, and frequency?  Are all the outputs from the system specified, including their destination, accuracy, range of values, frequency, and format?  Are all output formats specified for web pages, reports, and so on?  Are all the external hardware and software interfaces specified?  Are all the external communication interfaces specified, including handshaking, error-checking, and communication protocols?  Are all the tasks the user wants to perform specified?  Is the data used in each task and the data resulting ...

Why I think we should invest in agriculture as a nation first.

Agriculture has always been dear to me. From a tender age when I planted Tomatoes in a seedbed in our back yard, watching them sprout from the nursery that I had careful prepared. Life of a plant is an interesting thing. From a small tiny seed comes this beautiful plant. Transplanting them later, and watching them grow to maturity. I had forgotten how good that feeling was, I had always had it in me, and I enjoyed bringing new life to this world, plants. We as a nation need to secure food first in order to be able to move forward as a country, until a man’s basic need is fully satisfied, he is bound to poverty, having to work for food. Hence the call to invest in Agriculture, until a man doesn’t have to worry about feeding his family a man’s true potential cannot be seen. We need to break free of this chains poverty, the chains of thinking we can’t produce enough, the chains of seeking aid from the west. Yes our country can produce more than enough, with the right technology, ...

Emancipate yourself from mental slavery, none but ourselves can free our mind

The story begins with two young minds chatting in a Matatu (public means of transport in Kenya). The discussion was based on the fact that power in one thing that is letting this country down. Black outs, high cost of production due to the use of generators etc. Why not come up with a solution, Kenya has a lot of land laying bare, this land is either arid or semi-arid. There lies a great opportunity to produce solar power. Laying along the equator we receive direct sunlight all year round, why not build solar panels and place them in the desert? One mind thought, as a country we have the potential to create this panel, best situated and optimized for our environment. But the other mind believed that, we can’t make that. The best solar panels have to be imported. This not only pissed me off, but also showed how we have been made to believe that we are a consumer continent. When is this going to stop! When are we are as a continent going to stand up and realize that we need ...

entrepreneurship 101

Today we had a talk from Adam Nelson on entrepreneurship. I noted the following: 1. Challenge yourself, don't always give up easy. Make sure you fight till the end 2. Don't get used to changing horses mid-stream, unless the change is causing significant impact, always stay focussed. 3. Make sure your solution is sustaining, (roman profitable) it can get to support yourself and the business even if its minimal 4. always have a plan A, B and Z. plan Z should be the last option when all goes wrong and shouldn't be a stressful option, this can be family, friends, relatives 5. negotiate before it matters, negotiating early is a good thing, than waiting for later when the stakes might be high and you can' negotiate 6. Principle agent people, organization vs people. know when to pitch to a person in charge of a department than when to pitch from a whole organization 7. skill acquire extra skill along the line and don't just stay where you are, even if you ...

Designing tips for windows phone:

Designing tips for windows phone: Panorama control:            Acts like a magazine cover.            Offers a highlight of what is going on            The tile normally has a parallax effect causing the title to run at a different speed than the page            One can have multiple panorama, it does not have to the first one. It can be put anywhere in the application.  Good practice with panorama:            Pick at least three themes to showcase, don’t show entire app in panorama              Surface the highlights of the content to encourage exploration into the application            Make them immersive and showcase your brand as much as possible            Limit the number of panes to five to increase effecti...