Apr 14, 2009

This is a small and simple tutorial that will explain how to create a image gallery for your site.

The code is below and explanation then follows:

<html>
<head>
<title> An image gallery </title>
<style type="text/css">
body{
font-weight:bold;
margin-left:10%;
margin-right:10%;
margin-bottom:10%;
font-family:sans-serif;
border:10px solid black;
}
</style>
</head>
<body>

<?php
$i=0;
//replace with your own directory here
$dir="images/";
$dh=opendir($dir);
while($filename=readdir($dh))
{
$filepath_c=$dir.$filename;
if(is_file($filepath_c) and preg_match("#\.jpg$#",$filename))
{
$gallery[$i]=$filepath_c;
$i=$i+1;

}
}

sort($gallery);
foreach($gallery as $image)
{
$name=basename($image);
echo "<br/> <br/>" ;
echo "<hr />";
echo "<a href='$image'> image $name <br/>";
echo " <img src='$image' align='middle' alt='image $image' width=200 hieght=200 /> </a>";
echo "<br/>";
}

?>

</body>
</html>


Explanation:

The code is quite simple in the start a simple style tag, defines how the web page must be displayed and after that the main logic lies in the php code . We initialize a variable i for loop execution although it is not required but makes code more clearer.

We then define the directory under which files are stored replace the directory name /images.
with your own directory
Then we open a directory handle and read all the files under it by using readdir( ) function
we check whether its a file or not and use preg_match() for pattern matching

note: preg_match is a regular expression matcher in php, it requires a regular expression pattern and a string to match with.
In this case that string happens to be the entire filepath and the pattern is delimited by # and "#\.jpg$" signifies that only take files ending with .jpg extension you can remove this if you have no other file in your images directory

finally we sort the array obtained and then in foreach loop keep on adding image tags with the filename. Thats it a simple image gallery using php.

Do comment if post was helpfull.

Posted on Tuesday, April 14, 2009 by Unknown

To create a clan configuration file that is a file executed at start of the clan match is very simple and straightforward, you just have to use the wait command that is like a null command that delays the execution by a specific amount of time, also you need to create an alias for the wait command to avoid repeating it.

Assigning alias: alias means assigning a new name to a command we use alias to make less repetitions while writing the clan configuration.

Sample Script :

//here we have used wait command 10 times and assigned an alias w10
alias w10 "wait;wait;wait;wait;wait;wait;wait;wait;wait;wait"
//now you can use w10 several times and write your own text
w10
w10
w10
w10
say -----
w10
w10
w10
w10
say -------------
w10
w10
w10
w10
say -----
w10
w10
w10
w10
say --------Welcome To This server-----------
w10
w10
w10
w10
say ----------Live after 3 restarts------------
w10
w10
w10
w10
sv_restartround 1
w10
w10
w10
w10
sv_restartround 1
w10
w10
w10
w10
sv_restartround 1
w10
w10
w10
w10
say >>>>>>>>>live>>>>>>>>>
w10
w10
w10
w10
say >>>>>>>>>live>>>>>>>>>>
w10
w10
w10
w10
say >>>>>>>>>live>>>>>>>>>>
w10
w10
w10
w10
say enjoy :-)

Posted on Tuesday, April 14, 2009 by Unknown

Did you accidentally change the wordpress site and home url and now cannot access the site.

Well there are a number of scripts that can reset those options and are openly available, but i will be discussing how to directly reset those option in the mysql database and also by this method you can change any wordpress option easily and fastly.

Following are the steps to reset the siteurl and home :

1. Login to mysql wordpress database(i.e the database that you made for wordpress) using your user name and password.

2.Then type the following command to view the siteurl and home page that you setup incorrectly:
SELECT *FROM wp_options where option_name='siteurl' or option_name='home';

3. Having seen what you have entered incorrectly type the following command ( i am assuming your site and home url to be abc.com replace with your own sitename and home page url).

a) //this resets the home url to abc.com
update wp_options set option_value='http://abc.com' where option_name='home'

b)
//this resets siteurl to abc.com
update wp_options set option_value='http://abc.com' where option_name='siteurl'


4.This resets the site url and home page url you can view the changes by executing the command aforementioned in the second step.

Note: This process can me made even more naive if you have mysql query browser which is a Gui based utility where by you can directly edit the options without executing a single command (it will do so on its own).

