Pages

C3 Health Services

Visit Official Website 9278982994

Expert Healthcare at Your Doorstep

Monday, 25 February 2013

Commonly Used Phrases and Sentences By Software Developers

Commonly Used Phrases and Sentences By Software Developers

In a software company, while developing application, software developers come under different circumstances in which they have to save themselves and blame others(blame game), they have to boast and bluff, they have to fool testers and managers in order to save their back. :) Here is the list of commonly used phrases and sentences by software developers in different situations.(This might not be the case with all, but I am taking in general...)

1. Thats not my code: A bug has been found in your application; you get afraid and start debugging the code to know where is the error. Error is coming in a function which you have not developed, you get delighted and run to your manager and say "Thats not my code. Please catch my colleague who made this function".     

2. It works on my machine: You developed a code and now it has gone to testing team. Tester has produced a scenario in which he is getting errors. You run same scenario on your developer machine and its running fine. You get delighted and reply to his mail "Its running on my machine".

3. Thats all from my side: While concluding the meeting, we developers / managers normally say "Thats all from my side".

4. But I did not make any change in that module: Error is coming in a functionality. Your manages says that error is coming in your module. You try to save yourself and say "But I did not make any change in that module".

5. I am almost done: Your manager asks you how much work is done? You don't clearly say that a lot of work is pending, a lot of errors are coming. You simply say "I am almost done".

6. End of Day: End of Day is commonly used by developers when they are asked when can they complete this code?

7. You f**king tester: Well! the rivalary between developer and tester is natural. Nobody will like that someone should find out and highlight limitations in his hard work. When any tester is finding out any silly mistakes in you application just for the sake of increasing the count of number of bugs in your code, "You f**king tester" is obvious on your tongue.  
      
8. It will take only a minute: Sometimes when you have a small bug in your code and you already know where you have to change to fix the bug, you say to your manager "It will take only a minute" in hurry without realizing that there could be some complex scenario also appear by making that change and instead of minutes, it might take a day.

9. Documentation is done: Developers only want to code not document. When they are forced to document also, they do it just for the sake of doing without any interest and miss a lot of details and say to managers "Documentation is done". If that document is not reviewed, it goes smooth for him otherwise....

10. Thats not a bug but functionality: This is used by developers to fool the testers.

Friday, 22 February 2013

How to Redirect URLs using Apache .htaccess File in PHP?

How to Redirect URLs using Apache .htaccess File in PHP?

In this apache .htaccess tutorial, we will learn how to redirect urls in PHP using .htaccess file?

.htacces is a configuration file in apache. The .htaccess file is a small text document that generally sits in the same location as your index.php or index.htm pages. It gives you the ability to interact with Apache on an individual domain-to-domain and directory-to-directory basis.

You can place the htaccess file anywhere where you'd like to control the flow of visitors. So for instance you can protect directories and redirect the traffic visiting those pages. This page will show you how to use the .htaccess file to redirect your visitors in different ways.

You can use .htaccess to redirect users to a different URL. The most basic .htaccess looks for any request for a specific page and if it finds that request, it forwards it to a new page you have specified. The syntax is:

redirect accessed-file URL-to-go-to

There are 3 parts;

(1) the Redirect command,
(2) the location of the file/directory you want redirected, and
(3) the full URL of the location you want that request sent to.

These parts are separated by a single space and should be on one line.
 
Contents of .htaccess file

1. 301 (Permanent) Redirect:

301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. It's not that hard to implement and it should preserve your search engine rankings for that particular page. If you have to change file names or move pages around, it's the safest option. The code "301" is interpreted as "moved permanently".

Point an entire site to a different URL on a permanent basis. This is the most common type of redirect and is useful in most situations. In this example, we are redirecting to the "mt-example.com" domain:

# This allows you to redirect your entire website to any other domain
Redirect 301 / http://mywebsite.com/

2. 302 (Temporary) Redirect: Point an entire site to a different temporary URL. This is useful for SEO purposes when you have a temporary landing page and plan to switch back to your main landing page at a later date:

# This allows you to redirect your entire website to any other domain
Redirect 302 /
http://mywebsite.com/

3. Redirect index.html to a specific subfolder:

# This allows you to redirect index.html to a specific subfolder
Redirect /index.html
http://mywebsite.com/newdirectory/

4. Redirect an old file to a new file path:

# Redirect old file path to new file path
Redirect /olddirectory/oldfile.html
http://mywebsite.com/newdirectory/newfile.html

5. Redirect to a specific index page:

# Provide Specific Index Page (Set the default handler)
DirectoryIndex index.html

Precautions to use before using .htaccess file:

1. Even the slightest syntax error (like a missing space) can result in your content not displaying correctly or at all.

2. Since .htaccess is a hidden system file, please make sure your FTP client is configured to show hidden files. This is usually an option in the program's preferences/options.

3. Create an empty text file using a text editor such as notepad, and save it as htaccess.txt. The reason you should save the file as htaccess.txt is because many operating systems and FTP applications are unable to read or view .htaccess files by default. Once uploaded to the server you can rename the file to .htaccess.

Monday, 18 February 2013

