May 2011

How to hide and show files in windows using Attrib command?

Somtimes we store personel data or sensitive data in office or personnel machines. So we need a way to keep the data away from
others eyes. How to do?

To hide the files or folders, normally we use either
external tools or windows show or hide files and folders option.

Here is the different way to hide the files and folders using Attrib command.

Easytrieve

It is suitable for beginners in data processing techniques because it is easy to learn. It is simple enough for a beginner to use without additional training, and sophisticated enough to enable a data processing expert to perform complex tasks. By using easytrieve creating reports will be done faster.

Below are some capabilities for easytrieve

File processing

  • Accepts any number of input files.
  • Processes SAM, ISAM, VSAM, or IMS/DLI files.
  • Allows fixed, variable, undefined, or spanned record formats.
  • Processes data in alphabetic, numeric, packed, packed-unsigned, or binary format.
  • Searches files and performs logical data selection based on input or calculation.
  • Edits and updates files.
  • Matches an unlimited number of files.
  • Creates subfiles containing selected records from a master file.

Operations

  • Performs extensive computations through user logic; including percentages,averages, and other calculations.
  • Sorts on any number of keys.
  • Calls your programs and subroutines written in other languages and integrates them into the job.

Output

  • Outputs any number of files or reports on one pass of the input file(s).
  • Automatically formats output with all totals calculated internally.
  • Provides summary reports and output files with no limits on the number and size of control break fields or total fields.
  • Makes it easy for you to define and print specially formatted output, such as for W-2 forms, audit confirmations, labels, form letters, and preprinted forms.
  • Permits you to vary page sizes within a report, and insert additional header and footer information.
  • Enables you to write reports directly to microfiche.

Easytrieve -How to search record from one file into another file.

By using easytrieve you can search record from one file into another file.

The below were conditions to search.

1. Both the input files should be in sorted order.
2. Any one of the file should not have duplicate records. That file should be used as input file by using LOOKUP as DD Name. - Lookup is keyword in easytrieve.

Apache error log and access log

Most of us use Apache Web Server for running our website or web application. So in this article, we will just talk about Apache log files. Apache records each request to the server, errors and events in the log files. We can use these files information for monitoring. By default Apache have two log files.

1. access_log
2. error_log

Drupal : Google AdSense implementation using Blocks

Using Drupal for your site and having Google Adsense code ready to place in your site?

There are few ways to place the google adsense in your drupal web site. I here discuss the simple way using Drupal Blocks.

1. Administer -> Site Building -> Blocks -> Add Blocks.

2. Specify title of the block example Google adsense-1.

3. Place the google adsense code to block body.

4. Input format - select PHP Code to make the adsense appear in the page.

