Tuesday, January 20, 2009

Repairing Windows

You need to get a Windows XP from someone and follow these instructions:
Windows could not start because the following files is missing or corrupt
\WINDOWS\SYSTEM32\CONFIG\SYSTEM or \WINDOWS\SYSTEM32\CONFIG\SOFTWARE

1. Insert and boot from your Windows XP CD.
2. At the first R=Repair option, press the R key
3. Press the number that corresponds to the correct location for the installation of Windows you want to repair.
Typically this will be #1
4. Enter in the administrator password when requested
5. cd \windows\system32\config
6. Depending on which section was corrupted:
ren software software.bad or ren system system.bad
7. Depending on which section was corrupted
copy \windows\repair\system
copy \windows\repair\software
8. Take out the CD ROM and type exit

If that doesn't work or you can't get into the repair console then With the XP disk you choose to install Windows XP and when you choose to install over the current XP installation you will be given the option to repair the current Windows installation and you won't lose all of your data.

Sunday, December 28, 2008

MSSQL Restore

After doing the restore, use the sp_change_users_login with the auto_fix option to fix the users.

Friday, November 21, 2008

Helpful UNIX commands

VI:

In vi, to copy the whole line and have it repeated (I use when doing mass mv or cp commands)

:%s/.*/& &/

REDIRECTION:

Dump to a file:

ls -1a > output.txt

Append to a file:

ls -1a >> output.txt

Redirect standard error:

ls -1a 2> error.txt

Run a script to redirect to a file AND show on the screen:

ls -1a | tee -a output.txt


MySQL: Master Master Replication

This is a copy of the following site

MySQL Master Master Repliction Tutorial


This tutorial describes how to set up MySQL master-master replication. We need to replicate MySQL servers to achieve high-availability (HA). In my case I need two masters that are synchronized with each other so that if one of them drops down, other could take over and no data is lost. Similarly when the first one goes up again, it will still be used as slave for the live one.


Here  is a basic step by step tutorial, that will cover the mysql master and slave replication and also will describe the mysql master and master replication.



Notions: we will call system 1 as master1 and slave2 and system2 as master2 and slave 1.

Step 1:


Install mysql on master 1 and slave 1. configure network services on both system, like

Master 1/Slave 2 ip: 192.168.16.4

Master 2/Slave 1 ip : 192.168.16.5

Step 2:


On Master 1, make changes in my.cnf:

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
old_passwords=1


log-bin
binlog-do-db=<database name>  # input the database which should be replicated
binlog-ignore-db=mysql            # input the database that should be ignored for replication
binlog-ignore-db=test

server-id=1

[mysql.server]
user=mysql
basedir=/var/lib

