Showing posts with label Tutorials. Show all posts
Showing posts with label Tutorials. Show all posts

Sunday, March 20, 2011

Show posts from your SMF fourm in your home/index page

SMF forum is quit popular open source forum application used by many websites as their main bulletin board. Some time we need to grab posts,topics from the board and show them on our home/index page or anywhere on our site. To make the things much easier, SMF provides all this in one script where we call a function with arguments and dress it up according to our needs. File is SSI.php and can be found in the root folder of the forum. You can also add extra parameters/piece of code to your SSI.php. In this post i will show you how to retrieve posts from SMF board with additional information like board, post author, date & time plus top poster and board statistics.

Read more

MMA

Monday, July 19, 2010

openSUSE 11.3 installation (dual boot with windows 7)

openSUSE 11.3 is released and many new users will be looking for some simple guide to have a dual boot. I am going to guide you in this article step by step with images showing the executed step that how to install openSUSE with windows 7.

Full guide...

MMA

Monday, November 23, 2009

Wednesday, November 11, 2009

Saturday, October 24, 2009

Email Parsing and download attachment with IMAP in PHP

Last couple of days, i was working on a script where i need to download an attachment from a windows mail server and then read the contents inside the attachment and save it in database.

Tasks:
1- Read all unseen messages in the inbox.
2- Search for a specific subject.
3- Download the attachment(zip file) to local PC.
4- Unzip the file and extract the file inside it.
5- Read its contents inside the file.
6- Save the contents to a table(MySQL database).
7- Delete the extracted file after saving entries into table.
8- Move the zip file to a backup directory.
9- Do calculations on the data saved in the table.

Actually i had to do this for one of my project, where the sensors gateway will send mail to the windows server each hour, and i have to read the mail from a Linux machine.

As most of the work is completed on these scripts, i tested it under cron on local PC, and is working like a charm. So i am thinking to share the scripts with the community, maybe would help someone in the near future.

I have written 3 PHP scripts(pure PHP) with some MySQL tables to use for data saving.
I will start in the next post from the 1st script which is mail_parsing.php. I used PHP IMAP function to access the mail server.

Until then have a good time.
See you in the next post.

ANL

Monday, October 12, 2009

Listbox values in PHP with MySql

Today got some free time to write a simple tutorial for PHP with MySql for listbox.
So lets start.

Mostly we use drop down on many occasions, populated from database dynamically or giving it values statically. And then use PHP code to parse it and store it in database or get our desired results.
One type of that dropdown is listbox, where we can select multiple entries.
Here is a sample example of it:


In the above code:
multiple: represent multiple list for values
size: will show 2 values in the list, and others will be shown by scrolling.
name: is holding name in array.

Now lets take a MySql example:


Now lets jump to PHP to get the desired results.
There are many ways to get the results like:
foreach, for and etc. As we know, POST is also an array. So the best bet is to use array.

$drop_list = $_POST['drop_list'];
$_SESSION['drop_list'] = $drop_list;
if (in_array(1, $drop_list)) { //id 1
$query1 = "SELECT * FROM test2 where id='1'";
$res1 = mysql_query($query1) or die(mysql_error());
//You can do some other stuff here too
}


You can use multiple if statements to verify the variable resulted value.
You can save the value in session to use it globally in your scripts.
Example:
if (in_array(2, $drop_list)) { //id 2
$query1 = "SELECT * FROM test3 where id='2'";
$res1 = mysql_query($query1) or die(mysql_error());
//You can do some other stuff here too
}
if (in_array(3, $drop_list)) { //id 3
$query1 = "SELECT * FROM test4 where id='3'";
$res1 = mysql_query($query1) or die(mysql_error());
//You can do some other stuff here too
}


Apart from the above example, there are many ways like foreach, if you don't want to just use one by one. Like:

foreach($_POST['drop_list'] as $drop_list){
//Do your stuff here like, updating multiple records at one shot.
}


Best of luck.
ANL

Saturday, August 22, 2009

Install Flash 64bit in Linux

Its still in alpha stage but works very well.
So i am going to write a simple howto here. As this tutorial will cover openSUSE distro. But the basic steps are the same for other distros also.

