## Friday, May 9, 2014

### Simple program that gets the sum of the numbers 1 to N

This is perfect for those who need a refresher...
**Note: I'm doing these in Visual Studio Express 2013

The formula for completing this task

This formula is pretty straight-forward and translate to: [ maxNum * (maxNum)]/2 = [(maxNum)2]/2 + maxNum/2
Requirements for this program

• A TextBox (txtMaxNum)
• A label (lblMaxNum)
• Another label (lblSum)
• A button (btnSum)
• (everything else is optional)
Here is the code:
```using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CS_Playground
{
public partial class Form1 : Form
{
private int maxNum;

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
resetTextBox(txtMaxNum, "Insert the Maximum Number");
lblMaxNum.Text = "(Nothing yet)";
}

private void txtMaxNum_Enter(object sender, EventArgs e)
{
//Make sure the textbox is empty and ready for typing
insertTextMode(txtMaxNum);
lblMaxNum.Text = "Typing...";
}

/*
* Reset the textbox so that there is a default value already
* inside then clears the textbox
*/
public void resetTextBox(TextBox textbox, string defaultText)
{

textbox.Clear();//Makes sure there is nothing in there
textbox.ForeColor = Color.Gray; //Gives the font a grayish color
textbox.Text = defaultText;

}

/*
* Changes the font color for text insertion
*/
public void insertTextMode(TextBox t)
{
t.Clear();
t.ForeColor = Color.Black;
t.BackColor = Color.White;
}

public int sum(int max){
int sum = (max * (1 + max) / 2); //Algorithm for getting the sum of the
//numbers 1 + 2 + 3 + ... + n
return sum;
}

public void warning(string text) {
System.Windows.Forms.MessageBox.Show(text, "Error", MessageBoxButtons.OK ,MessageBoxIcon.Error);
//This is a long statement
}

private void btnSum_Click(object sender, EventArgs e)
{
/*
* Even if you don't enter anything in the textbox, it will still count the length
* of the default text which is what we want to prevent.
*/
if (txtMaxNum.Text.Length > 0 && txtMaxNum.Text != "Insert the Maximum Number")
{
//Now we need to make sure that a we are working with integers
if(txtMaxNum.Text.All(char.IsDigit)){
lblMaxNum.Text = txtMaxNum.Text;

maxNum = Int32.Parse(txtMaxNum.Text);
lblSum.Text = "1 + 2 + 3 + ....... + " + maxNum + " is " + sum(maxNum);
resetTextBox(txtMaxNum, "Want to do another one?");
}else{
//If someone decides to add some letters anyway they will be stopped by this error message
warning("Why are you goofing around? You know we're only working with integers");
lblMaxNum.Text = "Try again";
}

}
else{
txtMaxNum.BackColor = Color.Red;
txtMaxNum.ForeColor = Color.White;
txtMaxNum.Text = "Please enter a Number";
lblMaxNum.Text = "Try again";

warning("Sum calculations cannot take place with an empty textbox. Please specify a maximum number");

if (txtMaxNum.Focused == true) {
insertTextMode(txtMaxNum);
}

}
}

}
}

```

Here are the images that I have (I should have a demonstration video up and going in the next couple of days).

## Thursday, May 8, 2014

### Simple Program that returns text from textbox

This is perfect for those who need a refresher of C#

Here is a basic program that Returns text from the textbox. You are given an option to either print the message out in either a messagebox or withinn the window itself.

What you will need:

• A textbox (txtText)
• A label (lblMessage)
• A checkBox (chkMessage)
• A button (btnGreet)
• //This is the only class
Here's the Source code:

```using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CS_Playground
{
public partial class Form1 : Form
{
private string yourName;

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

lblMessage.Text = ""; //Make sure the label doesn't say anything

}

private string greeting()
{

return ("Hello " + yourName + " Nice to meet you!");

}

private void btnGreet_Click(object sender, EventArgs e)
{
yourName = txtName.Text;

if (chkMessage.Checked == true)
{
showMessage(greeting());
}
else
{
lblMessage.Text = greeting(); //Print the message below the button in the label
}
btnGreet.Text = "Do it again?"; //Change the text of the button when clicked
txtName.Text = ""; //Empties the textbox

}
//Shows a message in a messagebox
private void showMessage(string text)
{
System.Windows.Forms.MessageBox.Show(text);
}

}
}

```
Here are the results I got:

