/*
change image on mouseover and click
*/
function mEvent(id,img1,img2,img3) {
var i = new String();
i = document.images[id].src;
document.images[id].src = i.replace(img2,img1);
//for click condition
if(document.images[id].src.indexOf(img3)!=-1)
document.images[id].src = i.replace(img3,img1);
}
<IfModule dir_module>
DirectoryIndex index.html index.php index.php4 index.php3 index.cgi index.pl index.htm index.shtml index.phtml
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !(css)
RewriteCond %{REQUEST_URI} !(js)
RewriteCond %{REQUEST_URI} !(images)
RewriteCond %{REQUEST_URI} !(videos)
RewriteCond %{REQUEST_URI} !(cache)
</IfModule>
pdftohtml converters PDF documents into HTML format, which is more suitable for Internet publishing. The converter produces HTML documents with texts, pictures, graphics and bookmarks.
pdftohtml software does not require Adobe Acrobat, or even Acrobat Reader.
Install pdftohtml on Fedora/Linux:
# yum install pdftohtml
# which pdftohtml
Usage: pdftohtml [Option] <PDF File> [<HTM File>]
Source: http://www.verypdf.com/pdf2htm/help/help.html
Pdftk allows to manipulate PDF easily and freely. It does not require Acrobat, and it runs on Windows, Linux, Mac OS X, FreeBSD and Solaris etc.
Features:
- Merge PDF Documents
- Split PDF Pages into a New Document
- Rotate PDF Pages or Documents
- Decrypt Input as Necessary (Password Required)
- Encrypt Output as Desired
- Fill PDF Forms with FDF Data or XFDF Data and/or Flatten Forms
- Apply a Background Watermark or a Foreground Stamp
- Report on PDF Metrics such as Metadata, Bookmarks, and Page Labels
- Update PDF Metadata
- Attach Files to PDF Pages or the PDF Document
- Unpack PDF Attachments
- Burst a PDF Document into Single Pages
- Uncompress and Re-Compress Page Streams
- Repair Corrupted PDF (Where Possible)
Install pdftk on fedora/linux:
# yum install pdftk
# which pdftk
Reading PDF Files
XPDF package includes “pdftotext.” You have to install XPDF/pdftotext then run the following PHP statement to get the PDF text:
$txtcontent = exec('/usr/local/bin/pdftotext phpsolutions.pdf -');
Reading DOC Files
This package is called Antiword. Here’s the PHP code to grab the Word DOC content:
$txtcontent = exec('/usr/local/bin/antiword phpsolutions.doc');
HTMLDOC converts HTML files and web pages into HTML, PostScript and PDF files suitable for on-line viewing and printing. HTMLDOC is used for anything that needs to be viewed or printed including on-line billing, books, financial statements, automated network configuration guides, mailing lists and labels, marketing flyers, quarterly reports, technical manuals, and users manuals. We can use HTMLDOC for all of documentation and reports, and it is the core of our PDF-o-matic demonstration page.
A limited-use open source version is also available at htmldoc.org.
Uses:
# htmldoc --webpage -f output.pdf filename.html ENTER
# htmldoc --book -f 12book.pdf 1book.html 2book.html --titlefile bookcover.jpg ENTER
1.Boot 2 linux servers on EC2
2.Assign elastic IP to each of them
3.Register a domain (eg phpsolutions.co.in)
4.On the domain settings – create 2 host records – ns1.phpsolutions.co.in and ns2.phpsolutions.co.in and point each record to each of the elastic IPs.
5.On your 2 nameserver instances – create dns zone for ns1. and ns2 respectively
6.Make ns2 a slave of ns1 – you can if you wish add ns3… ns4.. etc etc but its not necessary unless your site is getting millions of users.
7.Boot another EC instance and install the Scalr application.
8.Create a user on ns1. called “named” that has permissions to update the dns zone records on ns1.
9.The DNS settings of the scalr application will refer to the nameservers ns1. with user “named” and password as set on ns1.
10.Your application for example will have the domain phpsolutions.co.in. Register this domain and set its nameservers to your ns1. and ns2 mentioned previously.
11.You need to first create a new zone file on ns1 for phpsolutions.co.in
12.In Scalr when asked for the application domain name – simply enter phpsolutions.co.in – and scalr will handle the rest.
****************************************************************
You will need to register a domain name with a domain registrar. After registering, you will need to enter your NS records for the domain name. The NS records should point to a Domain Name Server (DNS). Most registrars require at least two DNS servers to eliminate a single point of failure.
Some registrars provide free DNS services. If you choose such a registrar, you would need to add a CNAME record for your sub-domain and ask any DNS application support related questions to your registrar.
Alternatively, you can launch and configure your own DNS servers on Amazon EC2. A popular choice for Linux based DNS servers is BIND: http://en.wikipedia.org/wiki/BIND
Another option is to outsource your DNS servers using a third-party provider, for example http://www.dyndns.com/.
http://groups.google.com/group/scalr-discuss/web/how-to-host-your-mx-on-google
Cost: http://bhopu.com/Tags/Amazon-EC2
Age:
Select DATE_FORMAT (NOW(), ‘%Y’) – DATE_FORMAT(BirthDate, ‘%Y’) – (DATE_FORMAT(NOW(), ’00-%m-%d’) < DATE_FORMAT(BirthDate, ’00-%m-%d’)) AS Age From tbl_member where 1;
Change collation:
Alter table `tbl_student` convert to character set utf8 collate utf8_swedish_ci;
Shift mysql column:
ALTER TABLE tableName MODIFY column column_2 int AFTER column_1;
Get video info with user info:
SELECT `video_id` , `video_title` ,
( SELECT userid FROM tbl_members
WHERE `member_id` = v.member_id
) AS owner
FROM `tbl_video` AS v
WHERE 1;
Concat:
Select concat(a.Day,’_’,a.Hour) as IDX From tbl_time;
Switch Case:
SELECT a.id, a.group_name ,
CASE
WHEN a.is_feature= ‘t’ THEN ‘Featured’
ELSE ‘Unfeatured’
END as Featured
FROM `tbl_member_groups` a;
2 Way Friendship:
a)
SELECT CASE WHEN mf.member_id = ‘”78″
THEN mf.friend_id
ELSE mf.member_id
END AS f_id,
(
SELECT name
FROM tbl_member
WHERE mid = f_id
) AS uname
FROM tbl_member_friend AS mfWHERE ( member_id = ’78’ OR friend_id = ’78’ ) AND is_accepted = ‘t’;
b)
SELECT b.ID as us_id,c.ID as ctu,c.Nationality,e.Name as cname, b.Username, d.Name FROM user b
LEFT JOIN teacher c ON b.ID = c.UserID
LEFT JOIN teacher_photo d ON c.ID = d.TeacherID
LEFT JOIN country e on e.ID=c.Nationality
WHERE b.ID
IN ( SELECT CASE WHEN tf.user_id = ‘$ID’
THEN tf.friend_id
ELSE tf.user_id
END AS f_id
FROM friend tf
WHERE (
user_id = ‘$ID’
OR friend_id = ‘$ID’
)
AND tf.`is_accept` = ‘t’ order by tf.date_added desc
);
Join:
SELECT a. * , c.Nationality, e.Name AS cname, b.Username, d.Name
FROM forum_reply a
LEFT JOIN user b ON a.poster_thread_id = b.ID
LEFT JOIN teacher c ON a.poster_thread_id = c.UserID
AND b.ID = c.UserID
LEFT JOIN teacher_photo d ON c.ID = d.TeacherID
LEFT JOIN country e ON e.ID = c.Nationality
WHERE a.thread_id = ‘1’;
Remove duplicate records:
CREATE TABLE new_table AS
SELECT * FROM old_table WHERE 1 GROUP BY [COLUMN TO remove duplicates BY];
Stored Porcedures:
CREATE PROCEDURE simpleproc (OUT param1 INT)
SELECT * FROM testimonial;
CALL simpleproc(@a);
SQL Injection:
Select * from tbl_user where name = ‘pavan’ OR ‘1’ = ‘1’;
Insert Duplicate:
INSERT INTO `teacher_photo` SET TeacherID =7, Name = ‘7-teacher.jpeg’,
FileType = ‘image/jpeg’ ON DUPLICATE KEY UPDATE Name = ‘7-teacher.jpeg’, FileType = ‘image/jpeg’;
Reporting month year wise:
Select count(hits), month(add_date) m, year(add_date) y From ‘sales’ where 1 group by m,y;
Interchange columns values:
Update userinfo set sex = case
when sex = ‘f’ then m
when sex = ‘m’ then f
end;
Case sensitive data:
Select * From member where BINARY uname = “pavan”;
Get third max mark holder:
Select * From ‘marks’ where 1 order by mark desc limit 2,1;
Get duplicate in table:
Select title From ‘books’ group by title having count(*) > 1;
Set Character set to UTF-8:
SET CHARACTER SET utf8;
SET NAMES ‘utf8’;
Check for Online:
SELECT *
FROM tbl_member_groups
WHERE DATE_SUB( CURDATE( ) , INTERVAL 300 MINUTE ) <= date_add;
How to access form’s array element in javascript?
Solution:
<form action=”<?=$_SERVER[‘PHP_SELF’]?>” method=”post”>
<input name=”post[]” type=”checkbox” value=”web” /> Web Post
<input name=”post[]” type=”checkbox” value=”mobile” /> Mobile Post
<input name=”post[]” type=”checkbox” value=”application” />Application Post
<input name=”post[]” type=”checkbox” value=”open” /> Open Source Post
</form>
<script type=”text/javascript”>
for(i=0;i
{
if(document.sv.elements[i].type==”checkbox” && document.sv.elements[i].name==”post[]”)
{
if(document.sv.elements[i].checked==true)
alert(document.sv.elements[i].value);
}
}
</script>
http://kdewebdev.org/
Quanta Plus is a web development tool for the K Desktop Environment. Quanta is designed for quick web development and is rapidly becoming a mature editor with a number of great features and lies at the heart of the KDE Web Dev suite of tools.
http://bluefish.openoffice.nl/
Bluefish is a powerful editor targeted towards programmers and webdesigners, with many options to write websites, scripts and programming code. Bluefish supports many programming and markup languages, and it focuses on editing dynamic and interactive websites.