Category Archives: Programming

Setting up CUDA in Windows 10 (8, and 7 )

  This weekend I decided to set up my own desktop to run CUDA programs for my GPU programming class. It probably wasn’t the best idea, since I had to force reboot my computer a few times for crashing my GeForce device driver. Oh well. The approach I followed was from the Nvidia Getting Started Guide for Microsoft Windows. It’s pretty concise, so it’s definitely a good read if time allows. How to Setup CUDA in Windows 10: For this approach, you will need: A CUDA-enabled GPU Nvidia CUDA toolkit Visual Studio 2013 At the time of this writing (Nov 2015), Visual Studio 2014 and 2015 are not yet supported for CUDA programming. I believe …

Continue reading

Posted in C++, Programming.

Replacing Spaces with “%20” in a String (C++, Ex: 1.4)

string space to %20 cracking

There are multiple ways to replace spaces in a string with “%20”, but one way I did it without starting from the back is through string concatenations and substrings (substr). In C++: Output: Substr takes in two inputs and returns a string that starts from position index and spans for length characters. In our above example, str.substr(0, i) when i = 5 ([5] == ‘ ‘) will return “hello” (starting from position 0 and spanning 5 chars). My reasoning in this example was that I would take substrings of everything before and after the space, and then concatenate them together with a “%20” in between. Corner cases weren’t checked, but it works well in normal cases. …

Continue reading

Posted in C++, Code.

How To Install the GMP Library on Ubuntu

how to install gmp ubuntu

In my Data Structures and Algorithms II class (more like Algorithms and Algorithms class), our professor assigned us to write a RSA encryption program to complement our coursework on modular arithmetic and primality testing. Because we needed large numbers (1024 bits) which would absolutely not fit inside normal primitive data types, we were suggested to use the GMP library for C++, or BigInteger for Java. Being a C++ guy, I choose GMP. Now, what I found out while writing this lab was that installing GMP was actually harder than writing the program! To cut to the chase, here is how to download and install GMP onto your Ubuntu system. This …

Continue reading

Posted in C++, Programming.

Setting Eclipse to Compile with C++11

C++11 Linux Terminal Compile

A few days ago I was writing a program that required the use of new syntax from a newer standard of C++. I looked around trying to figure out where to tick a setting or add a line somewhere on Eclipse, but just couldn’t find where to do so! Now, I knew how to compile under the new standards on the Linux command line, but with the way my project was designed, being able to compile under Eclipse would be wayy more convenient. In this page, I will be going over how to compile C++11 under both the terminal and Eclipse. Compiling under Ubuntu Terminal Starting from the command line …

Continue reading

Posted in C++, Programming. Tagged with , , , .