Showing posts with label tips. Show all posts
Showing posts with label tips. Show all posts

Thursday, December 23, 2021

Update an id column to be sequential

 Sometimes we come across a table in which a column that is supposed to store values in sequence , but over time they get values in the column are in random order to resolve this so that the id column has a sequence.

update parameter_table set parameter_id=rownum;

Monday, July 5, 2021

radio button default value blank

there will be an error when submitting to database, if a radio button can have a default value of blank.

having a blank value will not allow the radio button to be transferred to the database.

Wednesday, August 12, 2020

Javascript Alert Message Truncated

Sometimes when the javascript alert message is truncated in the webmessage window in internet explorer, you can embedd \r\n in the message or it the user might be using a extra monitor. By asking the user to use view the website on their laptop, the issue got resolved.

Tuesday, May 17, 2016

File processing checklist

1) On Linux you cannot use rename () function if the file is being moved across file systems. So play safe and use system("mv") command.
2) Verify that there is space on the filesystem before processing.
3) Verify the file size before and after file operations is the same , use fstat/stat system call.
4) Verify the current working directory to be sure the fullpath of the file is used
5) While dealing with traversing directories, pay attentions to sub-directories and '.' and '..' folders.


Friday, December 6, 2013

_stat,_fstat windows

int _stat(const char *path,struct _stat *buffer );

When you use _stat function to obtain information about a file, and would like to determine if the file is a directory or regular file? You can use the below example:
#include  "sys/types.h"
#include  "sys/stat.h"

int main()
{
      struct  _stat   file_stat;
      if (!_stat(file_name_with_path, &file_stat))
     {
          if( (file_stat.st_mode & S_IFMT ) ==_S_IFDIR  )
          {
                 printf( "Info [%s] is directory continue\n", file_name_with_path);
               continue;
          }
    }
    else
   {
          printf( "Error Unable to Obtain File Stats[%s]\n", file_name_with_path);
   }
}