Compile and Run Single .CS Files

If you’re anything like me, while searching around the Internet for help and tutorials on coding you’ve probably come across some interesting code you’d like to run but didn’t want to make a full VS project to run the code.

Well doing some research into C# arrays, I came into the same problem on the page below.

http://msdn.microsoft.com/en-us/library/aa288453(v=vs.71).aspx

1) Copy and paste your code into your favorite text editor.

Screenshot (38)

2) Save the file to an easy to access folder in your file system.

3) Next open up either Visual Studio Command Prompt or if you have VS 2012 installed Developer Command Prompt for VS2012.

4) Navigate to the folder where you saved the .cs file.

5) Run the command below, replacing [insertfilenamehere] with the filename of your .cs file.

csc [insertfilenamehere].cs

6) After running the command, the folder should contain a new exe of your file. You can run it by running the command below.

start [insertfilenamehere].exe

7) Enjoy your results…

0  

SmartFile Bake Off

If you have been following my twitter lately you’ve probably seen a tweet or two about this company called “SmartFile”. They are a file sharing company located in Indianapolis, IN and are targeting file sharing for businesses. They allow for not only the upload and download of files, but the creation of new users, along with the management of specific permissions for each of them.

Over the past couple months they have been sponsoring a software programming competition in which myself and a friend were involved in. The “Bake Off” as it was called consisted of 52 teams from colleges all over the Indiana State. Myself in one called the “Paradox Duo”. We placed 4th beaten behind some juniors and seniors, however as freshman we believe we did very well and can’t wait to try again next year.

My team mate Travis Cunningham and I built an open source application that would allow any client or employee to view their SmartFile file’s with-in a small desktop application. Below is a picture if your interested in the UI. I encourage you to check out our work at kissync.com which is our domain and be sure to check out our code. We wrote over 20,000 lines in two weeks alone. Currently it is only packaged for Ubuntu but coming soon should be the Mac and then the Windows versions.

P.S. The application also syncs your files locally… ;)

Enjoy!

Screenshot:

 

screenshot

1  

Euclid Algorithm in C#

Over the past couple week I have been toying around with a cool algorithm called Euclid. The goal of the algorithm is to find the Greatest Common Devisor of two numbers.

To start out we will find the GCD(Greatest Common Devisor) of the numbers 252 and 105.

252 = 2*2*3*3*7 = (2^2)*(3^2)*7 = 21*12

105 = 3*5*7 = 5 * 21

means the GCD of 252 and 105 is 21

Now how does one do this via the Euclid Algorithm?

First you begin by dividing the bigger number by the smaller one…

252/105 = 2 remainder:42

Then you take the smaller number and divide it by the remained..

105/42 = 2 remainder:21

then again..

42/21 = 2 remainder:0

And that is how you can tell that 21 is your GCD.. because it is the number that can actually be divided by evenly with a remainder of 0.

Now I actually have written a program that does all this for you in C#.net so check out the code below and see if it works for you. Enjoy!

namespace Euclid_Algorithm_GCD
{
    class Program
    {
        static void Main(string[] args)
        {
            int var1;
            int var2;
            double result;
            double remainder;

            Console.WriteLine("Welcome to the Euclid Algorithm." + Environment.NewLine + "Please enter your two numbers below!(Bigger Number First)");
            var1 = Convert.ToInt16(Console.ReadLine());
            var2 = Convert.ToInt16(Console.ReadLine());

            bool keepGoing = true;

            while (keepGoing)
            {
                result = var1 / var2;
                remainder = var1 % var2;
                Console.WriteLine("GCD(" + var1 + ", " + var2 + ")");
                Console.WriteLine("Division: ");
                Console.WriteLine(result);
                Console.WriteLine("Modified: ");
                Console.WriteLine(remainder);

                int temp = var2;
                var2 = var1 % var2;
                var1 = temp;

                if (remainder == 0)
                {
                    keepGoing = false;
                    
                }

            }
            Console.WriteLine("Problem Solved");
            Console.ReadLine();

        }
    }
}
0  

Install .APK onto Android Emulator

This simple procedure is dead simple and in general, just a reminder to myself. But feel free to enjoy the wisdom/intellect as well.

1) Locate your platform-tools folder inside the SDK folder.

2) Then copy and paste your .apk into that folder. Rename it to something easy to type.

3) Open the command line at that folders path.

4) Type in command to check if emulator is running. (Be sure to start up your emulator.)

adb devices

5) Now as long as you see your emulator running, proceed to this step. Type in the following command replacing abc.apk with the name of your .apk file.

adb install abc.apk

6) Once completed, check your emulator and enjoy your application!

Cheers!

0  

C Programming with Pointers

What is a pointer?

A pointer is commonly known as a reference to a location in memory. You can use it to locate a section of memory that you forgot the variable too or you can use it to exchange data between two locations in memory.

How do we declare a pointer value?

