Posts

Showing posts with the label Programming

Creating Markdown Blog with ASP.NET and C# - Part 1

Image
Introduction - In my previous post, I've discussed why Markdown is used widely by developers. If you haven't read it, you can find it here . In this post, I will show you how you can create a really simple blog with Markdown using ASP.NET and C#. Technology Used Visual Studio 2015 (see here ) ASP.NET MVC C# Some Markdown files/contents - Knowing Markdown syntax is a plus. Resharper Ultimate (Optional, see here ) - It is offered free for Student, but you'd have to renew every year. This is only used to ensure that your code is pretty. Let's get started Open up Visual Studio 2015 Community Edition. In the Start Page that shows up, select New Project... If Visual C# is not the selected item on the left pane, open up Installed -> Templates -> Other Languages -> Visual C# . Under Visual C# , you can select different kinds of projects that you want to develop, i.e. WPF Application , Console Application , Blank App (Universal Windows) , Class ...

Macro Class. What!?

Yeah, you heard it right, Macro Class! What in the world . When I was working as an intern, I found out that Macro Class is a painless way to "generate" a class for you without any code. As you probably know, macro is a way that you can use to tell the compiler to replace some strings for you. When you do this: #define VALUE 5 The compiler will go over your code and replace all the occurrences of VALUE (except when VALUE is inside a string) with the number 5 . Now you can do that to a class. Think about times when you want to write a class without having to write a class. This guy isn't serious... Here's how: #define ClassGenerator(_class_name_)\ class _class_name_ {\ public: \ _class_name_() {}\ ~_class_name_() { }\ std::string getResult();\ }; He IS serious.. Now what can I do with this? A lot of thing!!! You can then use your newly created macro to create your class with a getResult() function. Wait, I need a declaration for...

Verbose Mode C++

Here is a quick tip for debugging a section of a C++ application. Often times, when you are in need of a quick way to debug a part of your code and do not want to go through the whole program and digest each line of code, you can use #directive. Below is an example of using this "verbose" directive: #ifdef DEBUGMEM #define _CRTDBG_MAP_ALLOC #include <stdlib.h> #include <crtdbg.h> #endif #include <iostream> using namespace std; void test () { // Do something } void main () { test(); # ifdef DEBUGMEM _CrtDumpMemoryLeaks(); # endif } When you put  #define DEBUGMEM at the beginning of your code, the code inside the #ifdef and #endif will automatically be executed. This enables you to easily disable or enable each part of your code if needed.  In this particular code, the _CrtDumpMemoryLeaks();  and its corresponding headers will only be included...

C++ Beginner Tutorial - Hello World

Image
Greeting and welcome to my tutorial on C++. If you want to learn how to program using C++, you come to the right place. These tutorials will focus mainly on the console program, meaning the program will use a text-based interface to communicate with the users and show the results. Alright, let's talk a little bit about C++. Introduction: C++ is a computer programming language. It is widely known and used by most programmers because of its data abstraction, encapsulation, messaging, modularity, polymorphism, and inheritance. The number one reason that programmers love it is the portability and efficiency of the language. The language provides programmers many choices, even though it’s possible for them to make a wrong choice. C++ continues to be the most preferred language when it comes to designing professional applications. History: C++ is developed by Bjarne Stroustrup. At first, the original name of it was “C with classes.” In 1983, the name was changed to C++ (++ is ...