Did you forget about ActiveRecordStarter.Initialize - castle-activerecord

I'm new to the castleproject so ill try to explain best I can. Theres a .net program running on example.com. I made a subdomain sub.example.com where I want the .net program to run. I moved all the files over to the sub.example.com site. When I run the site I am able to login but the pages give me this error.
An ActiveRecord class (web.exp.Vims.Model.Configuration) was used but the framework seems > not properly initialized. Did you forget about ActiveRecordStarter.Initialize() ?
StackTrace:
at Castle.ActiveRecord.ActiveRecordBase.EnsureInitialized(Type type)
at Castle.ActiveRecord.ActiveRecordBase.FindAll(Type targetType, Order[] orders, > > >ICriterion[] criteria)
at web.exp.Vims.Model.Configuration.GetBySection(String sectionName)
at expOnRails.Controllers.HomeController.Index()
I don't have access to the code, I was just hoping I could move it to the subdomain. Any tips would be appreciated.

Related

Recover Cloud functions default service account with the undelete POST call

I have used Google Cloud Functions for quite a long time, with no real authentication problem for now.
Today I meet this error while deploying a new function
ERROR: (gcloud.functions.deploy) ResponseError: status=[400], code=[Bad Request], message=[Default service account 'PROJECT-ID#appspot.gserviceaccount.com' doesn't exist. Please recreate this account (for example by disabling and enabling the Cloud Functions API), or specify a different account.]
I tried several things :
disable/enable GCF API : no service account recovered
gcloud beta app repair reference here
No default service account recovered
the undelete API POST call
If I understand well the current GCP features, using the last option is my best solution, but somehow I keep getting a 400 error
I found my unique-id in my log activity at the creation of the default service account
I really can't see where is the problem in the undelete API call and would be really thankful if you could help with it
Thanks to #Maxim, I know now that my problem comes from the fact that the deleting of this service account happened more than 30 days ago. Which means that it has already been purged from the system and it's not recoverable anymore.
In case you meet this same kind of problem, please try out this link :
https://cloud.google.com/iam/docs/creating-managing-service-accounts#undeleting_a_service_account
I see three alternative ways in how to proceed here next:
Create a new project from scratch to work from.
File a support case via the support center.
Open a private issue by providing your project number in the following component.
I believe it's convenient in reaching out GCP Support for help at this stage, and recommend you to do so; seeing as you've attempted most if not all ways of Service Account recovery to no success.
On a last note, as for the latter option, the contents of the private issue will only be visible to you, and to the GCP Support staff (us). If you choose this option, please let me know when it's opened, and I'll start working on it as soon as possible.

Aws Iot Rule republish to a dynamic topic

I subscribe Aws Iot topic;
12345678/state
I try to write a rule to get this topic's payload at
12345678/shadow/update
I have written my rule by following these steps;
My query string is
SELECT * FROM '+/state'
My action is republishing everything without changing to other topic like this below
$$aws/things/${topic(1)}/shadow/update
When i write some static data instead of topic(1) function like "test", it works. However, i couldn't get topic name dynamically. There is no suitable document explaining how can achieve getting this topic name.
What is the right way to get topic name which is in my case "12345678"?
Actually, there was no problem getting topic name by using topic(1) function like this below;
$$aws/things/${topic(1)}/shadow/update
The problem was about policy permission. After adding necessary publish permissions to my policy. I start getting payloads.
For anyone else who can't figure out why
${topic(1)}
works for Arda, here is why:
https://docs.aws.amazon.com/iot/latest/developerguide/iot-substitution-templates.html
Turns out you can do "substitution templates" in the republish topic string.
Your next issue will be making sure the role assigned to the rule has a policy attached to it that allows it to publish to the iot core topic (doesn't get a policy that permits this automatically for some reason).

Access Sitecore DB from API in Console application

I would like to accesss the sitecore DB and items from console application like
Sitecore.Data.Database db = Sitecore.Context.Database
or
Sitecore.Data.Database db = Sitecore.Data.Database.GetDatabase("master")
how do I configure and setup my console application to access the DB as above?
Thanks Everyone for the suggestion, I am really interested in config changes, I used webservice, but it has very limited methods. For example, if I would like create an Item with the template and insert the item with prepopulated value, there is no such option. The reason I am looking for the console apporach is I would like to import the contents from XML or excel sheet and push those to the sitecore tree, eventually use the scheduled task to run the console app periodically. I do not want to copy the entire web.config and app_config. If anyone has already done this, could you please post your steps and necessary config changes?
You have two options I think:
1) Import the Sitecore bits of a website's web.config into your console application's app.config, so that the Sitecore API "just works"
I'm sure I read a blog post about this, but I can't find the reference right now. (I will have another look) But I think the simple but long winded approach is to copy all of the <sitecore/> element and all the separate files it references. I'm fairly sure you can whittle this down to a subset of the config required for data access with a bit of thinking.
2) Don't use the Sitecore API directly, connect to a web service that exposes access to it remotely.
There are a few of these that already exist. Sitecore itself exposes one, Sitecore Rocks has one, and Hedgehog TDS has one too. And you can always write your own (since any web service running inside the Sitecore ASP.Net app can make database calls and report values back and forth - just remember to consider security if this web service might end up exposed externally for any reason)
John West links to some relevant stuff here:
http://www.sitecore.net/Learn/Blogs/Technical-Blogs/John-West-Sitecore-Blog/Posts/2013/09/Getting-Data-Out-of-the-Sitecore-ASPNET-CMS.aspx
-- Edited to add --
I've not found the blog post I remember. But I came across this SO thread:
Accessing Sitecore API from a CLI tool
which refers to this blog post:
http://www.experimentsincode.com/?p=232
which I think gives the info you'll need for option 1.
(And it reminds me that, of course, when you copy the config stuff you have to copy the Sitecore binaries into your app's folder as well)
I would just like to expand on #JermDavis' post and note that Sitecore isn't a big fan of being accessed when not in a web application. However, if you still want to do this, you will need to make sure that you have all of the necessary configuration settings from the web.config and App_Config of your site in your console application's app.config file.
Moreover, you will never be able to call Sitecore.Context in a console application, as the Sitecore Context sits on top of the HttpContext which means that it must be an application and have a valid request for you to use it. What you are looking for is something more along the lines of Sitecore.Configuration.Factory.GetDatabase("master").
Good luck and happy coding :)
This sounds like a job for the Sitecore Item Web API. I use the Sitecore Item Web API whenever I need to access Sitecore data from the master database outside the context of the Content Management server or outside of the context of the Sitecore application. The Web API definitely does not allow you to do everything that the standard Sitecore API does but it can act as a good base and I now extend upon the Web API instead of writing my own custom web services whenever possible.
Thanks to JemDavis's advise.
After I copied the configuration and made changes to config section to get rid of conflicts. I copied almost all of Sitrecore, analytics and lucene dlls, it worked great.
Only thing you have to remember is, copy the app_config folder to the same location where your dlls are.
Thanks again JemDavis....