To declare a pointer value all one must do is place an asterisk between the data type and the identifier of a variable; like so.

int a = 5;
int* pointerA = &a;

printf("value of a: %d \n", a);
printf("value OF pointerA: %d \n", pointerA);

Woa! Hold up, what is that & sign there for? The & sign is specified as an Address Operator which goes and gets the address in memory of integer a and returns it to the pointerA variable. The result of this program if you printed out what a and pointerA equals on my machine it will come up with:

image

That was cool. Now you know how to create a pointer, and how to assign an address to it.

Tip: If you are assigning an pointer to an array you do not need the asterisk because the array’s identifier already points to the address of the array.

How do I get a value from a pointer? Simple just place an asterisk in front of the identifier you are trying to get. You can read this as “The Value of” such as in the context below… Just append the line of code underneath to your file in the scope of main.

printf("value at pointerA: %d \n", *pointerA);

Me reading the above line out loud:

“Print the value at pointer A to the console.” – Taylor Brazelton

Now you realize the point of pointers in C and C++ hopefully you aren’t summoned upon to use these skills but every now and then someone is. Enjoy the tutorial and use it to your benefit.

0  

Dang that Hard Drive is Small!

After going through first semester with my ultrabook I have uncovered several pro’s and con’s with it. However that is for another day possibly. For now I shall try to stay focused and tell you about my adventure. First off you need to know I own a Samsung Series 9 Ultrabook I purchased for school work back in the summer of 2012.

It started off as a great buy, then half way through my first semester I realized I only have 4 GB of space left on my HD. I searched for programs to uninstall, movies to delete, and music to move to my external drive but just couldn’t push any away from myself that I’d need for classes. With only my 128GB SSD(solid state drive) to assist me I was able to drive my way through till the end of the semester with only the 4GB available.

This semester I have taken it upon myself to buy a new, better, bigger hard drive. At first I drove over to Fryers which is an Electronic store near Indianapolis, IN. I purchased a SSD in which they recommended for my laptop however it ended up not fitting. They had given me a 2.5” HD while my ultrabook could only fit a mSATA drive inside it’s self. Finally I took the plunge this weekend to get a mSATA drive, after I returned the 2.5” to fry’s first.

Looking online I was able to find a very good deal on a Crucial M4 256 GB for only $200 even with free shipping. The SSD has SATA 3 connections that provided 6GB/sec connection along with a 3 year warranty from the manufacture. I can’t wait for the hard drive to arrive so I can install it in my laptop and lets its space be filled in by on mind projects. I might even take a few pictures and maybe a small video clip or two as well. Be sure to keep a look out for my next post or two!

0  

Quick Tip about MVC 4

Just thought I would let everyone know, as long as make a reminder for myself… The MVC 4 Basic Project Type is the same as the MVC 3 Empty Project Type. MVC 4 Empty Project Type is literally empty. Do not be mistaken when you are doing a MVC 3 tutorial in a MVC 4 project.

Enjoy and have a wonderful new years! Smile

0  
0  

The YouTube Thoughts

Pros:

  • Large Audience Base
  • Always Fresh Content
  • Well Categorized
  • Some High Quality Content
  • Good Options for Sharing your Videos
  • Well Known
  • Your Own Profile Page that is Semi-Customizable
  • Custom URL
  • Subscriptions
  • Mobile Uploading via Custom Email Address and then some…
  • Search Function
  • Access to Non-Monetized  videos via HTML 5 Player
  • Twitter, Facebook, and Orkut Connections
  • Privacy:
    • Show/Hide User Activity
    • Show/Hide YouTube Channel
    • Public, Unlisted, Private Videos
  • Video Analytics
  • Other Features:
    • Video Edit Online
      • Light weight Video trimmer, splitter, combiner, audio swap/background music, transitions, titles, etc…
    • Video Auto Fix and Filters
    • Trim, Lighting, Color, Stabilization…
    • Captions
    • Annotations
  • Features that have to be Earned:
    • Monetization
    • Unlimited Uploads(Videos Longer Than 15min)
    • External Annotations
    • Custom Thumbnails
    • Unlisted and Private Videos
  • Set Upload Defaults

Cons:

  • To Many Videos
  • To Much New Content
  • Intergraded with Google Account
  • Horrible New Homepage.
  • Trolling Comments
  • Tons of Duplicate Content

That’s all I could gather together for everyone. If you have any of your own pro’s or con’s be sure to leave them in the comments section below!

0  

Which Video Site Should I Choose?

Over the past few years I have solely relied on YouTube as my main source of hosting for the videos I have wanted to place online. However, after coming home for winter break I have realized that maybe YouTube isn’t the right choice. Now I am not sure if I am going to personally switch sites right yet. But I am going to take a tour and try out other sites and post my thoughts about them. Check back for videos from each site, and if you have a suggestion feel free to submit your idea in the comments section below.

0