Posted on Tuesday, April 14, 2009 by Unknown

The task manager is good utility to view and end processes in windows xp but where it fails is in enumeration and displaying information about the running system processes like svchost and the services which are running under that.
But windows provides a good command line utility for exploring processes and the sub processes running under it, this utility is called tasklist.

For example: tasklist /SVC will display the services running under a process which it normally won't do.

Note:To get more info about any windows command type command name, give a space append it with /? for example if you want to view the help for directory command type dir /? it will display what we call man page in linux based systems.

Also a good utility to have when you are not sure what processes are running (maybe trojans,viruses) is Process Explorer which displays information about each process, The dlls (dynamic link libraries) that it uses for running, memory image path, etc. This can be downloaded from here

Posted on Tuesday, April 14, 2009 by Unknown

The following commands are very usefull for updating ubuntu packages, installing new packages, removing packages etc when Gnome package manager gets buggy.

Just open the terminal and try the following.

1. For updating ubuntu: sudo apt-get update (no need for typing sudo if you are super user)

2. For installing a new package: sudo apt-get install package_name (here it allows wildcards like *) this searches the ubuntu repository for the package name and if present installs the package.

3. For removing the package: sudo apt-get remove package_name. It removes the package from the directory that is dedicated for storing packages in ubuntu.

Posted on Tuesday, April 14, 2009 by Unknown

This can be done in two ways manually or by using the registry key.

1. Manually: In this follow these steps:
a) Go to the windows xp run prompt (winkey + r).
b) Type regedit.
c) Expand the key [HKEY_CLASSES_ROOT\Folder\shell].
d) Right click and choose new key and then enter command_prompt_here as its name.
e) Right click the command_prompt_here key and choose new key and enter command
as its name.
f) Right click the command key and choose new string value.
g) Type cmd.exe /k \"cd %1\"" and exit you should now have a menu containing it.

2. By using the registry key.
a) Download this key or alternate link and extract and double click on it, It will then be
inserted automatically into the the winxp registry.

Posted on Tuesday, April 14, 2009 by Unknown

It's a uber cool open source music player with itune like features developed by Mozilla but what makes it real cool is it has integrated web browser like mozilla firefox so you can surf while listening to the music and especially for those people with small size of ram memory and slower cpu's which leads to frequent interrupts in music when you open both your browser and the music player, Its a must have.

Besides this it also provides cool addons that normal music player do not provide like:

1. Media Flow : It provides an easy to navigate media view by which one can just slide through the album art and

2. Lyrics Master: It provides the lyrics of the soundtrack the user is cuurently listening to with options to save it.

3. Album Art Manager: This addon supplies the missing artwork of the album.

It also has the following integrated features.

1. Shout Cast Radio: This provides streaming of live music streams.

2. Concert Tickets: By this one can view upcoming concerts for the artists in your library

3. Mash Tape: By this one can Discover Flickr photos, YouTube videos, last.fm biographies, Google news of the currently playing artist.

Visit songbird home for more info.

Following is the snapshot of the player :



Posted on Tuesday, April 14, 2009 by Unknown

USB Errors

->>> does your usb hang your pc on boot.
the problems are of two types:
1.software problems (win xp,bios)
2.hardware problems.

1.Software problems
a) XP drivers problem :- in such a case go to my computer right click
and select properties -> hardware ->device manager, expand the usb
controllers option and uninstall each of them by right clicking and
selecting uninstall and then select scan for hardware changes and
the usb device may start working,if this does not work update your
drivers form the site of your motherboard manufacturer.
b) BIOS problem :- On boot menu press f12 or del depending upon ur bios,
and disable the "usb legacy support " press f10 to save and exit.
reboot and your device will work.If it does not then change the
interrupt assignment from "auto Escd" to "manual" then press
f10 and then reboot ( what this does is it reassigns interrupt
numbers to the ports in case your bios is having problem in assigning
interrupt numbers)
This should fix your problem.

2. Hardware problems :- Refer to your mother board manual and change
the usb jumpers (refer to usb device wakeup section of the manual)
to +5v and check all the connections of usb check whether
wire connection is proper (refer to connectors-> usb header)
and connection to the ground pin is proper.

Enjoy :) hope this helps.

Posted on Tuesday, April 14, 2009 by Unknown