openSUSE:
1. Remove all installed flash related packages in YaST software management.
2. Download the file from here:
Adobe Labs Site
3. Extract the plugin, and place a copy of it in /usr/lib64/browser-plugins
Command:
cp libflashplayer.so /usr/lib64/browser-plugins/


Remember to mention the path to plugin, where it is extracted.
4. Restart Firefox. Check that Firefox sees the plugin by looking in the Add-ons.

And that's it.

ANL

Wednesday, August 12, 2009

Solution: Grub issues in opensuse with dual boot(XP, Vista, Win7)

Most annoying issue with dual boot is grub error. Some issues which mean to be grub issues are listed below:
1- Didn't show the grub boot menu.
2- Can only boot to one OS at a time(No choice to choose).
3- The most annoying one is:
- Operating system not found.
4- Grub loading, please wait...
- Error 15

I always do simple grub installation after dual installation, OR after changing the bootloader entries. But that depends if i got into trouble with it.

If you are facing such issues, hope this will help you out.

1- Boot your pc from a live CD.
2- After booting, open konsole(terminal) and became root by:
su -

3- Type:
grub

4- Type:
find /boot/grub/menu.lst

5- Note this line there : (hd0,4)
It may be different for your system.
6- Now type this by using this from above (hd0,4):
root (hd0,4)

7- Type:
setup (hd0)

8- Type
quit

9- Reboot your system
reboot


After restart your boot menu will be there with multiple entries.

Last updated: 30-08-2010


ANL

Sunday, July 5, 2009

Install MS fonts in openSUSE 11.1

Some time we need to use fonts like: new times roman and arial and verdana.
These fonts are not available by default in openSUSE. So we need to install them manually.
Its easy to install, just some basic steps and we will be done.

So lets start:
1st of all we need cabextract, by default it will be installed in openSUSE 11.1 version, but if not then install it by this way.

Open terminal and become root by su and then password.
type:
zypper in cabextract


Now we will use 10.3 script to install the fonts, i had checked it and its working fine.
type:
wget http://download.opensuse.org/update/10.3/scripts/fetchmsttfonts.sh

Now type:
chmod a+x fetchmsttfonts.sh

Now last time type:
sh fetchmsttfonts.sh


And it will install MS fonts for you, to check, open openoffice writer and you will see all fonts there.

ANL

Friday, June 26, 2009

Howto: Login screen gone [solution in openSUSE (kde4)]

Howto:
There are two ways to sort out this type of issues, If your login screen gone, and you can't see your login screen anymore.

1st Solution is:
1- Login with your username and password from command based screen.(You can use failsafe OR your normal one).
2- type:
startx

Hit enter, and you will be able to go to desktop.
3- After this, change the theme from YaST->system->/etc/sysconfig Editor->Desktop->Display manager->DISPLAYMANAGER_KDM_THEME.
There will be two DISPLAYMANAGER_KDM_THEME, choose the middle one.
and enter your desired working theme name and hit ok.
4- Logout from here.
5- Restart.

2nd Solution is:
1- Login with root from command based screen.(You can use failsafe OR your normal one).
2- type this:
vi /etc/sysconfig/displaymanager

3- search for line like this:
DISPLAYMANAGER_KDM_THEME = "true-nature"
true-nature is theme name.just for example i put it there.
4- Change it to your desired one:
DISPLAYMANAGER_KDM_THEME = "oxygen"
5- Save the file.
6- Reboot.
Howto save in vi: To change any text, use 'i' to insert any text, hit ESC to end writing, and then hold left shift+z(hit twice). And your changes will be saved.

And that's it. You are done.

ANL

Monday, June 8, 2009

Dual Boot: install Ubuntu 9.04 beside M$ XP

Hi all,
Today i am going to write a simple and easy tutorial fro beginners, that how to install Ubuntu with M$ XP already installed on your machine.
Before starting the points, user should be sure, that there is enough space which will be unallocated.
For doing all these, you can use software like "Partition magic" in XP. We need around 20GB space.
I am not going into more details about "partition magic" here, that how to do that. You can search web for it, Google is your friend in this. OR you can use the help file from partition magic itself.

So lets start...
1st of all boot from LIVE Cd of Ubuntu 9.04, which i think you already have now. If not, then you can download it from Ubuntu website. Download page here.

