JavaTechie

Its all about Technology

How to hide Files in a JPEG image September 29, 2008

Filed under: Uncategorized — javatechie @ 7:45 am

create an archive(tar/rar/zip) etc file of the important files which has to be hidden.

then get an jpg image of your interest under which you want to hide the files.

then execute the following COPY command

> copy /b  mysecretfiles.zip secretimage.jpg

b : represents the BINARY mode

it will create a file secretimage.jpg (image file should be there in path)

if u click on that it will be opened in ur default picture viewer

Delete those important files as we are having those in the hidden secretimage
To retrive the contents then open(extract) the file with the zip software that is present

 

Apache HTTPD Virtual Hosts and SSL September 25, 2008

Filed under: Apache, PHP — javatechie @ 6:29 am
Tags: ,

Apache HTTPD Virtual Hosts allow a single server to host many web sites with different addresses.

Virtual hosts are easy to set up, just check the documentation at http://httpd.apache.org/docs/ . That said, there are two main ways to configure virtual hosting, which you have to keep in mind when starting out. One method involves matching the request host name, IP address, port, or any combination of them to a separate block of HTTPD configuration statements. The other method specifies a directory pattern to use for the document root and cgi-bin based on parts of the host name.

For the former method of configuring virtual hosts, all one needs to do is add a wildcard ServerAlias directive to the VirtualHost block for your domain name.

<VirtualHost 1.2.3.4>
 ServerName domain.tld
 ServerAlias *.domain.tld
 DocumentRoot /var/www/
</VirtualHost>

For the latter, all one needs to do is match against only the domain name, or include subdomains in the pattern, making sure to create the appropriate directory structure.

VirtualDocumentRoot /var/www/%-2/
VirtualDocumentRoot /var/www/%-2/%-3/

Web hosts tend to use the larger VirtualHost method. Smaller shops, or generic mass hosts (departmental or employee hosting within an organization,for example) will find the latter very helpful, particularly when serving out of user’s home directories.

All this is great, but what about SSL? You could start up a separate instance of Apache HTTPD to serve over an SSL connection, but you probably don’t want to do that. There are some advantages, which but that is beyond the scope of this piece. The easiest way is to use a VirtualHost block to match against connections on port 443, the default HTTPS port. Contrary to popular belief, you do not need a separate IP address to do this.

<VirtualHost *:443>
 SSLEngine On
 SSLCertificateFile /etc/httpd/ssl.pem
 DocumentRoot /var/www/
</VirtualHost>

This works just fine if you are only serving one site over HTTPS. The problem comes in when you have multiple domain names being served from the same server which need SSL. Since the SSL certificate needs to be used before the web browser sends a request to the server, the server has no way of picking a domain-specific SSL certificate to use. Name-based matching just won’t work for SSL. This is why proprietors of shared web hosting services demand that you purchase a dedicated IP address if you want to use SSL. IP addresses are known before SSL certificates are used, so by matching based on IP address, we can use domain-specific SSL certificates.

<VirtualHost 1.2.3.4:443>
 SSLEngine On
 SSLCertificateFile /etc/httpd/dom1-ssl.pem
 DocumentRoot /var/www/dom1/
</VirtualHost>

<VirtualHost 1.2.3.5:443>
 SSLEngine On
 SSLCertificateFile /etc/httpd/dom2-ssl.pem
 DocumentRoot /var/www/dom2/
</VirtualHost>

So, to recap, you do not need a separate IP address to use HTTPS. You do need separate IP addresses to use HTTPS on servers with multiple domains using SSL.

 

Find absolute path in PHP September 25, 2008

Filed under: PHP — javatechie @ 6:04 am
Tags:

<?php
$p = getcwd();
echo $p;
?>

 

Setting cron job of java program September 22, 2008

Filed under: Java — javatechie @ 1:30 pm
Tags: ,

java -classpath  dir1:dir2:dirofclasses package.classname

if you are using mysql connection then you have to set mysql connectoe classpath also in command

eg:

java -classpath  dir1:dir2:mysqlconnectorpath:dirofclasses package.classname