Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Wednesday, September 26, 2012

HL7 (Health Level Seven)

HL7 (Health Level Seven)
HL7 (Health Level Seven) provide a framework (and related standards) for the exchange, integration, sharing, and retrieval of electronic health information. Most healthcare IT professionals are using HL7 format for data exchange. 

While working with HL7 format, it basically encode the data, the receiving end of encoded data decode the data and perform the process that data accordingly.

Tuesday, September 25, 2012

Change system Password using Command Prompt

We can change the system password using command prompt. To change the password, you must be logged in as administrator and run "net user" command to change the password of a user.


    net user user_name new_password
Example:
    net user gaurav saini

Thursday, September 20, 2012

MySQL's REPLACE()


We are in habit of using str_replace() of PHP, but MySQL also provide replace function for same purpose. 
The REPLACE() function takes three parameters: 



  • The string or column name to do the replacement on 
  • What to look for 
  • What to replace it with

    SELECT REPLACE('My name is garav', 'garav', 'Gaurav.') as result;
    result: My name is Gaurav.

Working days b/w two days & Weekends b/w two dates



MySQL is very rich with built in function as it have thousands of functions. But apart from this rich library sometimes we need to create some custom function to get the task done. Today I encountered same kind of situation. I need a function which can return no. of working days between two dates and it should also return the weekend days between two days. Here is the solution for this problem. I created a user defined function to calculate working dates between two dates. 

Allow or Block IPs Address - .htaccess Security


Hypertext Access, commonly shortened to htaccess, is a configuration file which controls the directory it is placed in and all the subdirectories underneath it. It's an incredibly useful feature which allows webmasters to control how many aspects of their website works. You can 301 redirect pages, change the extensions of pages, rewrite urls for better keyword ranking presence, password protect directories, Error 404 Document redirect and much much more. .htaccess provide security to allowing and blocking access to a web server from a IP address. Reasons for doing this include: 

Password Protection on Directory Using .htaccess


Password Protection on Directory Using .htaccess
If your files are not protected then one must think over the protection of the file. Protection can be provided in various ways like PHP login page, but it will not protect your documents, images and other media. We can protect the files using .htaccess protection. The system requires two files -- the .htaccess file and .htpasswd file. 

Wednesday, September 19, 2012

Prevent Directory Listings using .htaccess


Prevent Directory Listings using .htaccess
In current scenario, preventing a directory listing for your website is must. To prevent the directory listing, you just need to write one simple line in your .htaccess file and your directory structure is unvisible.



  Options -Indexes


Make it a habit to prevent your directory listing.

Setting up Directory Home page (Index page) Using .htaccess

Setting up Directory Home page (Index page) Using .htaccess
Apache server is usually set to index.php or index.html. Good practice to set your DirectoryIndex setting in your .htaccessfile. If we want to set any other file except index.php or index.html then we can achieve this using .htaccess


   DirectoryIndex index.php index.html index1.php


Block Unwanted Referrers - .htaccess

If we want to block some unwanted referrers then we can achieve it with small bit of .htaccess code and mod_rewrite.

   RewriteEngine on
   RewriteCond %{HTTP_REFERER} digg.com [NC]
   RewriteRule .* - [F]

Detect Android with PHP, Javascript & .htaccess

Android is a Linux-based operating system, designed primarily for touchscreen mobile devices such as smartphones and tablet computers. Andriod is initially developed by Android, Inc. 
While working in web technology environment, many times we came accross the situation where we need to detect that if it is Android is not. This detection can be done in multiple ways like: 
1. Using PHP 
2. Using Javascript 
3. Using .htaccess 
It totally depends on the interest of developer, which mechnaism he/she choose to detect android.

Tuesday, September 11, 2012

Basic Linux Commands for Developers


Linux is a kernal but it commonly known as Operating System. Linux provide two interfaces: 
a. Command Line Interface (CLI) 
b. Graphical User Interface (GUI) 

In Command Line Interface, we generally use commands. Here is a collection of basic linux commands. 

MySQL Cursors


Cursors are basically named SQL statement which we can be defined in our procedures. We can then easily look at the contents of the cursor by fetching the records from it. It’s a way for us to get information from our tables in one big chunk and then work on it. As always there is no better way to find out about them than actually doing one but because cursors require a little more code than things we have looked at previously we will need to look at the various stages before writing a procedure which uses cursors.

MySQL Stored Procedures


MySQL 5.0 finally introduces functionality for Stored Procedures. But there is always a question in our mind that what are stored procedures and why we use them. When we can use queries then what is the advantages of stored procedures?
The answer is very simple.
A stored procedure is simply a block of code that is stored on the database server.
Advantages of stored procedures?
  • When we are working with stored procedures, we kept our logic on database server in compiled form. We need not to compile our queries every time. When we user queries in our code, then every time the query get compiled and after that the query return the results to the application. but when we use stored procedure, we compile the query only once and can call our stored procedure any time.
  • Stored procedures can reduce network traffic. When we have to do some complex and repetitive task on the results and again we have to again apply some other logic to get more result then it will be good to use stored procedures.

Reload page using PHP

Sometimes we need to reload any page using php.





    $sec = "10"; // Time in seconds
    $url = "http://www.google.com";
    header("Refresh: $sec; url=$url");

Stop caching using PHP

A cache is a temporary storage area. For example, the files you automatically request by looking at a Web page are stored on your hard disk in a cache subdirectory under the directory for your browser. When you return to a page you've recently looked at, the browser can get those files from the cache rather than the original server, saving you time and saving the network the burden of additional traffic. Sometimes we don’t need caching at any particular page. We can stop caching using PHP.

Request Detection for Mobile Application

Market for mobile application is growing with a great speed. Even there are lots of mobile application created in PHP itself. Sometimes, we have common application for web and mobile but need to detect the mobile devices before rendering the content. Here is a useful code snippet to detect the source of request for application using PHP. If application is requested by any mobile device then the function will return true else it will return false.