How to install XP with Windows 7/Vista pre-installed

I have just installed Windows XP on top of Windows 7. So I’m gonna tell you how to do it while its still fresh on my mind.

It took me about 3 hours to do this because its actually the first time I have done this. So I hope this guide will help you cut down the time that I have spent on it.

 

Requirements:

Easy BCD 

Windows XP SP2/SP3 installation CD

Windows 7 installation CD

Common Sense

 

Backing up the MBR

First thing that you need to do is to download and install Easy BCD. Then backup your Master Boot Record.

image

Back it up into an external location. Maybe a flash drive or an external hard drive. Just in case something will go wrong.

Just click on backup settings after you have selected the external location. Then check in the actual directory if there is a .bcd file in there. If there is none, then you have to click the backup settings button again until you will find the backup file in the location that you specified.

 

Partition hard drive

Next thing that you’ll need to do is to partition you hard drive. So that Windows XP will have a place to be installed.

To do that just right-click on Computer and select manage. Then select the disk management section:

image

If you no partitions on your drive. Then you will need to shrink the partition where your current operating system is installed. Right-click on that partition and select shrink volume:

image

You’ll see something like this, but just wait since it may take a while depending on the size of your hard disk and how much files are stored in it.

image

Change the partition size  to your desired size. In this example it will be 10 Gb or 10240 Mb:

image

You can put whatever you want as long as its not above the largest size that is possible to shrink. Click on Shrink after you have inputted the desired shrink size.

Just leave the newly created unallocated space. But remember the size that you have inputted since we will make it as a basis when we install Windows XP.

Right click on the drive and select properties if you have forgotten its size. You’ll just have to convert the number indicated in there using an online converter. Because its expressed in bytes. What we need is the value in Kilobytes and Megabytes.

image

 

Installing XP

Restart your system. And go to your BIOS by pressing on f2 or del on your keyboard. Here’s a list of bios suppliers and the keyboard commands that you can use to access it:

http://michaelstevenstech.com/bios_manufacturer.htm

While you’re in the BIOS just change the SATA Mode to IDE. Because AHCI is somehow not compatible with Windows XP. Here are some supplements:

http://www.techarp.com/showfreebog.aspx?lang=0&bogno=313

http://www.techmetica.com/howto/sata-ahci-mode-bios-setting.-what-does-it-do/

This step is the most important since you will be getting a Blue Screen of Death or BSOD if you don’t change the SATA Mode into IDE.

Set your BIOS so that it will boot from the CD-ROM or DVD-ROM first. If you don’t know how to do that then visit this link:

http://helpdeskgeek.com/how-to/change-boot-order-xp-vista/

Save changes and exit.

The Windows XP installation CD will boot and then it will prompt you to press any key to boot from CD. Just press any key in your keyboard if you see this prompt.

Just go through the usual installation process. Visit this link if you don’t know how to do the usual process of installing XP.

http://www.buildeasypc.com/sw/windows_xp.htm

My only reminder is that you have to select the drive partition that you created a while ago. So that you won’t messed things up.

 

Repairing Windows 7 MBR

What you’ll need to do now is to restore the Master Boot Record of Windows 7. You will have to use the installation of Windows 7 to do this.

Here’s a guide from Microsoft on how to repair the MBR:

http://support.microsoft.com/kb/927392

But what I did was to use the commands below in the built-in command line tool in Windows 7 installation CD:

bootrec/fixmbr
bootrec/fixboot

Those commands will restore the Master Boot Record.

And will enable you to see the boot loader for Windows 7 again.

 

Restoring Windows XP

All you have to do now is to add an entry for Windows XP on the boot loader. This is where Easy BCD comes in again. Just click on Add New Entry.

image

I’m using the current version of easy BCD. Version 2.02. The interface might be a little bit different if you’re using a different version.Just select Windows XP on the OS type drop-down list. And click on Add Entry

image

To check if it has indeed added Windows XP on the list. Just right-click Computer. Select properties. Advanced System Settings. Then click on Advanced tab. On the Startup and Recovery Section click on Settings

image

It has Microsoft Windows XP on the list.  Then just reboot your system. But if not then you’ll just have to repeat the process that you did on Easy BCD.

image