[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Step 3:


On master 1, create a replication slave account in mysql.

mysql> grant replication slave on *.* to 'replication'@192.168.16.5 \
identified by 'slave';

and restart the mysql master1.

Step 4:


Now edit my.cnf on Slave1 or Master2 :

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
old_passwords=1


server-id=2

master-host = 192.168.16.4
master-user = replication
master-password = slave
master-port = 3306

[mysql.server]
user=mysql
basedir=/var/lib

[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Step 5:


Restart mysql slave 1 and at

mysql> start slave;
mysql> show slave status\G;


*************************** 1. row ***************************

Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.16.4
Master_User: replica
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: MASTERMYSQL01-bin.000009
Read_Master_Log_Pos: 4

Relay_Log_File: MASTERMYSQL02-relay-bin.000015
Relay_Log_Pos: 3630
Relay_Master_Log_File: MASTERMYSQL01-bin.000009
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 4
Relay_Log_Space: 3630
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 1519187



1 row in set (0.00 sec)

Above highlighted rows must be indicate related log files and  Slave_IO_Running and   Slave_SQL_Running: must be to YES.

Step 6:


On master 1:

mysql> show master status;
+------------------------+----------+--------------+------------------+
| File                   | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------------+----------+--------------+------------------+
|MysqlMYSQL01-bin.000008 |      410 | adam         |                  |
+------------------------+----------+--------------+------------------+
1 row in set (0.00 sec)

The above scenario is for master-slave, now we will create a slave master scenario for the same systems and it will work as master master.

Step 7:


On Master2/Slave 1, edit my.cnf and master entries into it:

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
server-id=2


master-host = 192.168.16.4
master-user = replication
master-password = slave
master-port = 3306

log-bin                     #information for becoming master added
binlog-do-db=adam

[mysql.server]
user=mysql
basedir=/var/lib

[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Step 8:


Create a replication slave account on master2 for master1:

mysql> grant replication slave on *.* to 'replication'@192.168.16.4 identified by 'slave2';



Step 9:


Edit my.cnf on master1 for information of its master.

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock


# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

log-bin
binlog-do-db=adam
binlog-ignore-db=mysql
binlog-ignore-db=test

server-id=1
#information for becoming slave.
master-host = 192.168.16.5
master-user = replication
master-password = slave2
master-port = 3306

[mysql.server]user=mysqlbasedir=/var/lib

Step 10:


Restart both mysql master1 and master2.

On mysql master1:

mysql> start slave;



On mysql master2:

mysql > show master status;



On mysql master 1:

mysql> show slave status\G;



*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.16.5
Master_User: replica
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: Mysql1MYSQL02-bin.000008
Read_Master_Log_Pos: 410
Relay_Log_File: Mysql1MYSQL01-relay-bin.000008
Relay_Log_Pos: 445
Relay_Master_Log_File: Mysql1MYSQL02-bin.000008
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 410
Relay_Log_Space: 445
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 103799
1 row in set (0.00 sec)


ERROR:
No query specified

Check for the hightlighted rows, make sure its running. Now you can create tables in the database and you will see changes in slave. Enjoy!!

Tuesday, October 21, 2008

Monday, September 29, 2008

Shortsightedness by the Democrats

The following is a 2004 video about the potential problems at Fannie Mae and Freddie Mac.

Politicians saw this problem coming.  Don't listen to their lies now.

Thursday, September 18, 2008

Proof Christ was the Jewish Messiah

Judaism commonly uses the term Tanakh to refer to its canon, which was later adopted as the Christian Old Testament. In academic circles, the term Hebrew Bible is commonly used to refer to the Tanakh or Old Testament.

With the above in mind, I will use the Old Testament to prove Christ is being spoken of and cross reference the New Testament.  The most notable section of scripture in the Old Testament that speaks of Christ's crucifixion is Psalm 22.

VIRGIN BIRTH
Isaiah 7:14 - Therefore the Lord himself will give you a sign:  The virgin will be with child and will give birth to a son, and will call him Immanuel.
Matthew 1:23 - "The virgin will be with child and will give birth to a son, and they will call him Immanuel"  - which means, "God with us."

CRUCIFIXION
Psalm 22:1
- My God, my God, why have you forsaken me.
Matthew 27:46 - About the ninth hour Jesus cried out in a loud voice, "Eloi, Eloi, lama sabachthani?" - which means, "My God, my God, why have you forsaken me?"

Psalm 22:7 - All who see me mock me; they hurl insults, shaking their heads
Matthew 27:39 - Those who passed by hurled insults at him, shaking their heads

Psalm 22:8 - "He trusts in the Lord; let the Lord rescue him.  Let him deliver him, since he delights in him."
Matthew 27:43 - He trusts in God.  Let God rescue him now if he wants him, for he said, "I am the Son of God."

Psalm 22:16 - Dogs have surrounded me; a band of evil men has encircled me, they have pierced my hands and my feet.
John 20:27 - Then he said to Thomas, "Put your finger here; see my hands.  Reach out your hand and put it into my side.  Stop doubting and believe."

Psalm 22:18 - They divide my garments among them and cast lots for my clothing.
Mark 15:24 - And they crucified him.  Dividing up his clothes, they cast lots to see what each would get.

SACRIFICIAL DEATH
Isaiah 53:5 - But he was pierced for our transgressions, he was crushed for our iniquities; the punishment that brought us peace was upon him, and by his wounds we are healed.
Romans 4:25 - He was delivered over to death for our sins and was raised to life for our justification.
Luke 23:33 - When they came to the place called the Skull, there they crucified him, along with the criminals - one on his right, the other on his left.

RESURRECTION
Psalm 16:10 - because you will not abandon me to the grave, nor will you let your Holy One see decay
Matthew 28:5-6 - The angel said to the women, "Do not be afraid, for I know that you are looking for Jesus, who was crucified.  He is not here; he has risen, just as he said.  Come and see the place where he lay.