2018年3月27日 星期二

C# Sample

1.Use Environment.TickCount property. 
[code]
function Delay(int ms)
{
int time = Environment.TickCount;
do while(true)
if(Environment.TickCount - time >= ms) return;
}
[/code]

2.it calculats the Time Laspe From the System Clock
[code]
public static DateTime PauseForMilliSeconds( int MilliSecondsToPauseFor )
{
System.DateTime ThisMoment = System.DateTime.Now ;
System.TimeSpan duration = new System.TimeSpan( 0, 0, 0, 0, MilliSecondsToPauseFor ) ;
System.DateTime AfterWards = ThisMoment.Add( duration ) ;

while ( AfterWards >= ThisMoment )
   {
    System.Windows.Forms.Application.DoEvents() ;
    ThisMoment = System.DateTime.Now ;
   }
return System.DateTime.Now ;
}
[/code]

2018年3月20日 星期二

Linux How do I install .run files?

Terminal Method
Assume the file is called some-app.run and is in the folder /home/user/Downloads. You will need to modify these instructions to fit your situation.
  1. Open a terminal (Applications->Accessories->Terminal).
  2. enter cd /home/user/Downloads
  3. enter chmod +x some-app.run
  4. enter ./some-app.run
  5. if step 4 fails with a message including 'permission denied', try entering sudo ./some-app.run(you will need to enter your password for this).

Q:slow boot time ubuntu - A start job is running for Raise network interfaces

ubuntu16.04.02_x64
editing the file:

sudo vim /etc/systemd/system/network-online.targets.wants/networking.service
And changing the following line at the end of the file:

TimeoutStartSec=5min
to:
TimeoutStartSec=10sec

I have then rebooted the system and it works fine.

If you dont want to reboot the system again, just reboot the daemon by:

2018年3月18日 星期日

Gigabyte disable CSM option

“CSM Support
Enables or disables UEFI CSM (Compatibility Support Module) to support a legacy PC boot process. Always Enables UEFI CSM. (Default)
Never Disables UEFI CSM and supports UEFI BIOS boot process only.

This item is configurable only when Windows 8 Features is set to Windows 8.”

option nerver