(Note: If the input format doesn't have PHP code format then do the step 5 and go to admin -> site configuration -> input formats -> add php format. Go back to admin -> site building -> blocks -> click configure near to Google adsense-1 block. Change the format to PHP code. )

5. Save the block.

6. Specify where this block to display header / footer / right sidebar / left side bar / content.

7. Position the adsense display and save it.

Thats it! Now go and see the adsense ads coming up!

Vim - How to change the case of the text in vim?

While working in vim, sometimes need to change the case of the letter, word or whole line. For example you have 'perl' and want to change it to "PERL' or 'Perl'. How to do this in vim?

Here is the way : use Shift and ~ to change the case of the text.

Keep the cursor in the text or letter and press Shift and ~ will change the case from upper to lower or lower to upper.

Perl : DBIx::Class::Schema::resultset(): Can't fnd source

Are you getting, DBIx::Class::Schema::resultset(): Can't fnd source for Customer at ../CustomerModel.pm?

Reason would be :

1. The Customer table schema itself not created.

2. The Customer table schema is not placed in the right directory where it was looking.

3. The Customer table schema file is not included in the Schema.pm

Vim - How to delete character or line ?

To delete a character, keep the cursor in the character and do Esc then x.

To delete the line

To delete a line use Esc then dd.

You want to delete more lines!. Easy just use n dd. For example to delete the 10 lines from current line 10 dd.

To delete word

You can delete the word by keeping the cursor in the word and by doing Esc + dw.

To delete more than one word, you can use d number w. For example to delete 3words use like d3w.

Easytrieve -To find the records using two files

By using easytrieve you can match two files by using their key field.

The below were conditions to search.

1. Both the input files should be in sorted order by using the field.
2. There is no limit in number of records in both input files.
3.You can write the output file if when there is match record found in one file.
4.You can write the output file if when there is no match record found in one file.

Vim - execute command inside vim

While working in vim, you may want to create directory or want to view the directory list. How to do that without exit from vim? Here is the way!

To execute script inside the vim edit screen, use :! then command

:! perl test.t
:! mkdir /newmodule
:! ls -ltr

Drupal - How to implement Google Adsense for feeds in Drupal Sites?

You want to display google adsense for feeds in your drupal site feeds?

Already create google adsense for feeds, ready with redirect Url? Thinking on how to do this redirect in Drupal. Here is the simple steps to implement.

Perl - How to get the multiselect select box or checkbox element values in the Perl Class?

For example you have the html select box with multiple selection option like below

<select name="hobbies" id="hobbies" multiple>
   <option>Reading Books</option>
   <option>Writing Stories</option>
   <option>Collecting Coins</option>
   <option>Cross Stitching</option>
   <option>Tenis</option>
   <option>Playing Cricket</option>
</select>

On submit of the html form, you get query like hobbies=Reading Books&hobboes=Tenis right?

How to get the value of this element in perl class?

If you use $self->{hobbies}, it will only return the Reading Books.

So you can get the all the selected values by using @{$self->{hobbies}}

You can assign it to variable and use it.
my @hobbies = @{$self->{hobbies}} .

Unix / Linux : How to get the unix version number?

To get, what version of unix installed, you can use uname command with 'a' option.

uname -a command display the version details.

Linux / Unix : How to check the used and available space?

Mostly used two commands to check the space in the linux and unix box are

1. du - To get the disk usage of the current directory and files.

2. df - Used to get the available space and utilized space in percentage.

Linux / Unix : How to remove ^M character in the files created in windows system?

You have wrote code in windows box and ftp to unix or linux box? when you open it, you find a character ^M at the end of each line. How to remove that?

use dos2unix to remove ^M character. For example to remove ^M from test.pl

dos2unix test.pl test.pl

It will remove ^M and write into the same file name test.pl.

jQuery - binded click event handler not working for newly added element?

I have handler for click event of the class removeRecord. Like below

$("a.removeRecord").click(function(event){
   event.stopPropagation();
   if(confirm("Do you want to delete?")) {
    this.click;
   }
   event.preventDefault();
});

This works awesome with elements which exists when document.ready.

Later, i have added anchor tag with class name as removeRecord dynamically. It doesn't work, what's wrong?

Click event has binded to only the elements which have class removeRecord exists at the load time.

It is not linked with newly added element, so onclick event is not called for new elements. How to solve this?

Use live instead of click, so it will bind to current and future elements which have class removeRecord.


$("a.removeRecord").live("click",function(event){

   event.stopPropagation();
   if(confirm("Do you want to delete?")) {
    this.click;
   }
   event.preventDefault();
});

Servlet Interview Questions

1. What are the types returned by the ServletContext method getResource and getResourceAsStream?

Answer: URL and InputStream.

2. What is the return type of the getLastModified method of HttpServlet?

Answer: long

Easytrieve - Retrieve the record only when the condition satisfied

Sample program to retrieve the record only when the condition satisfied.

//PANDD DD DSN=XXXXXXX.XXXX.XXXXXX.XXXXXXXX,DISP=SHR

Mobile Viruses

We are in the mobile world, nowdays almost everyone use mobile phones. It's become one of the most important item. We have to be aware how to protect the mobiles from Viruses.

Like computers, mobiles also get infected by viruses. Most of us doesn't aware of the mobile viruses. We store contacts, important information, files, photos and so on in mobile. So it is necessary to aware of the mobile virus.

How it spreaded?

Toddlers at home, want to lock the keyboard and mouse?

You have toddler at home and pressing keys, clicking mouse! Are you worried that key combination or mouse click delete important files or applications?

There are softwares that just lock the keyboard, mouse clicks.

One among those is Kid-Key_Lock. Using this, we can lock mouse - left, right, wheel and double click options.

In keyboard, we can lock - letter, numbers, navigation keys, shortcut keys and insert,delete keys also.