Posts

Showing posts with the label program

How to calculate the run time/time required for a program in visual studio or in C Sharp

I recently started programming in C# and I found it far better than Java already. To find the time took by your code , you will have to insert the below snippet . For more information, you can go to the msdn link. /* importing the lib*/ using System.Diagnostics; /* creating the object of Stopwatch, where we can it to calculate the time*/ Stopwatch stopwatch = new Stopwatch (); stopwatch.Start();// Start the time stopwatch.Stop();// Stop the time TimeSpan ts = stopwatch.Elapsed;             long elapsedMilliseconds;             elapsedMilliseconds = stopwatch.ElapsedMilliseconds; /*Conversion of elapsed time to milliseconds. We can even convert it in to minutes or hours. For more information please check the below link to msdn*/ Console .WriteLine( "RunTime " + elapsedMilliseconds); Msdn Link

How To Install LEX and YACC in Linux or Ubuntu

Image
To program LEX programs and yacc programs you need to install two packages in Ubuntu 1:Flex -to make the Lex program work 2.Bison -to make the yacc programs work To install,Open terminal and do the following...  1.To install Flex sudo apt-get upgrade sudo apt-get install flex 2.To install Lex sudo apt-get upgrade sudo apt-get install bison And its done ..!!!

Solving Stray error in CPP during compilation

Image
You may noticed error saying " Stray error in the line ...".What you want to do is that you want to delete the whole line ,where the compiler say there is an error.. and RETYPE the whole line.Thats the only reason to solve the issue.... This is because there will be some special character  which may not be visible.We need to avoid these special  characters and then compile...

Installing PERL in Windows / Beginner For Perl

Image
For installing the Perl you need to download Perl from their website which is about 69 MB. Step I: Download Perl from perl.org Step II : Now create a program with extension in .pl with the help of notepad.An example code is given below #!/usr/local/bin/perl      print "Hello Perl \n"; Step III: Now from start menu search for Perl command line and open it.Then get to the location where the program file exist. Now:                                                           perl filename.pl                                                There.. u get the output in Perl.....

How to get the File Size and File Type of File / Folder in PhP With Example Source Code

Image
Guys, By using the following code we can find out the File size and type of files/ folders in a directory . The help is give as comments and if have any more doubt then please comment Example Code <?php   $myDirectory = opendir("rootFolder");   // get each entry   while($entryName = readdir($myDirectory)){        $dirArray[] = "rootFolder/".$entryName;   }   // close directory   closedir($myDirectory);   //     count elements in array    $indexCount     = count($dirArray);    Print ("$indexCount files<br>\n");   // sort 'em   sort($dirArray);   // print 'em    print("<TABLE border=1 cellpadding=5 cellspacing=0 class=whitelinks>\n");    print("<TR><TH>Filename</TH><th>Filetype</th><th>Filesize</th></TR>...

How to Create Live Search In Html Using Ajax Ad PhP - Google Live Search / Instant Search Code And Example