A good challenge can be making the name bold in the message. Thanks for reading!

## Tuesday, August 13, 2013

### What to do in the event of your account being hacked

Whether you're checking your email or browsing a social network site, and notice strange activity with your account, then it has most likely been hacked.

If this has happened to you, the easiest thing you can do is change your password and make it a lot stronger. It should contain a combination of at least 1 capital letter, number, and special character.

***Never share your password with anybody (even if you trust that person), if you do share it, change it within a timely manner***

## Monday, August 12, 2013

### Tips to a successful semester

It's that time of year again, when it's time for everyone to start school again. Every school year or semester is different, therefore you must do different things to survive if you begin to struggle.

• Take plenty of notes, if you are allowed to use a laptop in class use that (you'll remember more info that way). Chapter outlines from the textbook website can help you with note taking.
• If you miss class, ask someone in your class or send a mass e-mail to  your class mates asking for a copy of their notes to study with, or you can post your notes to a web site (where ever you're hosting them) and share them with your class. Use this to start a study group.
• If your school offers free tutoring, use it. Sometimes the tutors explain what you're having the problem with better than the instructors. You can also ask your instructors for help as well.
• Go to class. Some classes don't take attendance and some students will take advantage of that, then pay for it when they accidentally miss a quiz or an exam.
• If you are taking an online class, although you don't have to go to a physical class room, it's double the work. You will usually have deadlines and a semester cut-off date (no homework, projects or exams are excepted after this date). Don't wait until 1-2 weeks before the cut-off date to start doing your work. You should pace your self, for example, if you have to do work based on a 12 chapter book, spend 1-1.5 weeks focusing on one chapter at a time, that way you can meet all of your deadlines on time and will have completed all of your work before the cut-off date.
• When book buy-back comes around, keep the books based on your major. For example, if you're majoring in computer science, you would keep all of your computer books as a references and get rid of the other books that you don't need. Believe me, I've had to go back and purchase books that I wish I didn't sell back. Don't let anyone borrow or steal your books.
• Most importantly, pick a good time during the day/night to study. Study at least 30 min - 1 hr a day, and increase the time when preparing for an exam. Practice exams are good for studying as well.
• If you're stressed out because you have a lot on your plate, or you're not doing so good in one of your courses, go ahead and withdraw from that course while it's still an automatic W (before it becomes an WP or WF). That way, you shouldn't have any problems with financial aid if you're getting it (based on your school); Be sure to talk to someone in your financial aid office about their policy on withdrawals.
As promised, some useful tips and advice. Although this guide is primarily aimed at college students, high school students can use these tips too.

## Friday, August 9, 2013

### The Future of Cell Phones Plans

It would seem that this is the future of cell phones.

Check this out below

See how far we have come in the past 20 years?

## Tuesday, August 6, 2013

### Video Games: Most Annoying Way to Die/Lose #2

Don't feel like you're by your self if this has happened to you. In some video games such as this one, where you are confident and a above-average gamer who collected special items throughout the game, this scenario proves to be embarrassing when you're trying to show off or become irritated when that was your last life and your game is over, knowing that it was because of something small/simple.

Even if you're annoyed or ready to throw the controller, just know that you have acquired great knowledge from your experience and will do even better the next time (or time after that), so pick up the controller and "Game-On". - Gamer Queen.

Most Annoying way to die #2 from animedragonfighter on Vimeo.

Has this or something similar happened to you?

## Monday, August 5, 2013

### CSS3 layout for HTML5

Here's a pretty neat CSS layout I worked on last week for one of my websites. The main content has a water marked paper image. The color theme is based on a dark blue.
This was done in HTML5, so there's a header, nav, section, aside and footer element. All of these elements have unique ids, and sits inside a div (id="big_wrapper"). So if you are just starting out in learning HTML5 or testing a page and want to attach some quick css3 code, this will be a big help.

```*{

list-style-type:none;
margin:0px;
}

body{

font-family: Arial;
font-size:14px;
color:#303030;
background-image:url('images/background.jpg');
background-attachment:fixed;

}

display:block;
}

#wrapper{

width:1000px;
margin-left:150px;
background:white;
background-image:url('images/paper_background.jpg');
background-attachment:fixed;
}

#top_nav a, #main_footer a{
color:white;
text-decoration:none;
}

#top_nav a:hover, #main_footer a:hover{

text-decoration:underline;
color:yellow;
}

a{
text-decoration:none;
color:#303030;
}

a:hover{
border-bottom:1px #303030 dotted;
font-weight:bold;

}

background-color:black;
text-align:center;
}

#main_content{
/*float:left; */
width:560px;
margin:10px;
text-align:left;
line-height:20px;
background:white;
float:left;
}

#main_aside{
float:left;
width:320px;
margin:10px;
background:white;

}

#bod_content{
background:white;
background-image:url('images/paper_background.jpg');
}

.news_content{
text-align:left;
}

.h3_eye_catcher{
color:green;
text-align:center;
}

#top_nav{
color:white;
text-align:center;
font-weight:bold;
margin-bottom:10px;
font-size:16px;

background-image: linear-gradient(bottom, #0B0142 48%, #2107B5 95%);
background-image: -o-linear-gradient(bottom, #0B0142 48%, #2107B5 95%);
background-image: -moz-linear-gradient(bottom, #0B0142 48%, #2107B5 95%);
background-image: -webkit-linear-gradient(bottom, #0B0142 48%, #2107B5 95%);
background-image: -ms-linear-gradient(bottom, #0B0142 48%, #2107B5 95%);

linear,
left bottom,
left top,
color-stop(0.48, #0B0142),
color-stop(0.95, #2107B5)
);

}

#main_footer{
clear:both;
background:#2107B5;
color:white;
text-align:center;
}

```
Be sure to change the images and name your "id"s appropriately. You can play around with this code and change it to your liking.

Note: This code is not perfect, but it is a good starting point.

## Monday, July 29, 2013

### The very first thing you should do once you purchaced a new computer

When you get a new computer and turn it on for the first time, you're ready to either get to work, play around with it or start having fun.

However, problems will arise later on and you may need your recovery discs. You don't have them so you go to your manufacturer to order them which cost too much money.

Although you can press either F10/F11 at Start up, it's also best that you create your own recovery media. This recovery media will have everything you need from the start-up repair to the drivers you need.

Some computers have their own recovery media creation software, while windows 7 and 8 have one too.

If you just purchased a new computer, or have a computer that isn't having any system problems, you may want to go ahead and create your recovery discs.

## Wednesday, July 24, 2013

### How to recover files from a computer that won't boot into windows

Something happened (your computer isn't booting into windows or won't turn on at all) so you took your computer to a shop, and a technician tells you that chances are all of your personal files will be erased.

Then you realize, it's either been a while or you never did a backup of your personal files. Then there's the overwhelming fear/emotion of losing your documents, videos, music and photos.

Here's how to back up a computer in this current state. You will need to take out the hard drive and hook it up to a working machine, copy your personal files on there using this, an IDE/SATA to USB adapter. The IDE/SATA to USB adapter is not limited to just the hard drive, you can use it to test other drives such as an optical (CD/DVD) drive or use them externally.

or use one of these, a Hard Drive (HDD) Docking Station

These devices support both IDE and SATA interfaces. If you are unsure how to uninstall the hard drive from your computer, check your computer's service manual for specific instructions.

Another tool you can use is a Hard Drive Enclosure Case. You will have to already know your hard drive interface size. Remember the size of laptop hard drives are smaller.

These are perfect for creating your own external hard drive, or treating one of your old hard drives as a backup device.

Either way, any of these devices will save your life and your personal files.

Note: You will have to take your hard drive to a professional data recovery business if your hard drive is damaged or broken.

## Tuesday, July 23, 2013

### Finding Decently Priced Replacement Laptop Screens

Uh Ohh... I know the feeling all too well when a laptop screen is cracked, and the replacement prices are horrifying, depending on where you buy them.

When I contacted my manufacturer to price my replacement screen, I was shocked at how much I would be paying through them, which was well above \$400 for a replacement screen at the time.

Whether you are taking it to a shop or replacing it yourself, you will actually save a lot of money purchasing them from amazon.com or ebay.com.

Another way to save money is to purchase a broken machine and salvage it for parts (assuming that the screen is good). Warning: Never buy a broken laptop that shows signs that it was dropped and suffered significant damage from that drop.

Below are some selections from amazon.com (you can edit the search results by editing the text in the search bar)