Wednesday, March 14, 2018

Optimize WIFI Adapter: Improve Network Performance

Tried on Surface Pro2 WIFI adapter:'


1. Reg
submitted  by [deleted]
A while back, I was having an issue with my SP2 only connecting at 11Mbps or 5Mbps to my wifi. Awful.
Found a solution. Flipped the 2.4GhzAutoUse40MHz key from '0' to '1' in the registry, and I'm now cruising at >200Mbps link speed.
1) Open device manager, and find the wifi adapter.
2) Open the Details page, and get the Driver ID. It'll probably be something like {4d36e972-e325-11ce-bfc1-08002be10318}\0003
3) Open regedit and go to HKLM\SYSTEM\ControlSet001\Control\Class{4d36e972-e325-11ce-bfc1-08002be10318}\0003
4) Double check that you're in the right key by looking at the DriverDesc value.
5) Change 2.4GHzAutoUse40MHz from '0' to '1'.
6) Reboot

2. netsh




Friday, March 2, 2018

WOL Wake On Lan : Wake Up from Sleep and Shutdown

Finally got mine working, albeit a few varying resources rto get both Sleep and Shutdown to work!

Tested on Win7 & Win8

1. Set NIC Card
     Wake on Packet
     Power Mgmt Tab: Allow turn on
     https://www.howtogeek.com/70374/how-to-geek-explains-what-is-wake-on-lan-and-how-do-i-enable-it/

and enable these

image
     and
     Enable WOL on the network adapter + Enable WOL in BIOS
         http://davidamphlett.net/2014/04/23/enabling-wake-on-lan-from-a-powered-off-state-windows-8-1/
    
2. Set Power Options
     Allow Windows to be woken from PCI/e devices
         http://davidamphlett.net/2014/04/23/enabling-wake-on-lan-from-a-powered-off-state-windows-8-1/
        
    
3. (WIN8) Disable Fast StartUp Start
     https://support.microsoft.com/en-us/help/2776718/wake-on-lan-wol-behavior-in-windows-8-windows-8-1-and-windows-10
     In case option not enabled:
         https://www.eightforums.com/threads/fast-startup-turn-on-or-off-in-windows-8.6320/
         https://www.sevenforums.com/tutorials/819-hibernate-enable-disable.html via powercfg -h on


image

3(WIN7) Install Simple TCPIP Svcs:

https://www.cnetsys.com/how-to-enable-wake-on-lan-wol-windows-7/


4. Test :

a. On remote computer test both:

    Sleep
    and
     Shutdown

b. I use this tool. To scan and WOL any computer on network:

image

Thursday, March 1, 2018

Using String.Equals() not working as intended error in Lamda

You may get error :

"

Incorrect number of arguments supplied for call to method 'Boolean Equals

"

When trying to use string.Equals() in lamda, this issue can be resolved by using 

Compare instead of Equals.


Explanation: "When using LINQ to Entities, it will automatically convert it to LINQ to SQL. And if the database field you are doing a .Equals on does not have a collate of NOCASE (SQLite in my example) then it will always be case-sensitive. In otherwords, the database defines how to do the string comparison rather than code." per  https://stackoverflow.com/questions/5080727/string-equals-not-working-as-intended/22978905


Example:

  //does NOT work when coalesce is DataColumn on

                var rows = db.WorkflowStartQueues.Where(x => (x.WorkflowStatus != null) && string.Equals(x.WorkflowStatus, workflowStatus, StringComparison.CurrentCultureIgnoreCase)).ToList();

                //DOES work not db reliant

                var rows2 = db.WorkflowStartQueues.Where(x => string.Compare(x.WorkflowStatus, workflowStatus, true) == 0).ToList();

                


More info:

Case insensitive string equality comparison

Use the String:Compare(string,string,bool) method to explicitly express a case-insensitive complete string equality operation. The generated SQL will not depend on the case-sensitivity of the current database collation.
LINQ: … .Where( x => string.Compare(x.FirstName, simpleParam, true) == 0 ) …
SQL: … where upper(a.FirstName) = upper(@p1) …