Publish HTML2PDF


Hits: 1777  

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.

html2pdf
html2pdf

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

Configure Amazon EC2


Hits: 2069  

1.Boot 2 linux servers on EC2
2.Assign elastic IP to each of them
3.Register a domain (eg svnlabs.com)
4.On the domain settings – create 2 host records – ns1.svnlabs.com and ns2.svnlabs.com 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 svnlabs.com.  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 svnlabs.com
12.In Scalr when asked for the application domain name – simply enter svnlabs.com – 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

Mysql useful queries


Hits: 1749  

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 = ‘sandeep’ 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 = “sandeep”;

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;

Form’s array element in javascript


Hits: 1434  

How to access form’s array element in javascript?

Web Post
Mobile Post
Application Post
Open Source Post

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>

HTML WYSIWYG Editor for Fedora


Hits: 1565  

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.

Run C program in Linux


Hits: 1287  

This is the simple C file “svnlabs.c” to execute on linux terminal

#include

int main()
{
int i;
for(i=0;i<=5;i++)
{

printf(”n%d %s”,i,”svnlabs.com”);

}
printf(”n”);
return 0;
}

Output:

[root@localhost ~]# gcc svnlabs.c
[root@localhost ~]# make svnlabs
cc svnlabs.c -o svnlabs
[root@localhost ~]# ./svnlabs

0 svnlabs.com
1 svnlabs.com
2 svnlabs.com
3 svnlabs.com
4 svnlabs.com
5 svnlabs.com
[root@localhost ~]#

Run Java program in Linux


Hits: 1255  

This is the sample java file “Svnlabs.java” to be executed on linux command line…..

import java.lang.*;
import java.io.*;

public class Svnlabs
{

public static void main(String args[])
{
System.out.println(”svnlabs.com”);
}

}

Output:

[root@localhost ~]# javac Svnlabs.java
[root@localhost ~]# java Svnlabs
svnlabs.com
[root@localhost ~]#

wine – run Windows programs on Linux


Hits: 1390  

wine – run Windows programs on Linux/Unix

wine program.exe [arguments …]
wine –help
wine –version

wine loads and runs the given program, where the program is a DOS, Win-       dows 3.x, or Win32 executable (x86 binaries only).

This will display all the output in a  separate  win-dows (this requires X11 to run).

Install wine on linux (RedHat, Fedora, CentOS…)

# yum install wine

# man wine

Example:

# wine /opt/test.exe

Xmanager


Hits: 1818  

Xmanager is a powerful and easy-to-use PC X server that runs on Windows platforms. It allows you to bring remote Unix/Linux desktops to your Windows PC seamlessly. You can also run remote X applications securely through the SSH (Secure Shell) protocol even when your Windows PC is inside a private network and a firewall is between your PC and the remote server.

Xmanager is used in various fields of work including large-scale craft and semiconductor designing and server management in an IDC (Internet Data Center). It is widely used by server administrators of universities and corporations, and personal users who simply want to connect to remote hosts over the internet. Xmanager is an easy and powerful PC X server designed to satisfy the needs and wants of these various users.

Source: http://www.netsarang.com/products/xmg_detail.html