NOTE: Sorry, i don't have snapshots for it this time, next time i will try to put snapshots too. But hope, his guide will be easy enough without snapshots.
1- After booting from LIVE cd, click on "install" icon which is on desktop. and select your language and press "forward" button.
2- Select time zone region and click "forward".
3- In this step, select your keyboard type, usually it is 'USA' and click "forward".
4- The next screen is about the partitioning. Choose "Specify partitions manually" and click "forward".
5- This screen will show you the partition structure.
We will create two partitions on the unused free space with swap (2GB).
- One for root file system (around 10GB)
- 2nd for home. (4GB)
At the time of installation my partition looks like this:
sda1 ntfs (this is drive C by default)[windows]
sda5 ntfs (this is drive D)[windows]
free space
I had 16GB to distribute among swap,root,home.
i- 1st create swap, just select the free space and click on new partition.
Swap is always double of your RAM, or equal but not less. I choose 2GB, my RAM is 1.5GB.
ii- Now create home and then create root.
More details: howto partition:
For each new partition, select the free space. Click on the New partition, then enter size for the current partition. Then choose filesystem, then home or root from the mount point drop down menu.
/ represents root, and /home represents home.
I hope, i make it clear enough to create new partitions.
6- If you are done successfully with the above step, next step is to set mount point for your windows partition.
7- Now select ntfs partition(mostly it is sda1) and click on "Edit partition" and choose:
- Don't change partition size.
- Use as : "ntfs" from the drop down menu.
- Don't tick format partition.
- Set mount point to "/windows".

Till here, you are done with the most complicated part in the installation.
8- Click "forward" to go to the next step.
NOTE: on clicking, it will ask for your D partition(if you have) that it has no mount point. Just ignore it.
9- Enter all details here in this step regarding your profile.
10- In this step you can import data from your windows OS. Its upto you here.
11- Now is the time to click "install". And let Ubuntu do the rest for you.
NOTE: Make sure, that every thing in the setup went fine b4 clicking "install".
12- Restart your machine after the installation process.

And You Are DONE!!!

After Installation:
IMPORTANT: Ubuntu did not create any root password for you by default, i don't know why they did not add this feature.
So to do that, open terminal and type:
sudo passwd

It will ask you for your password, enter your user password. After that enter twice your root password. And that's it.

Hope, this guide will help you through the process of installation.

ANL

Monday, May 25, 2009

Solution for: Screen goes black(sleep) in Mandriva 2009.1

I experienced the above issue with my recently installed Mandriva 2009.1 after updating some packages from Main testing repo.
The issue i face was, the following post i took from Mandriva forum, which i posted there.
I am using 2009.1 KDE 4.2.3 on my laptop with Intel 845 chipest.
I have some problems:
1- While opening video, some time screen goes black, or may be in the middle of a video.
Even the video is running there, bcoz sound is still there. Just the screen shows black.
2- This problem also exists without video. Some time while surfing, working.

And i had no choice except to go tty1 to reboot the system. Facing this problem from last 4 days. And facing it twice and thrice a day.

Yesterday i update the system from main testing repo, and there were some updates for intel card. But after that also i face this problem.
I updated it from testing repo in this hope, that it will solve the problem. But the problem is still there.
I disabled Mian testing repo after updating.


Now lets come to the solution part. It was a bit easy task to overcome this problem.
For the current session, open terminal and type the following and then hit Enter.
xset -dpms

Now to avoid this sleeping problem next time, do the following:
1- open .bash_profile file from your home directory.(view->show hidden files)
2- and put the same command above at the end and keep one line blank after that command.
It should be like this:
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME
xset -dpms


This will not effect your screen saver, i tested this.
DPMS is standby, suspend and off.
To stop screen saver put this at the end of that file:
xset s off

Screen saver will not effect any thing, mean the sleeping problem(black). So its upto you now.

NOTE: I will update this post time to time for further updates regarding my laptop. That what is the result after that command.

References:
Mandriva Forum post
Bugzilla


UPDATE-1: Today (26-05-2009) at 5PM, i face this problem again, but this time the screen goes white and i had to restart it by the old way again, i am working on it. Will come back with solution soon.

UPDATE-2: Today (28-05-2009), I update the Intel driver on 26-05-2009 from Main test repos and until now no more black or white screens.

ANL