Skip to main content

Posts

Auto Redirect HTML

Example of an index.html that redirects the browser to the specified url. <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > <html xmlns=" http://www.w3.org/1999/xhtml" > <head> <title></title> <meta http-equiv="refresh" content="0;url= http://YourURL " /> </head> <body></body> </html>

Compute Running (Execution) Time or Time Difference in C#

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CalculateTimeDifference { class Program { static void Main( string [] args) { string result; // start time of this program DateTime dStart = DateTime.Now; result = string .Format(" Start: Year:{0}, Month:{1}, Day:{2}, Hour:{3}, Minute:{4}, Second:{5}, Millisecond:{6}, In Ticks:{7} ", dStart.Year, dStart.Month, dStart.Day, dStart.Hour, dStart.Minute, dStart.Second,dStart.Millisecond, dStart.Ticks); Console.WriteLine(result); Console.ReadLine(); // wait until you press enter // end time of this program DateTime dEnd = DateTime.Now; result = string .Format(" End : Year:{0}, Month:{1}, Day:{2}, Hour:{3}, Minute:{4}, Second:{5}, Millisecond:{6}, In Ticks:{7} ", dStart.Year, dStart.Month, dEnd.Day, dEnd.Hour, dEnd.Minute, dEnd.Second, dEn...

Avoid timeout limit of execution time in php

When uploading data into MySQL through phpmyadmin exceed the timeout limit, you can edit the setting to avoid it. In .\phpmyadminXXX\libraries\config.default.php /** * maximum execution time in seconds (0 for no limit) * * @global integer $cfg['ExecTimeLimit'] */ //$cfg['ExecTimeLimit'] = 300; $cfg['ExecTimeLimit'] = 0; Setting $cfg['ExecTimeLimit'] equal to zero means no limit of execution time.

Read text file using C#’s StreamReader

1: using System; 2: using System.Collections.Generic; 3: using System.Linq; 4: using System.Text; 5: using System.IO; 6: 7: namespace ConsoleApplication1 8: { 9: class Program 10: { 11: static void Main( string [] args) 12: { 13: // text file to read 14: string fileName = " YourFileName.extension "; 15: StreamReader sr = new StreamReader(fileName, Encoding.Default); 16: string tempS = " "; 17: while (sr.EndOfStream != true ) 18: { 19: // read a line a time 20: tempS = sr.ReadLine(); 21: // print each line on console 22: Console.Out.WriteLine(tempS); 23: } 24: } 25: } 26: }