"mshtml.HTMLWindow2Class.document " throws System.UnAuthorizedAccessException. - com

I am using mshtml.HTMLWindow2Class.document property to check the state of the web page. But I kept get the following exception:
System.UnAuthorizedAccessException.
Anybody know how to fix it? I think maybe some permission is not configured correctly for mshtml, but I donw' know the detail steps to check and configure it.
Maybe I could put it this way:
If a COM component lacks some permission, how could I grant it?
Thanks!

Related

Add dynamic resource with PUT on non-existent path with Californium

I want the Californium CoAP server to handle a PUT request with a yet non-existent Resource path. Instead of providing an Error return message, the server should dynamically add a resource with the path the PUT method is targeting.
I am using the cf-plugtest-server coming with the Californium Core library in Java to try to implement this function. Unfortunately i am completely new to Californium and couldn't find a solution approach.
So far i found out the "resource not found" output is taking place at the ServerMessageDeliverer in californium.core.server with deliverRequest. However i don't know how to proceed from here.
Any help is very much appreciated. I am sorry if a solution to this is more obvious, i am fairly new to such a kind of programming. Thank you in advance!
Manipulations/changes on the resource tree are currently not supported out of the box.
The currently intended way is to provide a specific implementation of ServerMessageDeliverer which overrides the preDeliverRequest. there you may create the resource you want and add it to the resources tree.

Adding User to Role with Asp.Net Identity

I am trying to add a user to a role in VB.net with ASP.NET identity. One idea I had in mind was trying to use the IUserRoleStore but I do not know how to use it properly. I also am not sure if I am on the right path, anyone have a clue if I am or not?
I keep getting 2 errors over and over as seen in my Screenshots, that I have provided as links. One error I get is UserId not found error aka Error 1. Keep in mind in this instance the error is raised when checking IsInRole(). The one thing that catches my eye is when looking at the stack trace I see
Microsoft.AspNet.Identity.UserManagerExtensions.IsInRole(UserManager`2 manager, TKey userId, String role) +140
I believe this could be the key to solving this problem.
And if I am able to get past that error my reworking my code or just simply only trying to AddToRole instead of checking IsInRole I get a lengthy a network-related or instance-specific error that for brevity I'll sum it up as Error 26: Error Locating Server/Instance Specified. This can be seen under Error 2.
If anyone is interested in helping me solve this, please let me know so I can post the code you need to help understand cause it is pretty lengthy.

Unable to locate persister for the entity, no code has changed

I am suddenly getting the error: "Unable to locate persister for the entity named 'MyLib.Project'."
I did not make any code changes to this project since the last time I published it. The reason I went into the code to look at it is because a user reported that the web page that utilizes this library was giving an error. I have also checked the eager loading of the provider as per (NHibernate - Random occurrences of "Unable to locate persister") but I am already eagerly loading.
Furthermore, I even changed my data provider configuration to:
.Mappings(Function(x) x.FluentMappings.AddFromAssemblyOf(Of Project)())
I stepped through the code and actually saw it find the Project mapping and step through it. There are no exceptions thrown while building the provider, but yet the web app still fails when I try to fetch a Project from the DB.
Update
I have tested this same exact code with a desktop application and it works perfectly fine. It seems to me the problem must be with NHibernate and the Web Application. Does anyone have any ideas about this specifically?
The answer to this, of course, is that I made a mistake.
I had two session factories in use in the same program and I passed a session from the wrong factory to one of my functions. So the error is correct, because the session it was passed was unaware of the Project type. I found this out eventually by looking at the Connection property of the session I was querying through.
Hopefully this helps someone else who may have made the same mistake.

Eclipse plugin problem

When ever I try to do soft ware updates through my Eclipse Galileo, I get the following error
Unable to connect to repository http://pydev.org/updates/content.xml
Connection timed out: connect
Please help!!
That's a redirect to: http://update-production-pydev.s3.amazonaws.com/pydev/updates (so, you can try that directly).
If it still fails, it means that amazon is having issues (which means you'll have to try later again).
Cheers,
Are you using (just) http://pydev.org/updates as the url? The "location" field should only have "http://pydev.org/updates", no content.xml. Seems to be working fine for me (with Helios).
Actually I checked what happens when you use "http://pydev.org/updates/content.xml", and it does seem to give the type of error you describe. (You would think it could give a slightly better error, but oh well.)

Proper way to check system requirements for a WordPress plugin

I am curious about the proper way to stop a user from activating my plugin if their system does not meet certain requirements. Doing the checks is easy and I don't need any help with that, I am more curious how to tell WordPress to exit and display an error message.
Currently I have tried both exit($error_message) and die($error_message) in the activation hook method. While my message is displayed and the plugin is not activated, a message saying Fatal Error is also displayed (see image below).
Does anyone know of a better way, that would display my message in a proper error box without displaying Fatal error, it just looks really bad for new users to see that.
Thanks for any help in advance.
This is a little undocumented, as you might have noticed. Instead of die(), do it like this:
$plugin = dirname(__FILE__) . '/functions.php';
deactivate_plugins($plugin);
wp_die('<p>The <strong>X</strong> plugin requires version WordPress 2.8 or greater.</p>','Plugin Activation Error',array('response'=>200,'back_link'=>TRUE));
The lines above wp_die() are to deactivate this plugin. Note that we use functions.php in this case because that's where I have my Plugin Name meta data comment declaration -- and if you use a different file, then change the code above. Note that the path is very specific for a match. So, if you want to see what your path would normally be, use print_r(get_option('active_plugins'));die(); to dump that out so that you know what path you need. Since I had a plugin_code.php where the rest of my plugin code was, and since it was in the same directory as functions.php, I merely had to do dirname(__FILE__) for the proper path.
Note that the end of the wp_die() statement is important because it provides a backlink and prevents an error 500 (which is the default Apache code for wp_die()).
It is only a idea though. Try checking the wordpress version and compare then use php to through custom exception/error. PHP 5.0 try catch can be a good way to do it. Here is some resources.
http://www.w3schools.com/php/php_exception.asp
http://php.net/manual/en/internals2.opcodes.throw.php
You can try the first link. It is pretty basic. Thanks! hope the information will be helpful.