Posts

Get Local time| Get International Time in Javascript | Get Local time in php | Get Time according to timezone in php | Get Time According to local timezone

Local Time/ International Time. Headache! The solution:- Use unix timestamp for converting time to local of international timezone for different places. Just save your time as unix timestamp. From Your Browser: with javascript const unixtime= new Date().getTime(); Save this timestamp for database. While printing on frontend just pass it into the Date class: const localTime= new Date(unixtime); From php script: $unixTime=time().'000';

Benefits of using CDN links in head tag

The main benefit is your website  loads faster as compared to attached local files in head tags. Suppose if the browser has opened a website that contains some CDN links. Then after you open another website that has the dependecy of same CDN links will be loaded faster. Peoples generally install js or put css files of bootstrap locally to ensure the availablity of these dependecy as CDN links are outsider dependecy. But if you use CDN links the performance can be increased.

Experience or Talent?

So let's talk about experience in programming. My famous line " Experience doesn't matter, but talent matters"  hmm..... So initially you start your mindset of programming from your college or after college when you start working in a  software company. And you start counting your experience by year or months. All the thing is you got experience whenever you start believing in yourself. And for believing in ourselves we require some evidence that we are doing good, we got knowledge of it and that is how experience speaks from yourself. But suppose that you and your friend started from same point and have same potential but you got some oberservations regarding knowledge. Now experience is same but knowledge is different. To improve this you can do some different things like helping your juniors or getting openions from senior members.  It will develop yourself from inside and you will feel motivated. So , time is precious utilizes it in such way that is gives you best

Given a sentence, , print each word of the sentence in a new line.

#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() {     char *s,tmp;     int len,i;     s = malloc(1024 * sizeof(char));     scanf("%[^\n]", s);     s = realloc(s, strlen(s) + 1);     //Write your logic to print the tokens of the sentence here.         len=strlen(s);     for(i=0;i<len;i++){         tmp=s[i];         if(tmp==' '){     printf("\n");             continue; }         printf("%c",s[i]);             }     return 0; }

spiral like pattern program in c

#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() {     int n,i,j,boundry,num;     scanf("%d", &n); boundry=(n*2)-1;     for(i=0;i<boundry;i++){      for(j=0;j<boundry;j++){           if(i<j) num=i; else num=j;          if(num>=boundry-i) num=boundry-i-1;          if(num>=boundry-j-1) num=boundry-j-1;          printf("%d ",n-num);                //printf("sa");     }          printf("\n");     }         return 0; }

bitwise AND OR NOT operations between numbers c program

Image
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> //Complete the following function. void calculate_the_maximum(int n, int k) {   //Write your code here.     int a1=0,o1=0,xo1=0,tmp1,tmp2,tmp3;     int s[n+1],i,j;     for(i=0;i<n;i++){         s[i]=i+1;     }       for(i=0;i<n;i++){         for(j=i+1;j<n;j++){          if(o1<s[i]|s[j]){              tmp1=s[i]|s[j];              if(tmp1<k){                              o1=s[i]|s[j];                                      }                            }                                 tmp2=s[i]&s[j];            if(a1<tmp2){              if(k>tmp2) {a1=s[i]&s[j];                         // for testing           printf("\n %d&%d=%d & k=%d",s[i],s[j],s[i]&s[j],k);                         }                                               }                                 tmp3=s[i]^s[j];            if

C program to reverse a string without using any string functions-asr

Image
#include <stdio.h> #include <conio.h> void main() { char *s; int len,i=0; clrscr(); printf("\nENTER A STRING: "); gets(s); while(1){ if(s[i]=='\0'){ len=i; break; }          i++; }        for(i=len;i>=0;i--){ printf("%c",*(s+i));        } getch(); }