Image
Hi, Here Is the code and example for how to create a live search or instant search for your website.It consist of 3 parts 1.A JavaScript including Ajax 2.A Input box to enter the keywords by user 3.A Php Code to do the searching           Now , the JavaScript code is given below <script type="text/javascript"> function showResult(str) { if (str.length==0) { document.getElementById("livesearch").innerHTML=""; document.getElementById("livesearch").style.border="0px"; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("livesearch").innerHTML=xmlhttp.responseTe...

Download Calender JavaScript or source code of calender java script-ajax

Image
Guys,                        I had searched a lot for finding the calender script for my project and now i had the perfect one .Yow can download it from the Link Below.There are more script in that site.Copy the code and jst paste it where u want the calender  Download Here Source  Code Example:

Latex In Windows Download

Image
Hey guys, For preparing the seminar report you will need to prepare the Latex report.I am here Providing a Link where You can download the Latex for windows Download Latex: Here

Tips and Tricks To Improve the Performance Of Your Android Program

Image
As per illustrated in the previous article ,you may have learned to make an android programs. Now I will tell you to improve your Android codes performance. Just follow the 9 points below 1.Make your own quit option In your application make a exit in the menu itself and don’t make the user not to quit it by using the back button. 2.Cashe clearing Make option to clear the cache. It will increase the performance and reputation of your application 3.Install in sd card Make default arrangement to make the software to be installed in the sd card rather than the internal memory. 4.Simple Interface Make simple interface so that user don’t get confused which will end in killing the program. 5.Improve the user interface You must concentrate in improving your user interface. It will attract thee user much to the appln 6.Speed up ur appln or die User always need to speed up ur appln other wise he will kill it 7.Update You can provide regular update to add more option 8.client based updates In ...

How to access GPS location in Android phones program code

Image
Following is a code for accessing the gps location in an Android phone by coding.Import necessary package to run it out. package andgps.g;// ur package name import com.ieffects.android.lbs.R; import android.app.Activity; import android.content.Context; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class gps extends Activity { private static final long MINIMUM_DISTANCE_CHANGE_FOR_UPDATES = 1; // in Meters private static final long MINIMUM_TIME_BETWEEN_UPDATES = 1000; // in Milliseconds protected LocationManager locationManager; protected Button retrieveLocationButton; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); retrieveLocationButton =...

How to install or configure Android in Linux - Ubuntu / Mint / Debian

Image
Let’s talk about something about free software.... don’t get confused its android and Ubuntu.... here we will talk about installing android sdk in Ubuntu in step by step... What u need? 1.Android emulator for Linux from their site 2.Eclipse with java for Linux which is free 3.U should have jdk(java dev kit) installed in your computer and some space for your workspace..... Emulator is used in order to emulate the actual android phone. It helps in running programs before we run it in actual phone. In here I only asaid about the emulator. I included the picture so always look at the screen shots… 1.At first u want to install jdk in your Linux mostly java will be installed in linux.If not then I will give u necessary information to install it) 2.After the installation u should install android sdk form http://developer.android.com/sdk/index.html that is a simple task(but u want to update the android sdk).The Google provide a platform for working the android and we want to ...

polygon program for graphics

#include #include #include #include #include void line(int xa,int ya,int xb,int yb) { int dx,dy,s,k; float xi,yi,x,y; int gd=DETECT,gm; initgraph(&gd,&gm, ""); dx=xb-xa; dy=yb-ya; if(abs(dx)>abs(dy)) s=abs(dx); else s=abs(dy); xi=dx/s; yi=dy/s; x=xa; y=ya; putpixel(ceil(x),ceil(y),1); for(k=0;k { x=x+xi; y=y+yi; putpixel(ceil(x),ceil(y),1); } } void main() { int v[10][2]; int x,y,n,i,x1,y1,x2,y2; printf("ENTER THE NO OF EDGES"); scanf("%d",&n); printf("ENTER THE VERTICES"); for(i=0;i { scanf("%d",&v[i][0]); scanf("%d",&v[i][1]); } for(i=0;i { if(i!=n-1) { x1=v[i][0]; y1=v[i][1]; x2=v[i+1][0]; y2=v[i+1][1]; } else { x1=v[i][0]; y1=v[i][1]; x2=v[0][0]; y2=v[0][1]; } line(x1,y1,x2,y2); } getch(); }

line clipping program

#include #include #include #include struct wind { int xmin,ymin; int xmax,ymax; }; struct point { int x,y; char code[5]; }; void gencode(struct wind w,struct point p) { if(p.x p.code[0]='1'; else p.code[0]='0'; if(p.x>w.xmax) p.code[1]='1'; else p.code[1]='0'; if(p.y p.code[2]='1'; else p.code[2]='0'; if(p.y>w.ymax) p.code[3]='1'; else p.code[3]='0'; } struct point clipline(struct wind w,struct point p,struct point pt) { int i,flag=0; float m=(p.y-pt.y)/(p.x-pt.x); gencode(w,p); while(!flag) { flag=1; if(p.code[0] == '1') { p.y+=(w.xmin-p.x)*m; p.x=w.xmin; gencode(w,p); flag=0; } else if(p.code[1] == '1') { p.y+=(w.xmax-p.x)*m; p.x=w.xmax; gencode(w,p); flag=0; } else if(p.code[2] == '1') { p.x+=(w.ymin-p.y)/m; p.y=w.ymin; gencode(w,p); flag=0; } else if(p.code[3] == '1') { p.x+=(w.ymax-p.y)...