jQuery UI Datepicker: End Date will >= Start Date Solution
dateFormat: 'dd-mm-yy',
minDate: new Date(, , ),
maxDate: '+6m'
});
var $getMinDate = new Date(, , );
function setDef(input, inst) {
var $getCheckOutDate = $('#check_in_date').val();
if($getCheckOutDate != '')
$getMinDate = $getCheckOutDate.split('-');
return {
//minDate: new Date(, , )
minDate: new Date($getMinDate[2], $getMinDate[1]-1, $getMinDate[0])
};
}
$('#check_out_date').datepicker({
dateFormat: 'dd-mm-yy',
maxDate: '+6m',
beforeShow: setDef
});
How to call/bind a jquery datepicker to a image/label/div instead of an input field
$('document').ready(function(){
$('#check_in_date').datepicker({
dateFormat: 'yy-mm-dd'
});
$('#check_in_date_img').click(function(){
$('#check_in_date').focus();
});
});
Markup:
<.. img src="date.gif" alt="Date" id="check_in_date_img" ..>
<..input type="text" id="check_in_date"..>
How to use Flickr API
To do this, you need a Filckr API key. Go to http://www.flickr.com/services/ to get details info.
I have done this to get my uploaded image and here I have used my API key.
function request($params){
$api_key = '9ab63850e3exxxxxxxxxxxxxxxxxxxxx';
$url = 'http://api.flickr.com/services/rest/?' .
'api_key=' . $api_key . '&format=php_serial';
foreach($params as $key => $val){
$url .= '&' . urlencode($key) . '=' . urlencode($val);
}
$resp = file_get_contents($url);
return unserialize($resp);
}
$params = array('method' => 'flickr.people.findByUsername',
'username' => 'shiblydu');
$user = request($params);
echo '
';';
print_r($user);
echo '
$params = array('method' => 'flickr.people.getPublicPhotos',
'user_id' => '42489449@N04'
);
$photos = request($params);
echo '
';';
print_r($photos['photos']['photo']);
echo '
$params = array('method' => 'flickr.urls.getUserPhotos',
'user_id' => '42489449@N04'
);
$url = request($params);
echo '
';';
print_r($url);
echo '
function build_photo_url($p){
return 'http://farm' . $p['farm'] . '.static.flickr.com/' . $p['server'] .
'/' . $p['id'] . '_' . $p['secret'] . '.jpg';
}
foreach($photos['photos']['photo'] as $pp){
// echo '
';';
// print_r($pp);
// echo '
//echo build_photo_url($pp);
echo '';
echo '
';
}
?>
You have to enable javascript to view my webpages :)
And if the developer wish to disallow you anymore without your enabled java script browser then he/she may redirect you using some script in his/her pages like:
1. Use noscript with Meta tag,
2. Set Meta attributes http-equiv="Refresh" content="0; URL=http://google.com"
3. Place the code at the top of the head section.
So, enable your JavaScript if you want to view the pages properly,
or
Search how to enable javascript in browser by google
Ample SDK: Open-Source GUI Framework
Ample SDK is a unique piece of software that runs transparently in the layer between web browser and your application. While running it provides the Logic of your application with standard cross-browser access to the User Interface.
http://www.amplesdk.com/ample/
PHP: Use set_time_limit — Limits the maximum execution time
In case of slow and more time consuming query, several times I have found that, my php script timed out for the slower response of database server. And I could not get the data. Therefore I had nothing to process from the database.
But, If you use set_time_limit, in your php script and set a large time limit in case of slow and time consuming query, your php script will live to get the response and further processing.
The set_time_limit() function only affect the execution time of the script itself.
Example:
set_time_limit(200);
Set the number of seconds a script is allowed to run. If this is reached, the script returns a fatal error. The default limit is 30 seconds or, if it exists, the max_execution_time value defined in the php.ini.
When called, set_time_limit() restarts the timeout counter from zero. In other words, if the timeout is the default 30 seconds, and 25 seconds into script execution a call such as set_time_limit(20) is made, the script will run for a total of 45 seconds before timing out.
From: php manual
MySQL: Use STRAIGHT_JOIN
STRAIGHT_JOIN
forces the optimizer to join the tables in the order in which they are listed in the FROM
clause. You can use this to speed up a query if the optimizer joins the tables in non-optimal orderExample:
SELECT STRAIGHT_JOIN Count(*) AS `CallReportNew.total`, SUM(duration) AS `CallReportNew.total_duration`, SUM(costR1) AS `CallReportNew.total_cost` FROM `calls` as `CallReportNew` IGNORE INDEX (IX_CallsCallStart) LEFT JOIN `resellers1` AS `Reseller1` ON (`CallReportNew`.`id_reseller` = `Reseller1`.`id` ) WHERE `CallReportNew`.`call_start` BETWEEN '2009-07-09 00:00:00' AND '2009-07-09 23:59:59' AND `Reseller1`.`id`=1 GROUP BY Reseller1.id ORDER BY null
MySQL: Optimizing Queries with EXPLAIN
EXPLAINtbl_name
Or:
EXPLAIN [EXTENDED | PARTITIONS] SELECTselect_options
EXPLAIN
statement can be used either as a synonym for DESCRIBE
or as a way to obtain information about how MySQL executes a SELECT
statement: -
EXPLAIN
is synonymous withtbl_name
DESCRIBE
ortbl_name
SHOW COLUMNS FROM
.tbl_name
-
When you precede a
SELECT
statement with the keywordEXPLAIN
, MySQL displays information from the optimizer about the query execution plan. That is, MySQL explains how it would process theSELECT
, including information about how tables are joined and in which order.
With the help of EXPLAIN
, you can see where you should add indexes to tables to get a faster SELECT
that uses indexes to find rows. You can also use EXPLAIN
to check whether the optimizer joins the tables in an optimal order. To force the optimizer to use a join order corresponding to the order in which the tables are named in the SELECT
statement, begin the statement with SELECT STRAIGHT_JOIN
rather than just SELECT
.
If you have a problem with indexes not being used when you believe that they should be, you should run ANALYZE TABLE
to update table statistics such as cardinality of keys, that can affect the choices the optimizer makes.
EXPLAIN
returns a row of information for each table used in the SELECT
statement. The tables are listed in the output in the order that MySQL would read them while processing the query. MySQL resolves all joins using a single-sweep multi-join method. This means that MySQL reads a row from the first table, and then finds a matching row in the second table, the third table, and so on. When all tables are processed, MySQL outputs the selected columns and backtracks through the table list until a table is found for which there are more matching rows. The next row is read from this table and the process continues with the next table.
When the EXTENDED
keyword is used, EXPLAIN
produces extra information that can be viewed by issuing a SHOW WARNINGS
statement following the EXPLAIN
statement. This information displays how the optimizer qualifies table and column names in the SELECT
statement, what the SELECT
looks like after the application of rewriting and optimization rules, and possibly other notes about the optimization process.
From: MySQL 5.1 Reference Manual
MySQL: Make your sql query faster......
tbl_name
[[AS] alias
] [index_hint_list
]index_hint
: USE {INDEX|KEY} [{FOR {JOIN|ORDER BY|GROUP BY}] ([index_list
]) | IGNORE {INDEX|KEY} [{FOR {JOIN|ORDER BY|GROUP BY}] (index_list
) | FORCE {INDEX|KEY} [{FOR {JOIN|ORDER BY|GROUP BY}] (index_list
)index_list
: index_name
[, index_name
] ...By specifying USE INDEX (
, you can tell MySQL to use only one of the named indexes to find rows in the table. The alternative syntax index_list
)IGNORE INDEX (
can be used to tell MySQL to not use some particular index or indexes. These hints are useful if index_list
)EXPLAIN
shows that MySQL is using the wrong index from the list of possible indexes.
You can also use FORCE INDEX
, which acts like USE INDEX (
but with the addition that a table scan is assumed to be very expensive. In other words, a table scan is used only if there is no way to use one of the given indexes to find rows in the table.index_list
)
USE KEY
, IGNORE KEY
, and FORCE KEY
are synonyms for USE INDEX
, IGNORE INDEX
, and FORCE INDEX
.
Each hint requires the names of indexes, not the names of columns. The name of a PRIMARY KEY
is PRIMARY
. To see the index names for a table, use SHOW INDEX
.
Index hints do not work for FULLTEXT
indexes.
Prior to MySQL 5.1.17, USE INDEX
, IGNORE INDEX
, and FORCE INDEX
affect only which indexes are used when MySQL decides how to find rows in the table and how to process joins. They do not affect whether an index is used when resolving an ORDER BY
or GROUP BY
clause.
From: MySQL 5.1 Reference Manual
What is memcached?
memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
Danga Interactive developed memcached to enhance the speed of LiveJournal.com, a site which was already doing 20 million+ dynamic page views per day for 1 million users with a bunch of webservers and a bunch of database servers. memcached dropped the database load to almost nothing, yielding faster page load times for users, better resource utilization, and faster access to the databases on a memcache miss.Useful links;
http://www.danga.com/memcached/
http://en.wikipedia.org/wiki/Memcached
Firebug makes your life easy...:D
Use firebug and taste it's power...:D
From Mozila Corporation we learn:
Firebug integrates with Firefox to put a wealth of web development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page.
here it is....
https://addons.mozilla.org/en-US/firefox/addon/1843
http://getfirebug.com/
Use YSlow to improve your website's performance
YSlow analyzes web page performance and tells you why performance is slow. It is integrated into the Firebug web development tool for Firefox.
Please follow the link:
http://developer.yahoo.com/yslow/
http://developer.yahoo.com/yslow/help/
Why META tags are important????
From Me,
Meta Tags are important to promote your website and help to make your site SEO friendly. You can use different meta attributes as your requirements and take the benefits.......Try and explore them.
From the Internet,
Meta tags are information entered into the <> area of an HTML document They do not display in the browser window. Rather, they give instructions to the browser and allow some degree of control over how your pages are indexed by search engines. Meta tags can also allow the voluntary rating of sites for the benefit of filtering software for adult content such as Surf Watch.
Here some useful links:
http://www.w3schools.com/tags/tag_meta.asp
http://www.life.uiuc.edu/edtech/html/meta.html
http://eis.bris.ac.uk/~cckhrb/webdev/code/html/meta_w3c.htm
http://en.wikipedia.org/wiki/Meta_tag
http://searchenginewatch.com/2167931