This issue started to appear after windows creator's update. For some reason, when I wake up my laptop from sleep/hibernate, the DOWNLOAD speed on wifi connection is slow (seems limited to about 1.7 Mbit). I tried all the various hack with power settings and policies noted on internet, but none had any effect.
In the end, the only solution I found that's consistently working is to disable and then enable the wifi adapter at hardware level:
Monday, October 08, 2018
Wednesday, December 20, 2017
Entity Framework Core 2 - not recognizing context for Core library
I'm used to having my EF entities in separate class library and having one solution just for this library and a unit-test project. It makes development much faster (quick compilation). After switching to EF Core (2), I ran into issue that migrations won't pick up DbContext and nothing would happen. So I tried running "Get-DbContext", which resulted in nothing - not even a message in the PMC console.
Interestingly enough, exactly the same code was working fine when the project type of the library was "Class Library (.NET Standard)" instead of "Class Library (.NET Core)".
After many experiments I figured out a way to make it work. It seems that it needs an "application" to be present in the solution for the migrations to work - could be web or console.
So, to fix this issue:
Interestingly enough, exactly the same code was working fine when the project type of the library was "Class Library (.NET Standard)" instead of "Class Library (.NET Core)".
After many experiments I figured out a way to make it work. It seems that it needs an "application" to be present in the solution for the migrations to work - could be web or console.
So, to fix this issue:
- Add "Console App (.NET Core)" to your solution
- Add EF Core nuget packages to the console app
- Reference your class library from the console app
- COMPILE!!
- Done - now you can generate migrations (don't forget to set your console app as a "StartupProject" either through parameter or in the PMC combo at the top)
Android - Gmail and Calendar not receiving new data
This has been very frustrating - on my new phone, as I was going through the installation (Android 7.1) I picked the option to use the automatic restore from Google using my google account. All seemed ok, but then I noticed weird thing. My phone never notified me on new email messages or calendar events. I had to manually open the application and refresh (in fact run the refresh twice) for the new messages/events to show up.
I tried everything I found online - all settings, preferences, etc. After almost giving up and reinstalling the phone from factory reset, I found a cure.
Go to the: Settings -> Accounts, click on the "..." at the top-right corner, un-check and re-check the "Auto-sync data" option. This is it - ever since that all my push messages are getting in :)
I tried everything I found online - all settings, preferences, etc. After almost giving up and reinstalling the phone from factory reset, I found a cure.
Go to the: Settings -> Accounts, click on the "..." at the top-right corner, un-check and re-check the "Auto-sync data" option. This is it - ever since that all my push messages are getting in :)
Wednesday, December 06, 2017
Skype on windows 10 keeps 30% CPU utilization
I had this issue on my laptop - skype kept my CPU utilization at about 30% all the time. At last I found solution in this video - just change associated program for the ".htm" extension from chrome to internet explorer, restart skype and problem solved.
Thursday, May 26, 2016
Webpack watch not working on windows
I learned to love the webpack's "-w" option, which auto-recompiles the bundle(s) whenever source file is changed. Plus, it's really fast comparing to the full compile.
However, I ran into issue - when I moved my project from one computer to another, I found out that even though I can run webpack fine (it compiles all), it did NOT trigger the auto-recompile when I was modifying the source files.
After lots of experimentation, I found out that it was related to the folder name.
There's a bug reported already on that subject.
In short, you cannot have "(" or ")" anywhere in the path to your project.
So while this works fine:
c:\my projects\sample1\root
This stops watch from working:
c:\(my projects)\sample1\root
However, I ran into issue - when I moved my project from one computer to another, I found out that even though I can run webpack fine (it compiles all), it did NOT trigger the auto-recompile when I was modifying the source files.
After lots of experimentation, I found out that it was related to the folder name.
There's a bug reported already on that subject.
In short, you cannot have "(" or ")" anywhere in the path to your project.
So while this works fine:
c:\my projects\sample1\root
This stops watch from working:
c:\(my projects)\sample1\root
Monday, January 04, 2016
Computer wakes up during night on its own
I've had the issue with my desktop for ages and now, after upgrading to Windows 10, my Asus laptop started to do the same - wake up during night w/o reason.
I followed this post to check:
powercfg –lastwake
powercfg -devicequery wake_armedand disabled wake-up settings for my mouse and network adapter. This didn't help.
Next I followed this post and disabled the wake-up settings of the task:
Problem solved at last :)
I followed this post to check:
powercfg –lastwake
powercfg -devicequery wake_armedand disabled wake-up settings for my mouse and network adapter. This didn't help.
Next I followed this post and disabled the wake-up settings of the task:
Problem solved at last :)
Monday, December 28, 2015
Asus G73JW and Windows 10 freezing
I've just updated my relatively old Asus G73JW to windows 10 (fresh install - I don't like upgrades). All seem well until the 1st restart, when I'd end up with black screen after reboot. Couple hard-resets later and trying to disable various start-up programs (I was suspecting display drivers from NVidia) and situation wasn't improving - sometimes I was able to log-in, but system would freeze randomly after couple seconds/minutes. Sometimes I'd end up with BOD with MACHINE_CHECK_EXCEPTION.
Next step was to boot into safe mode - interestingly, I couldn't get into "Safe mode with networking" (option 5) - that ended up with the BOD. Luckily, just "Safe mode" (option 4) worked fine and system wasn't freezing. This got me thinking that maybe it was the network card causing the problems. So I went to Device Manager and disabled the following:
This resolved my issues with both, BOD as well as freezing. I'm running on WiFi, so having the physical LAN disabled is not an issue for me, but there might be updated driver somewhere that might fix the issue as well.
Next step was to boot into safe mode - interestingly, I couldn't get into "Safe mode with networking" (option 5) - that ended up with the BOD. Luckily, just "Safe mode" (option 4) worked fine and system wasn't freezing. This got me thinking that maybe it was the network card causing the problems. So I went to Device Manager and disabled the following:
This resolved my issues with both, BOD as well as freezing. I'm running on WiFi, so having the physical LAN disabled is not an issue for me, but there might be updated driver somewhere that might fix the issue as well.
Thursday, April 24, 2014
Consuming WebService from BizTalk using message routing only
I've recently came across scenario, where I needed to consume webservice (svc) from BizTalk without the use of orchestrations.
Consuming is simple enough - in BizTalk Project, select the "Add Generated Items", select WCF and finish the wizard. Then delete the ODX file (we're not using orchestration). Deploy project to BT so that we have schemas in place and use one of the generated bindings to create the Send port.
Create a testing Receive port (don't forget to use XmlReceive pipeline on the location).
Send a test message and... Boom! BT tells you that the call has failed due to routing failure - missing subscriber.
If you inspect the error, you'll see that it's not the call TO the service, but rather the response FROM the service that is failing - and fair enough, we don't have subscriber for the response!
To correct this situation, create another Send port and set its Filter criteria to:
BTS.MessageType == http://yournamespace#MethodNameResponse
If you're not sure about the message type, just inspect the Routing Failure report and you'll find it there.
Consuming is simple enough - in BizTalk Project, select the "Add Generated Items", select WCF and finish the wizard. Then delete the ODX file (we're not using orchestration). Deploy project to BT so that we have schemas in place and use one of the generated bindings to create the Send port.
Create a testing Receive port (don't forget to use XmlReceive pipeline on the location).
Send a test message and... Boom! BT tells you that the call has failed due to routing failure - missing subscriber.
If you inspect the error, you'll see that it's not the call TO the service, but rather the response FROM the service that is failing - and fair enough, we don't have subscriber for the response!
To correct this situation, create another Send port and set its Filter criteria to:
BTS.MessageType == http://yournamespace#MethodNameResponse
If you're not sure about the message type, just inspect the Routing Failure report and you'll find it there.
Thursday, August 29, 2013
EF Code First AddOrUpdate puts null into referenced objects
I've ran into issue in my Seed() function, where I generate stub data.
This is my design:
public class AircraftModel
{
public Guid Id { get; set; }
public string Name { get; set; }
public Guid ManufacturerId { get; set; }
public virtual Manufacturer Manufacturer { get; set; }
}
This is my design:
public class AircraftModel
{
public Guid Id { get; set; }
public string Name { get; set; }
public Guid ManufacturerId { get; set; }
public virtual Manufacturer Manufacturer { get; set; }
}
Now, I tried following code to generate data:
context.AircraftModels.AddOrUpdate(m => m.Name
, new AircraftModel {
Name = "Global Express XRS",
Manufacturer = context.Manufacturers.Single(c => c.Name == "Bombardier Inc.")
}
);
It should work like charm I though, but it didn't. The problem was, that the Manufacturer was set to null after running AddOrUpdate - I guess because the ManufacturerId didn't match Manufacturer object.
When I changed to code to this, it worked fine:
context.AircraftModels.AddOrUpdate(m => m.Name
, new AircraftModel {
Name = "Global Express XRS",
ManufacturerId = context.Manufacturers.Single(c => c.Name == "Bombardier Inc.").Id
}
);
Ok, so there's obvious problem with syncing the Manufacturer object and the ManufacturerId.
I've decided to keep them in sync using following modification:
public class AircraftModel
{
private Manufacturer _manufacturer;
public Guid Id { get; set; }
public string Name { get; set; }
public Guid ManufacturerId { get; set; }
public virtual Manufacturer Manufacturer
{
get { return _manufacturer; }
set
{
if (value != null && value.Id != ManufacturerId)
ManufacturerId = value.Id;
_manufacturer = value;
}
}
}
{
private Manufacturer _manufacturer;
public Guid Id { get; set; }
public string Name { get; set; }
public Guid ManufacturerId { get; set; }
public virtual Manufacturer Manufacturer
{
get { return _manufacturer; }
set
{
if (value != null && value.Id != ManufacturerId)
ManufacturerId = value.Id;
_manufacturer = value;
}
}
}
Now this code works as expected. Not sure if it's a bug or "feature"?...
ASP.Net Telerik RadScriptManager causes Sys not defined error
I ran into issue where I was working on a website with page methods (svc) and so I was using ScriptManager to register them. All was working fine until I decided to include Telerik ASP.Net AJAX control as well. I switched from ScriptManager to RadScriptManager, added all the web.config settings, but when I loaded the page in browser, I was getting all sorts of "Sys is not defined" errors.
One thing in particular was puzzling - when I looked in browser's dev tools at the content of the "WebResources.axd?....", I was getting HTML code instead of JavaScript.
Finally I realized where the problem was - I was using Forms authentication and did not put the WebResource.axd to the exceptions list... doh!
So make sure you have the below in your web.config:
<location path="Telerik.Web.UI.WebResource.axd">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
One thing in particular was puzzling - when I looked in browser's dev tools at the content of the "WebResources.axd?....", I was getting HTML code instead of JavaScript.
Finally I realized where the problem was - I was using Forms authentication and did not put the WebResource.axd to the exceptions list... doh!
So make sure you have the below in your web.config:
<location path="Telerik.Web.UI.WebResource.axd">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
Friday, August 02, 2013
Asus G73JW and Windows 8
I've updated my Asus laptop G73JW to Windows 8 and found only three important things that needed to be installed from Asus.
1) To enable the "Fn" + ... buttons, I've had to install the "ATKACPI driver and hotkey-related utilities" found on asus support web-site under "Other". This enables the key functions (such as keyboard light, sound volume controls, etc.)
2) I had VERY annoying problem where while typing, cursor would randomly jump to a mouse-pointer location. Apparently wasn't the only one with the problem. I found the solution by installing the "Synaptics TOUCHPAD driver" found under the "Touchpad" section. In the settings, I've checked to "disable internal pointing device when external is connected" (found on last tab) - this disconnects the touchpad when I have my external mouse connected and the annoying mouse-jumping problem is solved.
3) Finally, I was able to connect WiFi with no problem, but the ethernet (Atheros AR8131) adapter would just stay disabled and not recognize LAN cable plugged in. Trying to enable would not do anything. Once again installing the driver "Atheros LAN Driver" from asus support section "LAN" fixed the issue.
1) To enable the "Fn" + ... buttons, I've had to install the "ATKACPI driver and hotkey-related utilities" found on asus support web-site under "Other". This enables the key functions (such as keyboard light, sound volume controls, etc.)
2) I had VERY annoying problem where while typing, cursor would randomly jump to a mouse-pointer location. Apparently wasn't the only one with the problem. I found the solution by installing the "Synaptics TOUCHPAD driver" found under the "Touchpad" section. In the settings, I've checked to "disable internal pointing device when external is connected" (found on last tab) - this disconnects the touchpad when I have my external mouse connected and the annoying mouse-jumping problem is solved.
3) Finally, I was able to connect WiFi with no problem, but the ethernet (Atheros AR8131) adapter would just stay disabled and not recognize LAN cable plugged in. Trying to enable would not do anything. Once again installing the driver "Atheros LAN Driver" from asus support section "LAN" fixed the issue.
Saturday, May 25, 2013
Server Side Include in IIS Express
To enable SSI in IIS Express, open configuration file:
C:\Users\%user%\Documents\IISExpress\config\applicationhost.config
and within it make sure that:
1) SSI is enabled - within "globalModules" section should be a tag: <add name="ServerSideIncludeModule" image="%IIS_BIN%\iis_ssi.dll" />
2) set a default document with "shtml" - within "defaultDocument" section add e.g. <add value="index.shtml" />
One more thing to note about SSI files. I was struggling a lot with includes breaking my page layout - adding empty line in every spot where #include was used. Apparently the problem is with encoding of the file. So instead of using "Unicode (UTF-8 with signature)", save your include files with "Unicode (UTF-8 without signature)" - in visual studio you can set this in menu File -> Advanced Save Options...
C:\Users\%user%\Documents\IISExpress\config\applicationhost.config
and within it make sure that:
1) SSI is enabled - within "globalModules" section should be a tag: <add name="ServerSideIncludeModule" image="%IIS_BIN%\iis_ssi.dll" />
2) set a default document with "shtml" - within "defaultDocument" section add e.g. <add value="index.shtml" />
One more thing to note about SSI files. I was struggling a lot with includes breaking my page layout - adding empty line in every spot where #include was used. Apparently the problem is with encoding of the file. So instead of using "Unicode (UTF-8 with signature)", save your include files with "Unicode (UTF-8 without signature)" - in visual studio you can set this in menu File -> Advanced Save Options...
Sunday, December 04, 2011
WorkItem only view in TFS 2010 Web Access
Here is an excellent how-to. It covers the very simple scenario as well as more complex approach (in case you need to deal with multiple customers and need more granual settings).
However, there's one glitch that is not mentioned there. TFS has a nasty habit of not picking up domain changes right-away. So if you just created the user & group in your domain, set everything up according to the how-to, you may end up with an error:
Access Denied: {your user} needs the following permission(s) to perform this action: View instance-level information
There's a thread describing the issue. In essence you have a choice of:
However, there's one glitch that is not mentioned there. TFS has a nasty habit of not picking up domain changes right-away. So if you just created the user & group in your domain, set everything up according to the how-to, you may end up with an error:
Access Denied: {your user} needs the following permission(s) to perform this action: View instance-level information
There's a thread describing the issue. In essence you have a choice of:
- wait for a bit (30 minutes or so) and TFS will pick it up eventually
- restart the TFS server
- instead of using group, use user credentials directly (probably not the best option though)
Saturday, December 03, 2011
Adding Facebook comments to blog
I've decided to try and utilize Facebook Comments Plugin for my travel blog application (ASP.Net). At first glance it seemed like a job for 5 minutes, however it proved to be quite a tricky experience. I had following requirements:
To get started, follow this tutorial (post #11). In essence, you need to set up Facebook Application using following steps:
1. Go to: http://www.facebook.com/developers
2. Click on the + Set Up New App button (at the top right of the page)
3. Type your App Name (example: Mysite-Name Comments) > select Agree > click on Create App
4. Go to the Web Site tab (on the left tabs-list)
5. Enter your site url with an ending slash in Site URL, (for example: http://example.com/)
Enter your site domain without http://www. in Site Domain, (for example: example.com)
and click on Save Changes
6. You will see your Application ID number (above your app API Key & App Secret)
7. It will take between 2 to 20 minutes until it will be ready to use with.
Use this page to see the list of your applications.
Now that you have you aplication set up and you have the application ID, it's time to set up the security settings. Comments left on for your application can be moderated here - and here using the Settings link you can also adjust the security settings.
Final step is to generate the required code for your page. Use the Comments Tool for that. The top part with generated script is NOT COMPLETE! You do need to register the Javascript SDK - I recommend using the script on that page instead of the one from comment tool (in step 1). Step 2 gives you the DIV element which contains the comments box itself - works like a charm and yes, you can use href with different querystrings.
There are couple of new features that you can read about in this blog post.
You are very close to being done, however there are couple more settings that you should add to your page's header tag. Details are described n the Open Graph Protocol documentation in the Getting Started section. Finally you should add following tag:
meta property="fb:app_id" content="YOUR-APP-ID"
That will ensure that your moderators will be able to do in-place moderating (i.e. the plugin shows them the "moderate" option)
Use Facebook Debugger to see what settings your page uses and if there's anything that needs your attention.
- need to be able to display multiple comments sections per page (since I have 10 blog-posts on each page and each post needs to have its own comments) that need to be distinguishable by querystring parameters
- need to have a way of calculating how many comments there are for each post
- would love to have a way of being able to get latest X comments across all the whole site (i.e. irregardless which blog-post they belong to)
To get started, follow this tutorial (post #11). In essence, you need to set up Facebook Application using following steps:
1. Go to: http://www.facebook.com/developers
2. Click on the + Set Up New App button (at the top right of the page)
3. Type your App Name (example: Mysite-Name Comments) > select Agree > click on Create App
4. Go to the Web Site tab (on the left tabs-list)
5. Enter your site url with an ending slash in Site URL, (for example: http://example.com/)
Enter your site domain without http://www. in Site Domain, (for example: example.com)
and click on Save Changes
6. You will see your Application ID number (above your app API Key & App Secret)
7. It will take between 2 to 20 minutes until it will be ready to use with.
Use this page to see the list of your applications.
Now that you have you aplication set up and you have the application ID, it's time to set up the security settings. Comments left on for your application can be moderated here - and here using the Settings link you can also adjust the security settings.
Final step is to generate the required code for your page. Use the Comments Tool for that. The top part with generated script is NOT COMPLETE! You do need to register the Javascript SDK - I recommend using the script on that page instead of the one from comment tool (in step 1). Step 2 gives you the DIV element which contains the comments box itself - works like a charm and yes, you can use href with different querystrings.
There are couple of new features that you can read about in this blog post.
You are very close to being done, however there are couple more settings that you should add to your page's header tag. Details are described n the Open Graph Protocol documentation in the Getting Started section. Finally you should add following tag:
meta property="fb:app_id" content="YOUR-APP-ID"
That will ensure that your moderators will be able to do in-place moderating (i.e. the plugin shows them the "moderate" option)
Use Facebook Debugger to see what settings your page uses and if there's anything that needs your attention.
Monday, July 04, 2011
Getting Could not load file or assembly App_Web for SVC
I have couple of SVC services within an ASP.Net 4.0 website. All works fine with some hiccups (see my previous posts about issues with naming, etc.), but then I started getting errors again when accessing them (500 internal server error). So I investigated what's happening and found out that services are not working and returning:
asp.net svc could not load assembly App_Web...
What the heck? All worked fine and all I did was to add some assembly references to web.config. Turns out that compilation tag may cause this issue - and solution is:
set the "batch" attribute of the "compilation" tag in web.config to "false.
Sunday, June 12, 2011
Getting 400 Bad Data when using svc for AJAX calls
You may run into problems when using WCF service for AJAX calls. I've described how to use it in this post. Turns out, there's one small thing in configuration, that can cause all sorts of problems.
I've named the service "MyService.svc". Registered everything, configured in web.config, but I was still getting errors during load - essentially the ".../MyService.svc/js" (or ".../jsdebug" in debug mode) was returning 400 Bad Data error.
I've finally pinned the problem to web.config setting - the name attribute of the service has to match the class name.
So this is wrong:
<service name="aaaMyService">
...
And this is correct:
<service name="MyService">
Saturday, April 16, 2011
Ajax SVC getting 404 error when using https
We're using AJAX WCF service for javascript calls.
All worked well while we were running under http, but when we went to production and switched to https, all of a sudden service wasn't workin. Following was happening:
http://mytest.com/test.svc/js - worked fine
https://mytest.com/test.svc - worked fine
https://mytest.com/test.svc/js - 404 error
Turned out we were missing binding configuration for https. This blogpost describes how to fix it (i'm attaching the XML fragment just in case the blog goes missing...)
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="TestServiceAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service name="TestService">
<endpoint address="" behaviorConfiguration="TestServiceAspNetAjaxBehavior"
binding="webHttpBinding" bindingConfiguration="webBinding" contract="TestService" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="webBinding">
<security mode="Transport">
</security>
</binding>
</webHttpBinding>
</bindings>
</system.serviceModel>
Tuesday, March 15, 2011
Calling OperationContract in SVC using JavaScript
I was attempting to use WebMethod in a masterpage. Since .Net doesn't support static inheritance, I was out-of-luck. The obvious alternative was to use web-service to do the job. Since I was using .net 4.0, I was hoping to utilize the SVC and not ASMX.
Here's how you can make it work:
1) add "myservice1.svc" using the "Add New Item" -> "AJAX-enabled WCF-Service" menu. Notice that it adds section to your web.config and also "myservice1.cs" into your App_Code.
2) create your method in the "App_Code/myservice1.cs" (sample method below). Warning! If you're using Web Site project as me, don't put anything in the ServiceContract's Namespace!
[OperationContract]
public void SampleMethod1(int param1)
{
// your code here
}
3) Next step is to register this service in your ScriptManager (in my case, I have it on my master page):
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="~/myservice1.svc" />
</Services>
</asp:ScriptManager>
4) Finally JavaScript that will call the method:
myservice1.SampleMethod1(2);
It's really that simple - the ScriptManager makes the "myservice1" available and you just call the methods. Again, please note that there's no namespace.
ReportViewer 9 issues
I was stuck with ReportViewer version 9 for one of the projects and I had to resolve 2 major issues.
First issue was the incorrect rendering of the toolbar in Chrome and Safari browsers. At last I found a piece of JS which fixes that (it uses JQuery):
// fix reportviewer toolbar in Chrome / Safari
if ($.browser.safari)
{
$("#<%=rvw1.ClientID %> table").each(function (i, item)
{
$(item).css('display', 'inline-block');
});
}
Second issue was related to apparently well known problem in IE, where the control would render double vertical scrollbars in the report body. Again, I found some JS script fragments that helped me to solve the issue:
// fix the report body size to prevent double-scrollbars in IE
window.onload = function ()
{
var viewer = document.getElementById("<%=rvw1.ClientID %>");
var frame = document.getElementById("ReportFrame<%=rvw1.ClientID %>");
if (frame != null && viewer != null)
{
var reportDiv = eval("ReportFrame<%=rvw1.ClientID %>").document.getElementById("report").contentDocument.getElementById("oReportDiv");
reportDiv.style.height = viewer.style.height;
}
}
Sunday, March 13, 2011
Increasing size of VHD
It happened to me more than once that I've started VPC and only when almost done installing and cofiguring it, I found out that the initial size of the VHD is simply not enough. Well, there's a way to fix that!
You need VhdResizer tool to create a larger copy of the "small" disk. Then you attach that copy to the existing VPC as 2nd drive and extend the volume once booted up.
Very nice detailed how-to is here.
Subscribe to:
Posts (Atom)