Always remember that you cannot boot Windows XP if your SATA Mode is AHCI. And you cannot boot Windows 7 if your SATA Mode is set to IDE. So you need to switch SATA Mode into AHCI if you need to boot to Windows 7. And IDE if you want to use Windows XP.

 

Conclusion

That’s it. There’s a challenge for you though. If you discovered how to boot XP or 7 without switching SATA Modes then please tell to me in the comments. Thanks!

 

How to install incompatible applications in windows 7

There are times when you have an application which you want to install. And then you get an error similar to this:

image

Saying that the application that you’re trying to install is not compatible with your current operating system. In this case, Windows 7.

A simple workaround on that is to run the installer in compatibility mode with the current OS.

To do that, just right-click on the installer and select properties.

Click on the Compatibility tab. And check the ‘run this program in compatibility mode for’. Then select the operating system indicated in the error.

image 

Click apply then click ok.

Launch the installer again. And you will now be able to install it on your system without having problems.

Empty mysql tables

This is a quick guide on how you can empty all of the records that is stored on a mysql table. This is useful for testing purposes, when you want to declutter the database. You can also think of different things where to use the truncate function if you’re creative.

<?php
 
include('conn.php');
 
query_database("truncate table purchase_transactions", "onstor", $link);
query_database("truncate table sales_transaction", "onstor", $link);
query_database("truncate table vendor_credit", "onstor", $link);
query_database("truncate table supplier_table ", "onstor", $link);
query_database("truncate table reports", "onstor", $link);
 
query_database("truncate table customer_table", "onstor", $link);
query_database("truncate table customer_credit", "onstor", $link);
query_database("truncate table categories", "onstor", $link);
 
 
?>

That’s how you do it the long method. Here are some supplements if you want to learn how to do it in a shorter way:

http://stackoverflow.com/questions/1575419/how-can-i-truncate-multiple-tables-in-mysql

http://stackoverflow.com/questions/1912813/truncate-all-tables-in-a-mysql-database-in-one-command

Using auto-increment in mysql

This is a short guide that will teach you how you can auto-increment a field in a mysql table. What auto-increment does is to fill up a value for a field without user intervention. It automatically generates auto-incrementing values as you use an insert query. Auto-increment values are usually used as a primary key or unique key for a certain table in a database.

Here’s a screenshot that will give you an idea on how to auto-increment a field.

image

The value that would be inserted in this field would be 1 to n. Where n is the numeric value of the last record that you have inserted in the table.

When you perform an insert query, you don’t need to supply values on these fields. That’s very useful because the amount of time needed to complete a form is diminished because a unique number for the primary key is automatically generated.

Storing date and time in mysql table

In this quick guide, I’ll be showing you how you can store date and time values on mysql table using php.

First thing that you need to do is to declare your database information.

<?php
 
$con=mysql_connect("localhost","root","1234"); //host, user, password
mysql_select_db("onstor",$con); //database and the connection information
 
?>

Then set your time zone. You can find a list of time zones that is recognized by php in this link: http://php.net/manual/en/timezones.php

I am living in the Philippines so my time zone would be declared this way:

date_default_timezone_set('Asia/Manila');

The most important part is the value of date that you’re going to store in the database.

$date=date('Y-m-d h:i:s');

That’s the date format that is recognized by mysql. You can modify it but it might store something like this, if you don’t get it right:

0000-00-00 00:00:00

And finally, the query that will store the value into the database:

mysql_query("INSERT INTO reports(DATE) VALUES('$date')");

That’s a quick guide on storing date and time values on mysql database. Hope you learned somethingSmile

How to add application exceptions to windows firewall

In this tutorial. I’ll be showing you how you can add an exception to a certain application in windows firewall. Placing an exception to an application means that the firewall will not block the application from allowing inbound or outbound connections to your computer.

Be careful when placing exceptions though. Make sure that the application that you’re allowing is not shady. Only place exceptions to applications which you trust and you are 100 percent sure that its safe.

To add exceptions to applications on the windows firewall. Just go to control panel. Select view by small icons. Then click on windows firewall

image

The windows firewall control panel module will show up. Then what you have to do next is to select ‘Allow program or feature through windows firewall’.

You will see here that there are already some applications which are allowed through the firewall. Scroll down through the listed applications and see if the application that you want to allow is in there. If its there then just tick the checkbox beside it. There are two choices though.