Error while executing query for custom object Work Order

I am executing the query for my custom object created in SFDC. but i am getting the following error:
{'[{"message":"\nSELECT FS_Account_Name__c from FS_Work_Order__c\ERROR at Row:1:Column:34\nsObject type 'FS_Work_Order__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.","errorCode":"INVALID_TYPE"}]'} Thoough have written the correct table name as given while i created the Custom object. PLease help.
First thing to try: does it work properly when run as the system administrator profile? If so then it's certainly a permissions issue. Things to checl
The object is deployed (Setup > Create > Objects > Edit > Deployment Status)
The profile has permission to query the object.
If not, does that same query work from inside the developer console? If so I can't think of what it might be, except connecting to production instead of a sandbox or vice versa.

Config/Settings for a Microsoft CRM 2011 Form Silverlight Control

Need an idea on best practise in finding a solution.
We are looking at developing Silverlight controls for CRM forms that will need to reference a common configuration file for data. It is a file that will need to be maintained periodically every once in a while. We don't want to be hardcoding values into the Silverlight control.
My question is... Where/What/How do we provide a config file for a Silverlight control?
I tried uploading a JS web resource that simply was a JSON array full of settings that I tried to access from the Silverlight control. All I got were permission errors when I used both the admin account and my domain account to do a Http get of the file and parse it. Can someone confirm that this could work if I manage to work through these annoying permission errors?
My next thought was having a CRM entity full of settings that the Silverlight control could make ODATA calls to in order to get its config data. I'm not 100% sold on the idea though.
Perhaps there is another way people have been using - if so - I'd love to see what you are doing. This could really prevent us from coming to a Silverlight enriched solution that we are after.
Thanks in advance
We go about this in two ways.
We have a configuration entity for settings that might be changed on a customer site by their administrator.
For other configuration data that is unlikely to be changed, we install an XML web resource. This method means we can store a lot of data without having to create and manage complex entities (or relationships if required). If set as an unmanaged/customizable web resource, then the text editor can be used to make changes, although remember that these changes must not break the XML schema/syntax.
This xml web resource can be retrieved in Silverlight using WebClient.DownloadStringAsync() as shown below.
private void GetXmlConfiguration(string resourceName)
{
var webClient = new WebClient();
webClient.DownloadStringCompleted += OnGetConfigurationXmlCompleted;
webClient.DownloadStringAsync(new Uri("../Data/" + resourceName, UriKind.Relative));
}
private void OnGetConfigurationXmlCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error == null && !string.IsNullOrEmpty(e.Result))
{
//use xml string here
}
}
We use the configuration entity method quite often and I think it works well.
You should be able to use your initial method as well... I know in a few places we've done some XML configuration in a web resource that we've retrieved in Silverlight, parsed, and done something with.

Resources