Alaa Abdelhaq Blog
13 Jul
let say you have a group of radio buttons sharing the same name attribute for sure, and upon submit or some event you want to check if one of these radio buttons was checked or not.
you can do this simply by the following code.
$(document).ready(function(){ $('#submit_button').click(function() { if (!$("input[@name='name']:checked").val()) { alert('Nothing is checked!'); return false; } else { alert('One of the radio buttons is checked!'); } }); });
hope this will help you
20 Jan
You are having hard time with mysql datetime format? I wont blame you ![]()
I hope this short example will help you.
let say in your mysql database you are saving time on the datetime format
like this “2009-01-20 02:11:05″.
you need to pull it and add some days or time intervals and print it in a different format, thats easy do the following
1- In your query pulling the time, pull it this way:
UNIX_TIMESTAMP(time) AS time
this will covert it into unix timestamp, which will make it easier for you to manipulate it with php functions.
2- Add your time interval, let say we need to add 15 days.
$unix_timestamp_from_database = 1232410265; $time_from_db = $unix_timestamp_from_database; $new_time = $time_from_db + (15 * 86400);
86400seconds equals one day.
In unix timestamp we manipulate time by seconds.
so if you want to add an hour you add it like by (60 * 60)
which equals 3600 seconds.
3- Then you format it as you desire:
$new_time_format = date("d-M-Y", $new_time); echo $new_time_format;
hope it will help you
17 Nov
Sometimes working on web design may not be as easy as you think.
Specially when it comes to browsers compatibility.
things get tricky and difficult with the lack of HTML CSS and Javascript debuggers like firebug on
other browsers specially IE!
plus you are working under your favorite OS, so it gets harder to test your work on different browsers and different platforms?
By surfing the web I came by chance with this incredible website LINK
How it helps you?
simply click on the link place your website address
then check the browsers you want to check under different platforms.
next you can put some rules like the preferred resolution you want the test to be ran under.
then you submit it.
Next the website will show you exactly how your website will look on the selected browsers.
it will get you results as a png images, yes images!
maybe some people wont like the service, for me if I was able to check exactly how my website looks on each browser that would be great, and maybe helps me to decrease bounce rate
give it a try
26 Aug
Building websites with a lot of client script like javascript may be a nightmare sometimes!
there is a big possibility that the client disabled the javascript by mistake or does not know whats javascript is!
so am wondering when browsers like firefox IE or Opera will make javascript support as an mandatory thing, and the end-user will never ever be able to disable it?
or what could replace javascript??
17 Aug
At first I should define, what is mod_rewrite?
mod_rewrite is a part of Apache server that can rewrite requested urls on the fly.
To enable mod_rewrite in Ubuntu, you just need to write this command in terminal
sudo a2enmod rewrite17 Aug
This post will help you to install ffmpeg and compile it with some important codecs.
First, get your dependencies:
sudo apt-get build-dep ffmpeg sudo apt-get install liblame-dev libfaad2-dev libfaac-dev libxvidcore4-dev liba52-0.7.4 liba52-0.7.4-dev libx264-dev checkinstall build-essential subversion
Next, grab the ffmpeg source:
svn checkout -r 8998 svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
If you’re feeling adventurous, you can try the very latest code by omitting the -r 8998 part of that line. Revision 8998 is the latest at the time of writing, and worked for me.
Now you can configure and build ffmpeg. This takes a little while:
cd ffmpeg ./configure --enable-gpl --enable-pp --enable-libvorbis --enable-libogg --enable-liba52 --enable-libdts --enable-dc1394 --enable-libgsm --disable-debug --enable-libmp3lame --enable-libfaad --enable-libfaac --enable-xvid --enable-pthreads --enable-x264 make
Finally, install it.
checkinstall
gives you the option to edit some parameters: I set the name to ffmpeg and the version to 3:0.svn20070511
sudo checkinstall16 Mar
To get the user’s IP use the following script:
<?php GetHostByName($REMOTE_ADDR); ?>
To get the user’s computer name use the following script:
<?php gethostbyaddr($_SERVER['REMOTE_ADDR']); ?>
Recent Comments