Skip to main content

Posts

Showing posts from 2017

Nepal Telecom installs Facebook Cache Server in Nepal

Good news for all Nepalese out there. NTC has just installed facebook Cache server in Nepal with the collaboration with Facebook to bring its cache server to Nepal. This means now facebook can be accessed faster and in cheaper rate from Nepal. It will be applicable for all ISPs s ince all the ISPs of Nepal are the members of NPIX (Internet exchange Nepal).  NTC previously installed Google cache server with the collaboration with Google Inc. making google services like gmail, youtube, google drive, etc faster. In recent years, NTC has become the pioneer telecommunication company of Nepal. What is a cache? A cache (pronounced CASH) is a place to store something temporarily in a computing environment. In computing, active data is often cached to shorten data access times, reduce latency and improve input/output (I/O). Because almost all application workload is dependent upon I/O operations, caching is used to improve application performance. What does a cache ser...

How to fetch n latest numbers of record from a MySQL table using PHP in an ascending or descending order?

If you are new on PHP and MYSQL and wondering how to fetch just n numbers of records from a database table and group them by ascending or descending order, then you are at right place. Lets suppose a database table as below: Database name : “comments” Table name : “comments” Fields  id (Auto-increment) name (varchar 100) comment (varchar 100) Mysql statement to fetch 5 latest records and sort by descending order  SELECT * FROM comments ORDER BY id DESC LIMIT 5 Full Php Code: <?php $hostname="localhost"; $username="root"; $password="root"; $conn=mysql_connect("$hostname","$username","$password"); mysql_select_db("comments"); //default password for mamp is "root" and for xampp is empty $find_database = mysql_query("SELECT * FROM comments ORDER BY id DESC LIMIT 5"); if (!$conn) { echo "Unable to connect to DB: " . mysql_error(); exit;...

How to read nth line of a text file in C programming using file handling?

C program to read the nth line of a file.  This file handling C program illustrates how to read the nth content of a text file.  Suppose your text filename is "documents.txt" and you want to read only 9th line of that file. Here's a source code to do so. #include <stdio.h> int main () { FILE * file = fopen ( "documents.txt" , "r" ); char line [ 256 ]; int i = 0 ; while ( fgets ( line , sizeof ( line ), file )) { i ++; if ( i == 9 ) { printf ( "%s" , line ); } } fclose ( file ); return 0 ; } Similarly if you want to read only the 1st/2nd/3rd/4th/5th or any other line then just run variable i till your desired line.   For example if i  want to read the 10th line of the same file if ( i == 10 ) { printf ( "%s" , line ); }

How to download images and videos from instagram

Instagram does not allow its users to download its pictures/images and videos. But what if you need to download it? Well, there's always a backdoor to something. But for this method, you will need a PC. This does not work on Instagram app. Here's a youtube video that will guide you through a simple way to download images and videos from instagram.

How to connect php to mysql database? Simple html comment box tutorial.

First thing first. You will need a little bit knowledge of web programming. Simple HTML will work. Now here is a step by step procedure on how to connect php to mysql database using local server. Lets create a simple comment box. And I will teach you how to do this on both Mac or windows/Linux. Here is a list of Applications you need before doing some coding. A text editor ( I would recommend Sublime text ) A local server software ( MAMP for mac , Xampp for windows/linux) Now that you have downloaded your local server software, install it and start the servers. If you are on mac follow the screenshot to start up the servers. Bravo ! Your computer is now a server (local though). If you are on windows/Linux follow the similar procedure to start your servers.  Now lets get into some simple coding. Since we are going to make a simple comment box, lets create two files "comment.php"and "comment_post.php" inside htdocs folder. Note : Your def...