First is  the home/network. This means that the firewall would only allow the application to have access to inbound and outbound connections inside the network. If the application that you are trying to allow is used for file sharing then the files that you share would only be accessed by those who are inside the network where you belong. People outside it would not be able to have access to it.

Second is the public. This means that everyone could have access. Even people outside the network. An example of this would be a website test. If you want people to test the website that you have made in your localhost. Then this is the option that you need to check.

But if the application that you want isn’t listed then you can always add them to the list and check them afterwards. To do that just scroll down a little and you will see the ‘allow another program’ button. Just click it.

image

Another window will popup and it will let you choose from the list of programs. If the program isn’t still in the list. Then just click on browse. And browse for the executable file that you use to launch the program. If you don’t know where’s the executable file of that program. Then you might want to check the startmenu and find your program there. Right click the program and select properties.

For example if you want to allow notepad through the firewall.

image

Just copy the directory path, next to the start in label. And then navigate into that path when you’re browsing for the program that you want to allow through the firewall.

 

Conclusion

That’s it, your application will now have access to the internet once you enable it through the firewall.

How to access localhost of computers outside the network

In this guide, I’m going to show you how you can access the localhost of other computers outside or inside your home network.

This guide is specifically intended for people who are working on a website which needs testing from users. Because most of the time the programmer will not see all of the programs defect, errors, or bugs. And only the users can point this out.

 

Wired Connection

For those of you who have wired connection. The method of letting others access your projects for testing purposes would be much more easier. To do this, just go to cmyip.com. Then copy your ip address. Paste it into the address bar of your browser. If you can see something like the screenshot below then it works for you, but were still not sure if it would work for others. So to try it out, just give your ip address to your friends and let them do the same:

image

If it doesn’t work for them. Then maybe who have somehow messed up with your firewall configurations. I won’t recommend you to try and disable it. Because that’s stupid.

To do that, just go to your control panel, and then click on windows firewall. Then click on restore defaults.

image

It will warn you that restoring defaults might cause other programs to not function properly. That’s why I recommend that you create a restore point first. After creating a restore point, just click on restore defaults.

image

Next thing that you need to do is to ensure that ip addresses from outside the network would have access is to configure your http.conf file. Just left click on the wampserver tray icon then select apache, then click on httpd.conf.

image

If its your first time opening the file, then it would prompt you to select a program that you will use to open the file. Just select notepad from the list.

Now, press ctrl+H on your keyboard to launch the find and replace tool in notepad. And type:

</di

image

You have to modify the part enclosed in <directory> tags. Replace the Deny from all with Allow from all. The text enclosed in <directory> tags will now look like this:

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
</Directory>

Just save that one and then restart your wampserver. Others should now have access to your localhost, and they can now test your projects.

Last thing that you’ll need to do is to make sure that you’re server is actually online.

image

If you can see that the text in there is Put Offline. Then yours is already online. And ready for access from the outside world.

If you want to protect your codes from being downloaded. Then you have to put index.php file on every folder of your project. Be it javascript or css. But the most important are the php files.

If you didn’t then your testers might see something like this:

image

And its not cool. I’m telling you. Because if they see that one. They can download it.

 

Wireless Connection

This part of this guide is intended for those who have laptops or desktop which connects to the internet via router or wireless hotspots or wi-fi. The ip address that the people from outside the network will use to access your localhost is the ip address that you can see in cmyip.com.

There are few things that you need to do which I already mentioned at the top. So do these things first before you continue:

  • Edit your httpd.conf
  • Make sure your server is already online

If you’ve done that then fire up your command line by typing cmd on the search bar.

Type in ipconfig/all