How to Create and Use INI Files in Delphi XE2?

How to Create and Use INI Files in Delphi XE2?

Create an INI file (config.ini) which will have your application configuration settings like database connection settings, log settings, email settings etc. INI file is must for a big delphi application as you need to change various settings for application time to time. If you maintain INI file then you don't have to go in delphi code or database to change the settings everytime, you can just open INI file and make your changes.

Suppose you have created following INI file (config.ini)

[ConfigSettings]
ABC = 10
XYZ = 'Hello User'


Now, you have one integer value and one string value in ini. Lets create an delphi function to read this simple ini file.

You will have to use TIniFile delphi component from VCL. Declare object of this component.

IniValues : TIniFile;

procedure TMyForm.ReadINIFilesDelphi;
var
 ABCValue : Integer;
 XYZValue : String;
begin
  try
    IniValues := TIniFile.Create('config.ini');
   
    ABCValue := IniValues.ReadInteger('ConfigSettings','ABC',0);
    XYZValue := IniValues.ReadString('ConfigSettings','XYZ','');


    IniValues.Free;
  except
    on E : Exception do
    begin
      ShowMessage('Error occured in function ReadINIFilesDelphi: ' + E.Message);
    end;
  end;
end;


Above delphi procedure used ReadInteger and ReadString to read from INI files. It assigns 0 as default value to ABCValue and '' to XYZValue.

How to Send Email with Attachments in Delphi XE2 using Indy Clients?

How to Send Email with Attachments in Delphi XE2 using Indy Clients?

This delphi programming language tutorial is based on sending email with attachments using indy clients in delphi XE2. Indy Clients provide TIdSMTP and TIdMessage delphi components using which we can send email easily.

First of all, you will have to declare the objects of TIdSMTP  and TIdMessage like following:

SMTP: TIdSMTP;
MailMessage: TIdMessage;

Now you have to initialize Host and Port for SMTP. You can use default emailing port as 25.

After this you have to initialize MailMessage with From Address, To Address, CC Addresses, Subject and Body of the email.
 
Lets have a look at the following very simple delphi program to send email with attachments.

function TMyForm.SendEmailDelphi : Boolean;
var
  FileName : String;
begin
  try
    Result := False;
    FileName := 'myfile.txt';
    //Setup SMTP
    SMTP := TIdSMTP.Create(nil);
    SMTP.Host := 'XXX.XXX.XXX.XXX';
    SMTP.Port := 25; //Default email port
    MailMessage.From.Address := admin@host.com;
    MailMessage.Recipients.EMailAddresses :=
TOperson@host.com + ',' + CCperson@host.com;
    MailMessage.Subject := 'Test Email from Delphi XE2';
    MailMessage.Body.Text := 'Hi! This is test email from delphi XE2';
    //Attach a file
    if FileExists(FileName) then
      TIdAttachmentFile.Create(MailMessage.MessageParts, FileName);
    //Send email
    try
      try
        SMTP.Connect;
        SMTP.Send(MailMessage);
        Result := True;
      except
        on E:Exception do
        begin
          ShowMessage('Cannot send E-Mail: ' + E.Message);
          Result := False;
        end;
      end;
    finally
      if SMTP.Connected then SMTP.Disconnect;
  end;
  except
    on E : Exception do
    begin
      ShowMessage('Error in the function SendEmailDelphi: ' + E.Message);
      Result := False;
    end;
  end;
end;

Sunday, 17 February 2013

How to format and update datetime in Javascript?

How to format and update datetime in Javascript?

There are a lot of datetime formats in which you can display the date and time on your webpage using javascript. There are a lot of javascript datetime functions available. In this javascript datetime tutorial, I will show you how to display the date on your webpage and keep on updating datetime every minute.

I have to show the javascript datetime in following format:

Monday, February 18, 2013 12:18

I will keep this time updating every minute without refreshing my webpage.

For this, I will make two arrays. One array will contain the names of the months and other array will contain the names of the days. I will use setInterval function which will keep on calling myDateTimer function after every minute.

Lets look at this javascript datetime code:
 
var myVar=setInterval(function(){myDateTimer()},1000);
  
function makeArray()
{
 for (i = 0; i<makeArray.arguments.length; i++)
 this[i + 1] = makeArray.arguments[i];
}
  
function myDateTimer()
{
 var months = new makeArray('January','February','March','April','May',
 'June','July','August','September','October','November','December');
 var days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
 var date = new Date();
 var day = date.getDate();
 var month = date.getMonth() + 1;
 var yy = date.getYear();
 var year = (yy < 1000) ? yy + 1900 : yy;
 var hours = date.getHours();
 var minutes = date.getMinutes();
 var finaldate = days[ date.getDay() ] + ", " + months[month] + " " + day + ", " + year + " " + hours +" : " + minutes;
 document.getElementById("showDateTime").innerHTML=finaldate;
}

About the Author

I have more than 10 years of experience in IT industry. Linkedin Profile

I am currently messing up with neural networks in deep learning. I am learning Python, TensorFlow and Keras.

Author: I am an author of a book on deep learning.

Quiz: I run an online quiz on machine learning and deep learning.