You’ll see something like this(Sorry but if I’m taking precautions here. I’m not actually gonna show you whats my ip address and everything:

image

You’ll only be concerned with the value of the ipv4 address in here. Just paste that ip address into your browsers address bar. If it doesn’t work then you might need to configure your router as well.

Here’s how to configure your router. Just go type 192.168.1.1 or 192.168.1.0  on your browsers address bar to access your router settings.  The usual username and password would be admin.

Go to forwarding, then add the ip address which you have copied from the command line a while ago. And paste it into the textbox which requires the ip address. Then type 80 on the port. Port 80 is the port that is commonly used. But if you’re accessing your web directory through a different port, then use that port. Make sure you enable this configuration so that the port forwarding will work.

 

Conclusion

That is how you access localhost from other computers. Its just easy and I think it’s a nice tool for letting others see and test your work without having to host it on an actual server.

How to edit Joomla configuration file

This is just a quick guide on how you can edit the configuration file in Joomla. This is useful when you have recently changed your mysql database password. And whenever you access Joomla in your localhost, it says that it cannot connect to the database.

To edit the Joomla configuration file, just open up the folder where you have installed Joomla. Mine is in:

C:wampwwwjoomla

Then open up the configuration.php file on a text editor.

image

We are only interested in the final parts of the file. I’ve already commented the important parts that you may need to modify:

var $db = 'joomladb'; //this is the database where all the data used by joomla is stored
var $dbprefix = 'jos_';
var $mailer = 'mail';
var $mailfrom = 'vbdotnetnrew@gmail.com';
var $fromname = 'JoomlaTesting';
var $sendmail = '/usr/sbin/sendmail';
var $smtpauth = '0';
var $smtpsecure = 'none';
var $smtpport = '25';
var $smtpuser = '';
var $smtppass = '';
var $smtphost = 'localhost'; //host, its usually called localhost. Since the Joomla CMS is hosted on your local computer
var $MetaAuthor = '1';
var $MetaTitle = '1';
var $lifetime = '60';
var $session_handler = 'database';
var $password = '1234'; //password, this is the one that you may want to change depending on your current mysql database password.

vb.net database connection basics part 2

This is the part 2 of the 2 part article on the basics of vb.net database connectivity. In this guide I’ll show you how the few things which changes whenever you try to connect to different kinds of database.  Here is a link on the part 1 of this series in case you haven’t red it yet.

There are only few things that changes whenever you try to connect to different database:

  1. Connection String
  2. Namespace
  3. Methods used by the namespace
  4. Driver to be used

 

Connection Strings

According to Wikipedia, a connection string is a string that specifies information  about a data source and the means of connecting to it.

This only means that for every database , there is  unique connection string to be used.

The connection string that were referring here, is the parameter which goes inside the declaration of the database connection in the vb.net application. Here is an example of a connection string which I use in connecting to a mysql database using the MySql ODBC driver.

Dim cn As New OdbcConnection("DSN=yoh")

As you can see, the connection string is the one that is inside the parenthesis which is then enclosed in quotation marks. The connection string here is short compared to the other connection strings, this is because I have used a DSN. Short for Data Source Name. The DSN is used as a reference to all the information which is needed by the program in order to connect to the database. And the DSN is defined somewhere else in the operating system.

If you want to know how to connect mysql and vb.net using ODBC , then check this one out.

 

Namespace

This is the one which is on uppermost part of the visible code. It is often placed on a Parent Class so that other forms can inherit from it. And there will be no need to re-declare the namespace on every form that you’re going to create.

Here’s a list of namespace that I know:

  • System.Data.Odbc- the.NET Framework Data Provider for ODBC
  • System.Data.SqlClient- the.NET Framework Data Provider for SQL Server
  • System.Data.Oledb- the .NET Framework Data Provider for OLE DB.
  • System.Data.MysqlClient- the .NET Framework Data Provider for MySql DB. Mainly used when connecting mysql to vb.net using the .NET Connector.

 

Basically you will need to type the keyword ‘imports’ before each namespace. So that the program will know that it’s a namespace that you are declaring. Pretty much like declaring a variable, we typically use the ‘dim’ keyword in vb.net.

 

Methods used by the namespace

Of course, the namespace will determine the methods which can be used in manipulating the database. The methods that I’m referring here are built-in methods which is contained on every namespace. Because each namespace is like a large library of codes and there are methods in it that  you can use.

I’ll just give few examples here, so that you’ll understand what I’m talking about.

In this example, I’m going to use the ODBC namespace:

Imports System.Data.Odbc

So it is automatic that we’ll also be using odbc in each of the methods that were going to use. For the connection we use:

Dim cn As New OdbcConnection("DSN=yoh")

As you can see, I used OdbConnection in the declartion. That is because I used the ODBC namespace.

When I declare a command, I also do something like this:

Dim cmd As OdbcCommand

If I declare a data reader:

Dim rdr As OdbcDataReader

For those of you who do not know what data reader is. It is a built-in method in vb.net which is mainly used for fetching records or data from any database. So even if you are using a different database, you would still use data reader. But keep in mind that you have to change the word before it when you use a different database. I’m using ODBC as an interface between MySql and Vb.net that is why I declared it as OdbcDataReader.

 

Here’s the round two of the examples, so that you’ll fully understand how the namespace dictates the name of the methods that were going to use.

If on the other hand I use connector.net to connect vb.net and mysql. Then I make use of this as my namespace:

imports MySql.Data.MySqlClient

Then the connection declaration would be:

Dim con as new MySqlConnection("Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;")

It’s a bit longer since I didn’t use a DSN.

 

Driver to be used

Lastly, we also need to consider the different drivers that we could use to connect our application to a database. Here are some database drivers:

If you already visited the links you will see that most of the drivers are for ODBC. Which means that you can also use a DSN on each of them to make the declaration of the connection string less tiring.

vb.net database connection basics part 1

In this guide, I’m going to show you the things you should know when you want to connect  your vb.net application to a database.

Connecting your application to any database is easy as long as you know the basics. Because almost all of the codes used in connecting to different database are the same. You only have to modify a few lines of code to make it work for you.

The connection strings is one of those that needs to be modified. And you can find a lot of connection strings on connectionstrings.com. They have connection strings for every database that you can think or know of.

This guide is the one that you might want to check out first before trying any of these:

Yeah, that is some sort of a summary of all the things I have discussed regarding database connectivity on vb.net.

 

Creating a new project

Let’s get to the point. First thing that you’ll need to know is creating a new project in visual studio. If you find this lame, then you can just skip and scroll down until you find what you need. Because I’m doing this for the absolute noob’s sake.

image

Click on new, and then project, then you’ll see something like this. Just make sure that you have selected the windows form application.  Then press ok.

image

 

Creating and class

Second thing that you need to know is creating new classes. Because we will be using this new class as a base class for inheriting and using methods that we will use to connect and manipulate the database.

image

 

Declaring an object of a class

Next thing that you’ll gonna need to know is how to declare an object of the newly created class in your windows forms (the one with the graphical user interface, or an empty canvas). Just to be sure, I’m referring to this one:

image

To declare an object of the class in this form, just double click it so that you’ll see its source code.

Then you type this line of code, just below the public class form1.

Dim c1 As New Class1

Of course the ‘Class1’ here can vary. Depending on what you have named your class. Good news though, you can see what’s your class name on the solution explorer.

image

 

Creating subroutines

Fourth thing that I want to explain to you is how you can create subroutines. This is important since were going to use subroutines or subs for querying the database. And its more convenient using subs so you wont be copy pasting the code all over when you need something that needs to be repeated.

Just go back to the class, and type this one:

Public Sub insert_records()
 
End Sub

The whole code will now look like this:

image

That’s how to create a sub. And what you’ll be putting inside those subs are individual queries like inserting, updating, and deleting records from the database. Each sub will have different functions and parameters. But there can only be one function that each one performs so that it won’t become confusing.

 

Creating functions

Functions are different from subs, since subs only perform an action. A function on the other hand, performs an action and then returns a value to the one who is calling it.

I often use functions on reading data from a database using the built in data reader. Here’s an example of a function which reads data from a database. It uses mysql stored procedures that’s why the code is a bit different.

Public Function readfrom_drug_type_table() As MySqlDataReader
       Try
           cmd.CommandText = "CALL readfrom_drug_type_table"
       Catch
           MsgBox("Reader is opened close it first by clicking on the close link")
 
       End Try
       Return cmd.ExecuteReader
 
 
End Function

Always remember that when you’re creating functions you must always have a return value. You will get an error if you don’t have it. In the example, the return value is ‘cmd.executeReader’.

 

Calling subroutines

I often call subroutines from windows forms. And to call subroutines, you must have an object of the class where the subroutine is declared. And the subroutine should also be public so that any class can access it. Scroll up if you have forgotten how to create an object of a class. If you remembered, the name of the object I declared at the top is ‘c1’ referencing the class named ‘class1’. To call the subroutine ‘insert_records’ from the form load event you’ll just have to double-click on the form that you wish to be called it from then type this line of code.

c1.insert_records()

Make the necessary changes if your object is not called ‘c1’ and your subroutine is not called ‘insert_records’

 

Conclusion

That’s it for part1, I hope you learned something. And please share this post using the facebook share buttons and stumbleupon buttons below. ThanksSmile